From 40b3c4459d73f9de7e7191038ced077cc5c81ac5 Mon Sep 17 00:00:00 2001 From: martii Date: Sat, 20 Jul 2013 09:08:31 +0200 Subject: [PATCH] container_ffmpeg: flush streams immediately after seek --- libeplayer3/container/container_ffmpeg.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libeplayer3/container/container_ffmpeg.c b/libeplayer3/container/container_ffmpeg.c index 53d5edf..fc41a11 100644 --- a/libeplayer3/container/container_ffmpeg.c +++ b/libeplayer3/container/container_ffmpeg.c @@ -426,6 +426,12 @@ static void FFMPEGThread(Context_t *context) { restart_audio_resampling = 1; latestPts = 0; seek_target_flag = 0; + + // flush streams + unsigned int i; + for (i = 0; i < avContext->nb_streams; i++) + if (avContext->streams[i]->codec && avContext->streams[i]->codec->codec) + avcodec_flush_buffers(avContext->streams[i]->codec); } if (context->playback->BackWard) { @@ -531,12 +537,6 @@ static void FFMPEGThread(Context_t *context) { if (restart_audio_resampling) { restart_audio_resampling = 0; - - // flush streams - unsigned int i; - for (i = 0; i < avContext->nb_streams; i++) - if (avContext->streams[i]->codec && avContext->streams[i]->codec->codec) - avcodec_flush_buffers(avContext->streams[i]->codec); #ifdef USE_LIBSWRESAMPLE if (swr) { swr_free(&swr);