Skip to content

Commit

Permalink
* fix rtsp resource not released
Browse files Browse the repository at this point in the history
  • Loading branch information
lxowalle committed Nov 29, 2024
1 parent 94696ac commit d1be03e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions components/vision/port/maixcam/maix_rtsp_maixcam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ namespace maix::rtsp
delete param->rtsp_server;
param->rtsp_server = nullptr;
}

free(_param);
_param = nullptr;
}

for (auto &region : this->_region_list) {
Expand Down Expand Up @@ -474,6 +477,11 @@ namespace maix::rtsp
_thread = nullptr;
}

while (param->status != RTSP_IDLE) {
time::sleep_ms(100);
log::info("wait rtsp thread exit..");
}

if (param->ffmpeg_packer) {
delete param->ffmpeg_packer;
param->ffmpeg_packer = nullptr;
Expand Down
2 changes: 1 addition & 1 deletion components/voice/port/maixcam/maix_audio_mmf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ namespace maix::audio
int frame_byte = snd_pcm_format_width(format) / 8;
if (buffer_size < frame_byte * channels * frame_size) {
printf("Bad buffer size, input %ld, need %d\r\n", buffer_size, frame_byte * channels * frame_size);
return 0;
return -1;
}

if ((len = (int)snd_pcm_readi(handle, buffer, frame_size)) < 0) {
Expand Down

0 comments on commit d1be03e

Please sign in to comment.