This commit is contained in:
Anthony Minessale 2015-06-19 18:21:48 -05:00
parent ccaf29254e
commit 19ace86b4f
1 changed files with 19 additions and 1 deletions

View 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;