Bug 1406503 - P4. Re-create av_parser when flushing. r=jwwang
authorJean-Yves Avenard <jyavenard@mozilla.com>
Fri, 27 Oct 2017 00:45:27 +0200
changeset 389040 6a20de1a556f868360ac4c55d38efad5cdb82bf7
parent 389039 5f06da1362df0f9cb0587378d31e3785aeb40a5a
child 389041 f96ce9a8172ce7d489d78b6cf237afb1d6a851f7
push id32777
push userarchaeopteryx@coole-files.de
push dateMon, 30 Oct 2017 22:44:45 +0000
treeherdermozilla-central@dd0f265a1300 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwwang
bugs1406503
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1406503 - P4. Re-create av_parser when flushing. r=jwwang It is unknown if an av_parser is usable after having been drained. So to be certain, we simply tear it down and re-create it. MozReview-Commit-ID: 6NFMHbRMwxs
dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp
--- a/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp
+++ b/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp
@@ -201,16 +201,20 @@ FFmpegDataDecoder<LIBAV_VER>::ProcessDra
 
 RefPtr<MediaDataDecoder::FlushPromise>
 FFmpegDataDecoder<LIBAV_VER>::ProcessFlush()
 {
   MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn());
   if (mCodecContext) {
     mLib->avcodec_flush_buffers(mCodecContext);
   }
+  if (mCodecParser) {
+    mLib->av_parser_close(mCodecParser);
+    mCodecParser = mLib->av_parser_init(mCodecID);
+  }
   return FlushPromise::CreateAndResolve(true, __func__);
 }
 
 void
 FFmpegDataDecoder<LIBAV_VER>::ProcessShutdown()
 {
   StaticMutexAutoLock mon(sMonitor);