Bug 1281632 - P3: Move EMEAudioDecoder/EMEVideoDecoder ctors. r=gerald
MozReview-Commit-ID: 1Q90g3ehkXf
--- a/dom/media/platforms/agnostic/eme/EMEAudioDecoder.cpp
+++ b/dom/media/platforms/agnostic/eme/EMEAudioDecoder.cpp
@@ -16,16 +16,24 @@ EMEAudioCallbackAdapter::Error(GMPErr aE
// The GMP failed to decrypt a frame due to not having a key. This can
// happen if a key expires or a session is closed during playback.
NS_WARNING("GMP failed to decrypt due to lack of key");
return;
}
AudioCallbackAdapter::Error(aErr);
}
+EMEAudioDecoder::EMEAudioDecoder(CDMProxy* aProxy,
+ const AudioInfo& aConfig,
+ TaskQueue* aTaskQueue,
+ MediaDataDecoderCallbackProxy* aCallback)
+ : GMPAudioDecoder(aConfig, aTaskQueue, aCallback, new EMEAudioCallbackAdapter(aCallback))
+ , mProxy(aProxy)
+{}
+
void
EMEAudioDecoder::InitTags(nsTArray<nsCString>& aTags)
{
aTags.AppendElement(NS_LITERAL_CSTRING("aac"));
aTags.AppendElement(NS_ConvertUTF16toUTF8(mProxy->KeySystem()));
}
nsCString
--- a/dom/media/platforms/agnostic/eme/EMEAudioDecoder.h
+++ b/dom/media/platforms/agnostic/eme/EMEAudioDecoder.h
@@ -21,21 +21,17 @@ public:
void Error(GMPErr aErr) override;
};
class EMEAudioDecoder : public GMPAudioDecoder {
public:
EMEAudioDecoder(CDMProxy* aProxy,
const AudioInfo& aConfig,
TaskQueue* aTaskQueue,
- MediaDataDecoderCallbackProxy* aCallback)
- : GMPAudioDecoder(aConfig, aTaskQueue, aCallback, new EMEAudioCallbackAdapter(aCallback))
- , mProxy(aProxy)
- {
- }
+ MediaDataDecoderCallbackProxy* aCallback);
private:
void InitTags(nsTArray<nsCString>& aTags) override;
nsCString GetNodeId() override;
RefPtr<CDMProxy> mProxy;
};
--- a/dom/media/platforms/agnostic/eme/EMEVideoDecoder.cpp
+++ b/dom/media/platforms/agnostic/eme/EMEVideoDecoder.cpp
@@ -18,16 +18,34 @@ EMEVideoCallbackAdapter::Error(GMPErr aE
// The GMP failed to decrypt a frame due to not having a key. This can
// happen if a key expires or a session is closed during playback.
NS_WARNING("GMP failed to decrypt due to lack of key");
return;
}
VideoCallbackAdapter::Error(aErr);
}
+EMEVideoDecoder::EMEVideoDecoder(CDMProxy* aProxy,
+ const VideoInfo& aConfig,
+ layers::LayersBackend aLayersBackend,
+ layers::ImageContainer* aImageContainer,
+ TaskQueue* aTaskQueue,
+ MediaDataDecoderCallbackProxy* aCallback)
+ : GMPVideoDecoder(aConfig,
+ aLayersBackend,
+ aImageContainer,
+ aTaskQueue,
+ aCallback,
+ new EMEVideoCallbackAdapter(aCallback,
+ VideoInfo(aConfig.mDisplay.width,
+ aConfig.mDisplay.height),
+ aImageContainer))
+ , mProxy(aProxy)
+{}
+
void
EMEVideoDecoder::InitTags(nsTArray<nsCString>& aTags)
{
aTags.AppendElement(NS_LITERAL_CSTRING("h264"));
aTags.AppendElement(NS_ConvertUTF16toUTF8(mProxy->KeySystem()));
}
nsCString
--- a/dom/media/platforms/agnostic/eme/EMEVideoDecoder.h
+++ b/dom/media/platforms/agnostic/eme/EMEVideoDecoder.h
@@ -28,29 +28,17 @@ public:
class EMEVideoDecoder : public GMPVideoDecoder {
public:
EMEVideoDecoder(CDMProxy* aProxy,
const VideoInfo& aConfig,
layers::LayersBackend aLayersBackend,
layers::ImageContainer* aImageContainer,
TaskQueue* aTaskQueue,
- MediaDataDecoderCallbackProxy* aCallback)
- : GMPVideoDecoder(aConfig,
- aLayersBackend,
- aImageContainer,
- aTaskQueue,
- aCallback,
- new EMEVideoCallbackAdapter(aCallback,
- VideoInfo(aConfig.mDisplay.width,
- aConfig.mDisplay.height),
- aImageContainer))
- , mProxy(aProxy)
- {
- }
+ MediaDataDecoderCallbackProxy* aCallback);
private:
void InitTags(nsTArray<nsCString>& aTags) override;
nsCString GetNodeId() override;
GMPUniquePtr<GMPVideoEncodedFrame> CreateFrame(MediaRawData* aSample) override;
RefPtr<CDMProxy> mProxy;
};