Bug 1329891. Part 2 - default Handle{Audio,Video}Decoded to crash. r=kikuo
authorJW Wang <jwwang@mozilla.com>
Mon, 09 Jan 2017 15:48:00 +0800
changeset 459224 8a74a651866e30a135d9266527765f378e47a257
parent 459223 3029299fcdcfd1dde73708248087aac34e39f34c
child 459225 39031ddf0b3483e94a35e42200f4d4ddb2edd114
push id41160
push userbmo:eoger@fastmail.com
push dateWed, 11 Jan 2017 16:28:31 +0000
reviewerskikuo
bugs1329891
milestone53.0a1
Bug 1329891. Part 2 - default Handle{Audio,Video}Decoded to crash. r=kikuo States expect this event should override this function. MozReview-Commit-ID: 8Y4ngn4X7MS
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -187,18 +187,24 @@ class MediaDecoderStateMachine::StateObj
 public:
   virtual ~StateObject() {}
   virtual void Exit() {};  // Exit action.
   virtual void Step() {}   // Perform a 'cycle' of this state object.
   virtual State GetState() const = 0;
 
   // Event handlers for various events.
   virtual void HandleCDMProxyReady() {}
-  virtual void HandleAudioDecoded(MediaData* aAudio) {}
-  virtual void HandleVideoDecoded(MediaData* aVideo, TimeStamp aDecodeStart) {}
+  virtual void HandleAudioDecoded(MediaData* aAudio)
+  {
+    Crash("Unexpected event!", __func__);
+  }
+  virtual void HandleVideoDecoded(MediaData* aVideo, TimeStamp aDecodeStart)
+  {
+    Crash("Unexpected event!", __func__);
+  }
   virtual void HandleAudioWaited(MediaData::Type aType);
   virtual void HandleVideoWaited(MediaData::Type aType);
   virtual void HandleNotWaited(const WaitForDataRejectValue& aRejection);
   virtual void HandleAudioCaptured() {}
 
   virtual void HandleWaitingForAudio()
   {
     mMaster->WaitForData(MediaData::AUDIO_DATA);