]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-10326: [mod_conference] Memory leak while playing video files that contain only...
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 18 May 2017 18:42:40 +0000 (13:42 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Thu, 18 May 2017 18:42:40 +0000 (13:42 -0500)
src/mod/applications/mod_av/avformat.c

index efadc877084291c1dc0757dfadffdef54b66ce4e..7de6dfd3fde894b1a263885878f3ec45ebad22b8 100644 (file)
@@ -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);
                }
                
-               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 &&
                        (!context->has_video || vid_frames > 5)) {
                        switch_yield(context->has_video ? 1000 : 10000);
@@ -1683,6 +1679,9 @@ again:
                                                context->vid_ready = 1;
                                                switch_queue_push(context->eh.video_queue, img);
                                                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) {
-                       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_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;
 
        if (context->eh.video_queue) {
+               flush_video_queue(context->eh.video_queue, 0);
                switch_queue_push(context->eh.video_queue, NULL);
+               switch_queue_term(context->eh.video_queue);
        }
 
        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;
        }
 
-       if (context->eh.video_queue) {
-               flush_video_queue(context->eh.video_queue, 0);
-       }
-
        if (context->fc) {
                if (switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) av_write_trailer(context->fc);