Bug 1206977: P15. Fix FFmpeg shutdown crash should decoder not be initialised. r=me a=lizzard
authorJean-Yves Avenard <jyavenard@mozilla.com>
Wed, 07 Oct 2015 22:38:07 +1100
changeset 296459 86872269b3310602600d7e227eec2efedac00d5f
parent 296458 26262d256546245014d88a65d7384ff1c2a4a4cd
child 296460 8de5b42cda2dae1d54225ea664901d822cff40b3
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme, lizzard
bugs1206977
milestone43.0a2
Bug 1206977: P15. Fix FFmpeg shutdown crash should decoder not be initialised. r=me a=lizzard
dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp
--- a/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp
+++ b/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp
@@ -182,17 +182,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;