From 4d3479296de0f2bd5394595c20eb7011b5947528 Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Sat, 28 Nov 2009 17:36:22 +0100 Subject: [PATCH] Flush frames buffered during format probing To measure timing characteristic correctly, we must flush previously buffered frames before the measurement starts. --- build/recorder/ffmpeg.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/build/recorder/ffmpeg.c b/build/recorder/ffmpeg.c index 259863e..c413cba 100644 --- a/build/recorder/ffmpeg.c +++ b/build/recorder/ffmpeg.c @@ -4085,6 +4085,16 @@ int frsh_stuff() } #endif /* CONFIG_FFMPEG_WITH_FRSH */ +void flush_buffered_frames(AVFormatContext *s) +{ + AVPacketList *pktl; + while ((pktl = s->packet_buffer)) { + av_free_packet(&pktl->pkt); + s->packet_buffer = pktl->next; + av_free(pktl); + } +} + int main(int argc, char **argv) { int i; @@ -4118,6 +4128,9 @@ int main(int argc, char **argv) opt_output_file("stream.mp4"); } + for (i=0; i