Bug 1206977: P15. Fix FFmpeg shutdown crash should decoder not be initialised. r=me
authorJean-Yves Avenard <jyavenard@mozilla.com>
Wed, 07 Oct 2015 22:38:07 +1100
changeset 607020 efce0ce216d9ef6ac72fb4c0cb158598e95fd08e
parent 607019 89d11d15d401dfce53000ff41c7bd314b49a8ea5
child 607021 91a5dbaf6e66529290db1fc0466a0252e6040644
push id93006
push userjyavenard@mozilla.com
push dateThu, 15 Oct 2015 05:15:33 +0000
treeherdertry@45ea2a01301e [default view] [failures only]
reviewersme
bugs1206977
milestone43.0a2
Bug 1206977: P15. Fix FFmpeg shutdown crash should decoder not be initialised. r=me
dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp
--- a/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp
+++ b/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp
@@ -189,17 +189,17 @@ FFmpegDataDecoder<LIBAV_VER>::ProcessFlu
   mon.NotifyAll();
 }
 
 void
 FFmpegDataDecoder<LIBAV_VER>::ProcessShutdown()
 {
   StaticMutexAutoLock mon(sMonitor);
 
-  if (sFFmpegInitDone) {
+  if (sFFmpegInitDone && mCodecContext) {
     avcodec_close(mCodecContext);
     av_freep(&mCodecContext);
 #if LIBAVCODEC_VERSION_MAJOR >= 55
     av_frame_free(&mFrame);
 #elif LIBAVCODEC_VERSION_MAJOR == 54
     avcodec_free_frame(&mFrame);
 #else
     delete mFrame;