]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-7696
authorAnthony Minessale <anthm@freeswitch.org>
Fri, 19 Jun 2015 23:21:48 +0000 (18:21 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Fri, 19 Jun 2015 23:21:48 +0000 (18:21 -0500)
src/mod/applications/mod_av/avformat.c

index 45a1f6fdd3c22c3afb843e58ee8647ec71f5a9a8..6b36dd4edde1dae2d7625f52767554238ad2148a 100644 (file)
@@ -1506,6 +1506,21 @@ static switch_status_t av_file_truncate(switch_file_handle_t *handle, int64_t of
        return SWITCH_STATUS_FALSE;
 }
 
+static void flush_video_queue(switch_queue_t *q)
+{
+       void *pop;
+
+       if (switch_queue_size(q) == 0) {
+               return;
+       }
+
+       while (switch_queue_trypop(q, &pop) == SWITCH_STATUS_SUCCESS) {
+               switch_image_t *img = (switch_image_t *) pop;
+               switch_img_free(&img);
+       }
+
+}
+
 static switch_status_t av_file_close(switch_file_handle_t *handle)
 {
        av_file_context_t *context = (av_file_context_t *)handle->private_info;
@@ -1524,6 +1539,10 @@ static switch_status_t av_file_close(switch_file_handle_t *handle)
                switch_thread_join(&status, context->file_read_thread);
        }
 
+       if (context->eh.video_queue) {
+               flush_video_queue(context->eh.video_queue);
+       }
+
        if (context->fc) {
                if (switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) av_write_trailer(context->fc);
 
@@ -1884,7 +1903,6 @@ static switch_status_t av_file_set_string(switch_file_handle_t *handle, switch_a
        if (context->fc) {
                const char *field = switch_parse_audio_col(col);
 
-               printf("WTF [%s][%s]\n", field, string);
                if (field) {
                        av_dict_set(&context->fc->metadata, field, string, 0);
                        return SWITCH_STATUS_SUCCESS;