Bug 1125047 - GMP should catch decoder failures. r=jesup, a=lmandel
authorEthan Hugg <ethanhugg@gmail.com>
Mon, 26 Jan 2015 15:00:06 -0800
changeset 250434 5598a289b442
parent 250433 c54687cb7086
child 250435 a49b40d229df
push id4589
push userryanvm@gmail.com
push date2015-03-19 02:20 +0000
treeherdermozilla-beta@d76c709556bb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup, lmandel
bugs1125047
milestone37.0
Bug 1125047 - GMP should catch decoder failures. r=jesup, a=lmandel
media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp
media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.h
--- a/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp
+++ b/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp
@@ -501,17 +501,18 @@ WebrtcGmpVideoEncoder::Encoded(GMPVideoE
   }
 }
 
 // Decoder.
 WebrtcGmpVideoDecoder::WebrtcGmpVideoDecoder() :
   mGMP(nullptr),
   mHost(nullptr),
   mCallback(nullptr),
-  mCachedPluginId(0) {}
+  mCachedPluginId(0),
+  mDecoderStatus(GMPNoErr){}
 
 static void
 Decoder_Close_g(GMPVideoDecoderProxy* aGMP)
 {
   aGMP->Close();
 }
 
 WebrtcGmpVideoDecoder::~WebrtcGmpVideoDecoder()
@@ -671,17 +672,20 @@ WebrtcGmpVideoDecoder::Decode_g(const we
   LOGD(("GMP Decode: %llu, len %d", frame->TimeStamp(), aInputImage._length));
   nsresult rv = mGMP->Decode(Move(frame),
                              aMissingFrames,
                              codecSpecificInfo,
                              aRenderTimeMs);
   if (NS_FAILED(rv)) {
     return WEBRTC_VIDEO_CODEC_ERROR;
   }
-
+  if(mDecoderStatus != GMPNoErr){
+    mDecoderStatus = GMPNoErr;
+    return WEBRTC_VIDEO_CODEC_ERROR;
+  }
   return WEBRTC_VIDEO_CODEC_OK;
 }
 
 int32_t
 WebrtcGmpVideoDecoder::RegisterDecodeCompleteCallback( webrtc::DecodedImageCallback* aCallback)
 {
   mCallback = aCallback;
 
--- a/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.h
+++ b/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.h
@@ -142,16 +142,17 @@ public:
 
   virtual void DrainComplete() MOZ_OVERRIDE {
   }
 
   virtual void ResetComplete() MOZ_OVERRIDE {
   }
 
   virtual void Error(GMPErr aError) MOZ_OVERRIDE {
+     mDecoderStatus = aError;
   }
 
 private:
   virtual int32_t InitDecode_g(const webrtc::VideoCodec* aCodecSettings,
                                int32_t aNumberOfCores);
 
   virtual int32_t Decode_g(const webrtc::EncodedImage& aInputImage,
                            bool aMissingFrames,
@@ -160,13 +161,14 @@ private:
                            int64_t aRenderTimeMs);
 
   nsCOMPtr<mozIGeckoMediaPluginService> mMPS;
   nsCOMPtr<nsIThread> mGMPThread;
   GMPVideoDecoderProxy* mGMP; // Addref is held for us
   GMPVideoHost* mHost;
   webrtc::DecodedImageCallback* mCallback;
   uint64_t mCachedPluginId;
+  GMPErr mDecoderStatus;
 };
 
 }
 
 #endif