Pārlūkot izejas kodu

ffmpeg: Use `avcodec_flush_buffers` when seeking

Previously this would close and reopen the codec context;
that's entirely unnecessary, as all supported versions of
libavcodec support flushing the buffers instead.
Sam Edwards 7 gadi atpakaļ
vecāks
revīzija
8d36908556
1 mainītis faili ar 1 papildinājumiem un 10 dzēšanām
  1. 1 10
      panda/src/ffmpeg/ffmpegAudioCursor.cxx

+ 1 - 10
panda/src/ffmpeg/ffmpegAudioCursor.cxx

@@ -437,16 +437,7 @@ seek(double t) {
     cleanup();
     cleanup();
     return;
     return;
   }
   }
-  avcodec_close(_audio_ctx);
-  AVCodec *pAudioCodec = avcodec_find_decoder(_audio_ctx->codec_id);
-  if(pAudioCodec == 0) {
-    cleanup();
-    return;
-  }
-  if (avcodec_open2(_audio_ctx, pAudioCodec, NULL) < 0) {
-    cleanup();
-    return;
-  }
+  avcodec_flush_buffers(_audio_ctx);
   _buffer_head = 0;
   _buffer_head = 0;
   _buffer_tail = 0;
   _buffer_tail = 0;
   fetch_packet();
   fetch_packet();