[mod_av] fix leak (#211)

This commit is contained in:
Seven Du 2020-06-04 07:27:48 +08:00 committed by Andrey Volk
parent 5243fbd3c5
commit 97276035dc
2 changed files with 7 additions and 3 deletions

View File

@ -784,6 +784,7 @@ static void flush_video_pkt_queue(switch_queue_t *q)
while (switch_queue_trypop(q, (void **)&pkt) == SWITCH_STATUS_SUCCESS) {
av_packet_unref(pkt);
free(pkt);
}
}

View File

@ -178,15 +178,18 @@ FST_CORE_BEGIN("conf")
status = switch_core_file_open(&fh, path, 1, 8000, flags, fst_pool);
fst_requires(status == SWITCH_STATUS_SUCCESS);
fst_requires(switch_test_flag(&fh, SWITCH_FILE_OPEN));
frame.data = data;
frame.packet = data;
frame.data = data + 12;
frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE;
do {
frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE;
frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE - 12;
status = switch_core_file_read(&fh, data, &len);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "status: %d len: %d\n", status, (int)len);
fst_check(frame.img == NULL);
frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE;
frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE - 12;
status = switch_core_file_read_video(&fh, &frame, 0);
fst_check(frame.img == NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "status: %d len: %d %02x\n", status, frame.datalen, *(uint8_t *)frame.data);
} while (status == SWITCH_STATUS_MORE_DATA);