Bug 1043531 - Cache PluginID in WebRTCVideoDecoder/Encoder if plugin Terminates unexpectedly r=jesup

This commit is contained in:
Georg Fritzsche 2014-07-24 20:41:03 +02:00
parent da13db334a
commit 0d3e2a8cbf
2 changed files with 11 additions and 3 deletions

View File

@ -56,6 +56,7 @@ WebrtcGmpVideoEncoder::WebrtcGmpVideoEncoder()
: mGMP(nullptr)
, mHost(nullptr)
, mCallback(nullptr)
, mCachedPluginId(0)
{}
static void
@ -362,6 +363,8 @@ void
WebrtcGmpVideoEncoder::Terminated()
{
LOGD(("GMP Encoder Terminated: %p", (void *)this));
mCachedPluginId = PluginID();
// We need to drop our reference to this
mGMP->Close();
mGMP = nullptr;
@ -437,7 +440,8 @@ WebrtcGmpVideoEncoder::Encoded(GMPVideoEncodedFrame* aEncodedFrame,
WebrtcGmpVideoDecoder::WebrtcGmpVideoDecoder() :
mGMP(nullptr),
mHost(nullptr),
mCallback(nullptr) {}
mCallback(nullptr),
mCachedPluginId(0) {}
static void
Decoder_Close_g(GMPVideoDecoderProxy* aGMP)
@ -645,6 +649,8 @@ void
WebrtcGmpVideoDecoder::Terminated()
{
LOGD(("GMP Decoder Terminated: %p", (void *)this));
mCachedPluginId = PluginID();
mGMP->Close();
mGMP = nullptr;
// Could now notify that it's dead

View File

@ -45,7 +45,7 @@ public:
// Implement VideoEncoder interface.
virtual const uint64_t PluginID() MOZ_OVERRIDE
{
return mGMP ? mGMP->ParentID() : 0;
return mGMP ? mGMP->ParentID() : mCachedPluginId;
}
virtual void Terminated() MOZ_OVERRIDE;
@ -93,6 +93,7 @@ private:
GMPVideoEncoderProxy* mGMP;
GMPVideoHost* mHost;
webrtc::EncodedImageCallback* mCallback;
uint64_t mCachedPluginId;
};
@ -106,7 +107,7 @@ public:
// Implement VideoDecoder interface.
virtual const uint64_t PluginID() MOZ_OVERRIDE
{
return mGMP ? mGMP->ParentID() : 0;
return mGMP ? mGMP->ParentID() : mCachedPluginId;
}
virtual void Terminated();
@ -164,6 +165,7 @@ private:
GMPVideoDecoderProxy* mGMP; // Addref is held for us
GMPVideoHost* mHost;
webrtc::DecodedImageCallback* mCallback;
uint64_t mCachedPluginId;
};
}