Bug 1226707: P2 Ensure we won't operate on a decoder that failed to initialize. r=cpearce
authorJean-Yves Avenard <jyavenard@mozilla.com>
Sat, 21 Nov 2015 22:16:16 +1100
changeset 310699 9d36733ded4dbdc1892f1d1fcbe4120c95761499
parent 310698 cc0de27135b5638d03e792b3990a036f204fddd9
child 310700 b94b0f9de8bae5837a00e9dc722c003a975711a1
push id7764
push usergarndt@mozilla.com
push dateMon, 23 Nov 2015 16:05:29 +0000
reviewerscpearce
bugs1226707
milestone45.0a1
Bug 1226707: P2 Ensure we won't operate on a decoder that failed to initialize. r=cpearce
dom/media/MediaFormatReader.cpp
--- a/dom/media/MediaFormatReader.cpp
+++ b/dom/media/MediaFormatReader.cpp
@@ -414,16 +414,18 @@ MediaFormatReader::EnsureDecoderInitiali
                 auto& decoder = self->GetDecoderData(aTrack);
                 decoder.mInitPromise.Complete();
                 decoder.mDecoderInitialized = true;
                 self->ScheduleUpdate(aTrack);
               },
               [self, aTrack] (MediaDataDecoder::DecoderFailureReason aResult) {
                 auto& decoder = self->GetDecoderData(aTrack);
                 decoder.mInitPromise.Complete();
+                decoder.mDecoder->Shutdown();
+                decoder.mDecoder = nullptr;
                 self->NotifyError(aTrack);
               }));
   return false;
 }
 
 void
 MediaFormatReader::ReadUpdatedMetadata(MediaInfo* aInfo)
 {