Quellcode durchsuchen

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 vor 7 Jahren
Ursprung
Commit
8d36908556
1 geänderte Dateien mit 1 neuen und 10 gelöschten Zeilen
  1. 1 10
      panda/src/ffmpeg/ffmpegAudioCursor.cxx

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

@@ -437,16 +437,7 @@ seek(double t) {
     cleanup();
     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_tail = 0;
   fetch_packet();