FS-10326: [mod_conference] Memory leak while playing video files that contain only a video stream #resolve
This commit is contained in:
parent
c70fc7a940
commit
abd7545608
|
@ -1543,10 +1543,6 @@ static void *SWITCH_THREAD_FUNC file_read_thread_run(switch_thread_t *thread, vo
|
||||||
vid_frames = switch_queue_size(context->eh.video_queue);
|
vid_frames = switch_queue_size(context->eh.video_queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vid_frames > context->read_fps) {
|
|
||||||
switch_yield(250000);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (switch_buffer_inuse(context->audio_buffer) > AUDIO_BUF_SEC * context->audio_st.sample_rate * context->audio_st.channels * 2 &&
|
if (switch_buffer_inuse(context->audio_buffer) > AUDIO_BUF_SEC * context->audio_st.sample_rate * context->audio_st.channels * 2 &&
|
||||||
(!context->has_video || vid_frames > 5)) {
|
(!context->has_video || vid_frames > 5)) {
|
||||||
switch_yield(context->has_video ? 1000 : 10000);
|
switch_yield(context->has_video ? 1000 : 10000);
|
||||||
|
@ -1683,6 +1679,9 @@ again:
|
||||||
context->vid_ready = 1;
|
context->vid_ready = 1;
|
||||||
switch_queue_push(context->eh.video_queue, img);
|
switch_queue_push(context->eh.video_queue, img);
|
||||||
context->last_vid_push = switch_time_now();
|
context->last_vid_push = switch_time_now();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1830,7 +1829,7 @@ static switch_status_t av_file_open(switch_file_handle_t *handle, const char *pa
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context->has_video) {
|
if (context->has_video) {
|
||||||
switch_queue_create(&context->eh.video_queue, SWITCH_CORE_QUEUE_LEN, handle->memory_pool);
|
switch_queue_create(&context->eh.video_queue, context->read_fps, handle->memory_pool);
|
||||||
switch_mutex_init(&context->eh.mutex, SWITCH_MUTEX_NESTED, handle->memory_pool);
|
switch_mutex_init(&context->eh.mutex, SWITCH_MUTEX_NESTED, handle->memory_pool);
|
||||||
switch_core_timer_init(&context->video_timer, "soft", 66, 1, context->pool);
|
switch_core_timer_init(&context->video_timer, "soft", 66, 1, context->pool);
|
||||||
}
|
}
|
||||||
|
@ -2143,7 +2142,9 @@ static switch_status_t av_file_close(switch_file_handle_t *handle)
|
||||||
context->eh.finalize = 1;
|
context->eh.finalize = 1;
|
||||||
|
|
||||||
if (context->eh.video_queue) {
|
if (context->eh.video_queue) {
|
||||||
|
flush_video_queue(context->eh.video_queue, 0);
|
||||||
switch_queue_push(context->eh.video_queue, NULL);
|
switch_queue_push(context->eh.video_queue, NULL);
|
||||||
|
switch_queue_term(context->eh.video_queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context->eh.video_thread) {
|
if (context->eh.video_thread) {
|
||||||
|
@ -2163,10 +2164,6 @@ static switch_status_t av_file_close(switch_file_handle_t *handle)
|
||||||
context->file_read_thread = NULL;
|
context->file_read_thread = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context->eh.video_queue) {
|
|
||||||
flush_video_queue(context->eh.video_queue, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (context->fc) {
|
if (context->fc) {
|
||||||
if (switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) av_write_trailer(context->fc);
|
if (switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) av_write_trailer(context->fc);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue