mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-24 08:07:30 +09:00
Issue #26 Part 2a: make more EME code conditional.
- Exclude missed MediaKey functions and CDMProxy code. - Exclude EME APIs frm being built (webidl change) - Fix tests in --disable-eme state
This commit is contained in:
parent
51f5cb3576
commit
429f908af1
21 changed files with 126 additions and 21 deletions
|
|
@ -1871,6 +1871,20 @@ nsresult HTMLMediaElement::LoadResource()
|
||||||
// Set the media element's CORS mode only when loading a resource
|
// Set the media element's CORS mode only when loading a resource
|
||||||
mCORSMode = AttrValueToCORSMode(GetParsedAttr(nsGkAtoms::crossorigin));
|
mCORSMode = AttrValueToCORSMode(GetParsedAttr(nsGkAtoms::crossorigin));
|
||||||
|
|
||||||
|
#ifdef MOZ_EME
|
||||||
|
bool isBlob = false;
|
||||||
|
if (mMediaKeys &&
|
||||||
|
Preferences::GetBool("media.eme.mse-only", true) &&
|
||||||
|
// We only want mediaSource URLs, but they are BlobURL, so we have to
|
||||||
|
// check the schema and abort if they are not MediaStream or real Blob.
|
||||||
|
(NS_FAILED(mLoadingSrc->SchemeIs(BLOBURI_SCHEME, &isBlob)) ||
|
||||||
|
!isBlob ||
|
||||||
|
IsMediaStreamURI(mLoadingSrc) ||
|
||||||
|
IsBlobURI(mLoadingSrc))) {
|
||||||
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
HTMLMediaElement* other = LookupMediaElementURITable(mLoadingSrc);
|
HTMLMediaElement* other = LookupMediaElementURITable(mLoadingSrc);
|
||||||
if (other && other->mDecoder) {
|
if (other && other->mDecoder) {
|
||||||
// Clone it.
|
// Clone it.
|
||||||
|
|
@ -4000,7 +4014,6 @@ nsresult HTMLMediaElement::FinishDecoderSetup(MediaDecoder* aDecoder,
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
MediaEventSource<void>* waitingForKeyProducer = mDecoder->WaitingForKeyEvent();
|
MediaEventSource<void>* waitingForKeyProducer = mDecoder->WaitingForKeyEvent();
|
||||||
// Not every decoder will produce waitingForKey events, only add ones that can
|
// Not every decoder will produce waitingForKey events, only add ones that can
|
||||||
|
|
@ -4008,6 +4021,7 @@ nsresult HTMLMediaElement::FinishDecoderSetup(MediaDecoder* aDecoder,
|
||||||
mWaitingForKeyListener = waitingForKeyProducer->Connect(
|
mWaitingForKeyListener = waitingForKeyProducer->Connect(
|
||||||
AbstractThread::MainThread(), this, &HTMLMediaElement::CannotDecryptWaitingForKey);
|
AbstractThread::MainThread(), this, &HTMLMediaElement::CannotDecryptWaitingForKey);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (mChannelLoader) {
|
if (mChannelLoader) {
|
||||||
mChannelLoader->Done();
|
mChannelLoader->Done();
|
||||||
|
|
@ -6476,7 +6490,6 @@ HTMLMediaElement::GetTopLevelPrincipal()
|
||||||
principal = doc->NodePrincipal();
|
principal = doc->NodePrincipal();
|
||||||
return principal.forget();
|
return principal.forget();
|
||||||
}
|
}
|
||||||
#endif //MOZ_EME
|
|
||||||
|
|
||||||
void
|
void
|
||||||
HTMLMediaElement::CannotDecryptWaitingForKey()
|
HTMLMediaElement::CannotDecryptWaitingForKey()
|
||||||
|
|
@ -6495,6 +6508,7 @@ HTMLMediaElement::CannotDecryptWaitingForKey()
|
||||||
UpdateReadyStateInternal();
|
UpdateReadyStateInternal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif //MOZ_EME
|
||||||
|
|
||||||
NS_IMETHODIMP HTMLMediaElement::WindowAudioCaptureChanged(bool aCapture)
|
NS_IMETHODIMP HTMLMediaElement::WindowAudioCaptureChanged(bool aCapture)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,9 @@ class MediaResource;
|
||||||
class ReentrantMonitor;
|
class ReentrantMonitor;
|
||||||
class VideoFrameContainer;
|
class VideoFrameContainer;
|
||||||
class MediaDecoderOwner;
|
class MediaDecoderOwner;
|
||||||
|
#ifdef MOZ_EME
|
||||||
class CDMProxy;
|
class CDMProxy;
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef nsDataHashtable<nsCStringHashKey, nsCString> MetadataTags;
|
typedef nsDataHashtable<nsCStringHashKey, nsCString> MetadataTags;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -387,7 +387,9 @@ MediaDecoder::MediaDecoder(MediaDecoderOwner* aOwner)
|
||||||
, mLogicalPosition(0.0)
|
, mLogicalPosition(0.0)
|
||||||
, mDuration(std::numeric_limits<double>::quiet_NaN())
|
, mDuration(std::numeric_limits<double>::quiet_NaN())
|
||||||
, mResourceCallback(new ResourceCallback())
|
, mResourceCallback(new ResourceCallback())
|
||||||
|
#ifdef MOZ_EME
|
||||||
, mCDMProxyPromise(mCDMProxyPromiseHolder.Ensure(__func__))
|
, mCDMProxyPromise(mCDMProxyPromiseHolder.Ensure(__func__))
|
||||||
|
#endif
|
||||||
, mIgnoreProgressData(false)
|
, mIgnoreProgressData(false)
|
||||||
, mInfiniteStream(false)
|
, mInfiniteStream(false)
|
||||||
, mOwner(aOwner)
|
, mOwner(aOwner)
|
||||||
|
|
@ -472,7 +474,9 @@ MediaDecoder::Shutdown()
|
||||||
|
|
||||||
mResourceCallback->Disconnect();
|
mResourceCallback->Disconnect();
|
||||||
|
|
||||||
|
#ifdef MOZ_EME
|
||||||
mCDMProxyPromiseHolder.RejectIfExists(true, __func__);
|
mCDMProxyPromiseHolder.RejectIfExists(true, __func__);
|
||||||
|
#endif
|
||||||
|
|
||||||
DiscardOngoingSeekIfExists();
|
DiscardOngoingSeekIfExists();
|
||||||
|
|
||||||
|
|
@ -1537,6 +1541,7 @@ MediaDecoder::CanPlayThrough()
|
||||||
return GetStatistics().CanPlayThrough();
|
return GetStatistics().CanPlayThrough();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MOZ_EME
|
||||||
RefPtr<MediaDecoder::CDMProxyPromise>
|
RefPtr<MediaDecoder::CDMProxyPromise>
|
||||||
MediaDecoder::RequestCDMProxy() const
|
MediaDecoder::RequestCDMProxy() const
|
||||||
{
|
{
|
||||||
|
|
@ -1551,6 +1556,7 @@ MediaDecoder::SetCDMProxy(CDMProxy* aProxy)
|
||||||
|
|
||||||
mCDMProxyPromiseHolder.ResolveIfExists(aProxy, __func__);
|
mCDMProxyPromiseHolder.ResolveIfExists(aProxy, __func__);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool
|
bool
|
||||||
MediaDecoder::IsOpusEnabled()
|
MediaDecoder::IsOpusEnabled()
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,11 @@
|
||||||
#define MediaDecoder_h_
|
#define MediaDecoder_h_
|
||||||
|
|
||||||
#include "mozilla/Atomics.h"
|
#include "mozilla/Atomics.h"
|
||||||
|
|
||||||
|
#ifdef MOZ_EME
|
||||||
#include "mozilla/CDMProxy.h"
|
#include "mozilla/CDMProxy.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "mozilla/MozPromise.h"
|
#include "mozilla/MozPromise.h"
|
||||||
#include "mozilla/ReentrantMonitor.h"
|
#include "mozilla/ReentrantMonitor.h"
|
||||||
#include "mozilla/StateMirroring.h"
|
#include "mozilla/StateMirroring.h"
|
||||||
|
|
@ -432,6 +436,7 @@ private:
|
||||||
|
|
||||||
MediaDecoderOwner* GetOwner() const override;
|
MediaDecoderOwner* GetOwner() const override;
|
||||||
|
|
||||||
|
#ifdef MOZ_EME
|
||||||
typedef MozPromise<RefPtr<CDMProxy>, bool /* aIgnored */, /* IsExclusive = */ true> CDMProxyPromise;
|
typedef MozPromise<RefPtr<CDMProxy>, bool /* aIgnored */, /* IsExclusive = */ true> CDMProxyPromise;
|
||||||
|
|
||||||
// Resolved when a CDMProxy is available and the capabilities are known or
|
// Resolved when a CDMProxy is available and the capabilities are known or
|
||||||
|
|
@ -439,6 +444,7 @@ private:
|
||||||
RefPtr<CDMProxyPromise> RequestCDMProxy() const;
|
RefPtr<CDMProxyPromise> RequestCDMProxy() const;
|
||||||
|
|
||||||
void SetCDMProxy(CDMProxy* aProxy);
|
void SetCDMProxy(CDMProxy* aProxy);
|
||||||
|
#endif
|
||||||
|
|
||||||
static bool IsOggEnabled();
|
static bool IsOggEnabled();
|
||||||
static bool IsOpusEnabled();
|
static bool IsOpusEnabled();
|
||||||
|
|
@ -589,8 +595,10 @@ private:
|
||||||
|
|
||||||
RefPtr<ResourceCallback> mResourceCallback;
|
RefPtr<ResourceCallback> mResourceCallback;
|
||||||
|
|
||||||
|
#ifdef MOZ_EME
|
||||||
MozPromiseHolder<CDMProxyPromise> mCDMProxyPromiseHolder;
|
MozPromiseHolder<CDMProxyPromise> mCDMProxyPromiseHolder;
|
||||||
RefPtr<CDMProxyPromise> mCDMProxyPromise;
|
RefPtr<CDMProxyPromise> mCDMProxyPromise;
|
||||||
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// The promise resolving/rejection is queued as a "micro-task" which will be
|
// The promise resolving/rejection is queued as a "micro-task" which will be
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,9 @@
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
|
#ifdef MOZ_EME
|
||||||
class CDMProxy;
|
class CDMProxy;
|
||||||
|
#endif
|
||||||
class MediaDecoderReader;
|
class MediaDecoderReader;
|
||||||
|
|
||||||
struct WaitForDataRejectValue
|
struct WaitForDataRejectValue
|
||||||
|
|
@ -186,7 +188,9 @@ public:
|
||||||
// when to call SetIdle().
|
// when to call SetIdle().
|
||||||
virtual void SetIdle() {}
|
virtual void SetIdle() {}
|
||||||
|
|
||||||
|
#ifdef MOZ_EME
|
||||||
virtual void SetCDMProxy(CDMProxy* aProxy) {}
|
virtual void SetCDMProxy(CDMProxy* aProxy) {}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Tell the reader that the data decoded are not for direct playback, so it
|
// Tell the reader that the data decoded are not for direct playback, so it
|
||||||
// can accept more files, in particular those which have more channels than
|
// can accept more files, in particular those which have more channels than
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,9 @@ public:
|
||||||
return mReader->CanonicalBuffered();
|
return mReader->CanonicalBuffered();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MOZ_EME
|
||||||
void SetCDMProxy(CDMProxy* aProxy) { mReader->SetCDMProxy(aProxy); }
|
void SetCDMProxy(CDMProxy* aProxy) { mReader->SetCDMProxy(aProxy); }
|
||||||
|
#endif
|
||||||
|
|
||||||
void SetVideoBlankDecode(bool aIsBlankDecode);
|
void SetVideoBlankDecode(bool aIsBlankDecode);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1238,7 +1238,12 @@ DecodeMetadataState::OnMetadataRead(MetadataHolder* aMetadata)
|
||||||
// feeding in the CDM, which we need to decode the first frame (and
|
// feeding in the CDM, which we need to decode the first frame (and
|
||||||
// thus get the metadata). We could fix this if we could compute the start
|
// thus get the metadata). We could fix this if we could compute the start
|
||||||
// time by demuxing without necessaring decoding.
|
// time by demuxing without necessaring decoding.
|
||||||
bool waitingForCDM = Info().IsEncrypted() && !mMaster->mCDMProxy;
|
bool waitingForCDM =
|
||||||
|
#ifdef MOZ_EME
|
||||||
|
mMaster->Info().IsEncrypted() && !mMaster->mCDMProxy;
|
||||||
|
#else
|
||||||
|
false;
|
||||||
|
#endif
|
||||||
|
|
||||||
mMaster->mNotifyMetadataBeforeFirstFrame =
|
mMaster->mNotifyMetadataBeforeFirstFrame =
|
||||||
mMaster->mDuration.Ref().isSome() || waitingForCDM;
|
mMaster->mDuration.Ref().isSome() || waitingForCDM;
|
||||||
|
|
@ -1262,7 +1267,9 @@ DormantState::HandlePlayStateChanged(MediaDecoder::PlayState aPlayState)
|
||||||
{
|
{
|
||||||
if (aPlayState == MediaDecoder::PLAY_STATE_PLAYING) {
|
if (aPlayState == MediaDecoder::PLAY_STATE_PLAYING) {
|
||||||
// Exit dormant when the user wants to play.
|
// Exit dormant when the user wants to play.
|
||||||
|
#ifdef MOZ_EME
|
||||||
MOZ_ASSERT(!Info().IsEncrypted() || mMaster->mCDMProxy);
|
MOZ_ASSERT(!Info().IsEncrypted() || mMaster->mCDMProxy);
|
||||||
|
#endif
|
||||||
MOZ_ASSERT(mMaster->mSentFirstFrameLoadedEvent);
|
MOZ_ASSERT(mMaster->mSentFirstFrameLoadedEvent);
|
||||||
SetState<SeekingState>(Move(mPendingSeek), EventVisibility::Suppressed);
|
SetState<SeekingState>(Move(mPendingSeek), EventVisibility::Suppressed);
|
||||||
}
|
}
|
||||||
|
|
@ -1575,7 +1582,9 @@ ShutdownState::Enter()
|
||||||
// dispose of the timer.
|
// dispose of the timer.
|
||||||
master->mVideoDecodeSuspendTimer.Reset();
|
master->mVideoDecodeSuspendTimer.Reset();
|
||||||
|
|
||||||
|
#ifdef MOZ_EME
|
||||||
master->mCDMProxyPromise.DisconnectIfExists();
|
master->mCDMProxyPromise.DisconnectIfExists();
|
||||||
|
#endif
|
||||||
|
|
||||||
if (master->IsPlaying()) {
|
if (master->IsPlaying()) {
|
||||||
master->StopPlayback();
|
master->StopPlayback();
|
||||||
|
|
@ -2129,10 +2138,12 @@ nsresult MediaDecoderStateMachine::Init(MediaDecoder* aDecoder)
|
||||||
|
|
||||||
mMediaSink = CreateMediaSink(mAudioCaptured);
|
mMediaSink = CreateMediaSink(mAudioCaptured);
|
||||||
|
|
||||||
|
#ifdef MOZ_EME
|
||||||
mCDMProxyPromise.Begin(aDecoder->RequestCDMProxy()->Then(
|
mCDMProxyPromise.Begin(aDecoder->RequestCDMProxy()->Then(
|
||||||
OwnerThread(), __func__, this,
|
OwnerThread(), __func__, this,
|
||||||
&MediaDecoderStateMachine::OnCDMProxyReady,
|
&MediaDecoderStateMachine::OnCDMProxyReady,
|
||||||
&MediaDecoderStateMachine::OnCDMProxyNotReady));
|
&MediaDecoderStateMachine::OnCDMProxyNotReady));
|
||||||
|
#endif
|
||||||
|
|
||||||
nsresult rv = mReader->Init();
|
nsresult rv = mReader->Init();
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
@ -3108,6 +3119,7 @@ void MediaDecoderStateMachine::OnMediaSinkAudioError(nsresult aResult)
|
||||||
DecodeError(MediaResult(NS_ERROR_DOM_MEDIA_MEDIASINK_ERR, __func__));
|
DecodeError(MediaResult(NS_ERROR_DOM_MEDIA_MEDIASINK_ERR, __func__));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MOZ_EME
|
||||||
void
|
void
|
||||||
MediaDecoderStateMachine::OnCDMProxyReady(RefPtr<CDMProxy> aProxy)
|
MediaDecoderStateMachine::OnCDMProxyReady(RefPtr<CDMProxy> aProxy)
|
||||||
{
|
{
|
||||||
|
|
@ -3124,6 +3136,7 @@ MediaDecoderStateMachine::OnCDMProxyNotReady()
|
||||||
MOZ_ASSERT(OnTaskQueue());
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
mCDMProxyPromise.Complete();
|
mCDMProxyPromise.Complete();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
MediaDecoderStateMachine::SetAudioCaptured(bool aCaptured)
|
MediaDecoderStateMachine::SetAudioCaptured(bool aCaptured)
|
||||||
|
|
|
||||||
|
|
@ -768,10 +768,12 @@ private:
|
||||||
// Playback will not start when audio is offloading.
|
// Playback will not start when audio is offloading.
|
||||||
bool mAudioOffloading;
|
bool mAudioOffloading;
|
||||||
|
|
||||||
|
#ifdef MOZ_EME
|
||||||
void OnCDMProxyReady(RefPtr<CDMProxy> aProxy);
|
void OnCDMProxyReady(RefPtr<CDMProxy> aProxy);
|
||||||
void OnCDMProxyNotReady();
|
void OnCDMProxyNotReady();
|
||||||
RefPtr<CDMProxy> mCDMProxy;
|
RefPtr<CDMProxy> mCDMProxy;
|
||||||
MozPromiseRequestHolder<MediaDecoder::CDMProxyPromise> mCDMProxyPromise;
|
MozPromiseRequestHolder<MediaDecoder::CDMProxyPromise> mCDMProxyPromise;
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// The buffered range. Mirrored from the decoder thread.
|
// The buffered range. Mirrored from the decoder thread.
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,10 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
#ifdef MOZ_EME
|
||||||
#include "mozilla/CDMProxy.h"
|
#include "mozilla/CDMProxy.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "mozilla/ClearOnShutdown.h"
|
#include "mozilla/ClearOnShutdown.h"
|
||||||
#include "mozilla/dom/HTMLMediaElement.h"
|
#include "mozilla/dom/HTMLMediaElement.h"
|
||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
|
|
@ -611,7 +614,6 @@ private:
|
||||||
nsTArray<uint8_t> mInitData;
|
nsTArray<uint8_t> mInitData;
|
||||||
nsString mInitDataType;
|
nsString mInitDataType;
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MediaFormatReader::SetCDMProxy(CDMProxy* aProxy)
|
MediaFormatReader::SetCDMProxy(CDMProxy* aProxy)
|
||||||
|
|
@ -624,6 +626,7 @@ MediaFormatReader::SetCDMProxy(CDMProxy* aProxy)
|
||||||
});
|
});
|
||||||
OwnerThread()->Dispatch(r.forget());
|
OwnerThread()->Dispatch(r.forget());
|
||||||
}
|
}
|
||||||
|
#endif // MOZ_EME
|
||||||
|
|
||||||
bool
|
bool
|
||||||
MediaFormatReader::IsWaitingOnCDMResource() {
|
MediaFormatReader::IsWaitingOnCDMResource() {
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,9 @@
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
|
#ifdef MOZ_EME
|
||||||
class CDMProxy;
|
class CDMProxy;
|
||||||
|
#endif
|
||||||
|
|
||||||
class MediaFormatReader final : public MediaDecoderReader
|
class MediaFormatReader final : public MediaDecoderReader
|
||||||
{
|
{
|
||||||
|
|
@ -91,7 +93,9 @@ public:
|
||||||
return mTrackDemuxersMayBlock;
|
return mTrackDemuxersMayBlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MOZ_EME
|
||||||
void SetCDMProxy(CDMProxy* aProxy) override;
|
void SetCDMProxy(CDMProxy* aProxy) override;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Returns a string describing the state of the decoder data.
|
// Returns a string describing the state of the decoder data.
|
||||||
// Used for debugging purposes.
|
// Used for debugging purposes.
|
||||||
|
|
@ -584,7 +588,9 @@ private:
|
||||||
RefPtr<VideoFrameContainer> mVideoFrameContainer;
|
RefPtr<VideoFrameContainer> mVideoFrameContainer;
|
||||||
layers::ImageContainer* GetImageContainer();
|
layers::ImageContainer* GetImageContainer();
|
||||||
|
|
||||||
|
#ifdef MOZ_EME
|
||||||
RefPtr<CDMProxy> mCDMProxy;
|
RefPtr<CDMProxy> mCDMProxy;
|
||||||
|
#endif
|
||||||
|
|
||||||
RefPtr<GMPCrashHelper> mCrashHelper;
|
RefPtr<GMPCrashHelper> mCrashHelper;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,9 @@
|
||||||
#include "MP4Demuxer.h"
|
#include "MP4Demuxer.h"
|
||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
#include "nsCharSeparatedTokenizer.h"
|
#include "nsCharSeparatedTokenizer.h"
|
||||||
|
#ifdef MOZ_EME
|
||||||
#include "mozilla/CDMProxy.h"
|
#include "mozilla/CDMProxy.h"
|
||||||
|
#endif
|
||||||
#include "mozilla/Logging.h"
|
#include "mozilla/Logging.h"
|
||||||
#include "mozilla/SharedThreadPool.h"
|
#include "mozilla/SharedThreadPool.h"
|
||||||
#include "nsMimeTypes.h"
|
#include "nsMimeTypes.h"
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,10 @@ using mozilla::ipc::GeckoChildProcessHost;
|
||||||
#include "WMFDecoderModule.h"
|
#include "WMFDecoderModule.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef MOZ_EME
|
||||||
#include "mozilla/dom/WidevineCDMManifestBinding.h"
|
#include "mozilla/dom/WidevineCDMManifestBinding.h"
|
||||||
#include "widevine-adapter/WidevineAdapter.h"
|
#include "widevine-adapter/WidevineAdapter.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
|
|
@ -654,6 +656,7 @@ GMPParent::ReadGMPMetaData()
|
||||||
return ReadGMPInfoFile(infoFile);
|
return ReadGMPInfoFile(infoFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MOZ_EME
|
||||||
// Maybe this is the Widevine adapted plugin?
|
// Maybe this is the Widevine adapted plugin?
|
||||||
nsCOMPtr<nsIFile> manifestFile;
|
nsCOMPtr<nsIFile> manifestFile;
|
||||||
rv = mDirectory->Clone(getter_AddRefs(manifestFile));
|
rv = mDirectory->Clone(getter_AddRefs(manifestFile));
|
||||||
|
|
@ -662,6 +665,9 @@ GMPParent::ReadGMPMetaData()
|
||||||
}
|
}
|
||||||
manifestFile->AppendRelativePath(NS_LITERAL_STRING("manifest.json"));
|
manifestFile->AppendRelativePath(NS_LITERAL_STRING("manifest.json"));
|
||||||
return ReadChromiumManifestFile(manifestFile);
|
return ReadChromiumManifestFile(manifestFile);
|
||||||
|
#else
|
||||||
|
return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<GenericPromise>
|
RefPtr<GenericPromise>
|
||||||
|
|
@ -767,6 +773,7 @@ GMPParent::ParseChromiumManifest(nsString aJSON)
|
||||||
LOGD("%s: for '%s'", __FUNCTION__, NS_LossyConvertUTF16toASCII(aJSON).get());
|
LOGD("%s: for '%s'", __FUNCTION__, NS_LossyConvertUTF16toASCII(aJSON).get());
|
||||||
|
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
#ifdef MOZ_EME
|
||||||
mozilla::dom::WidevineCDMManifest m;
|
mozilla::dom::WidevineCDMManifest m;
|
||||||
if (!m.Init(aJSON)) {
|
if (!m.Init(aJSON)) {
|
||||||
return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
|
return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
|
||||||
|
|
@ -801,6 +808,10 @@ GMPParent::ParseChromiumManifest(nsString aJSON)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return GenericPromise::CreateAndResolve(true, __func__);
|
return GenericPromise::CreateAndResolve(true, __func__);
|
||||||
|
#else // !MOZ_EME
|
||||||
|
MOZ_ASSERT_UNREACHABLE("don't call me if EME isn't enabled");
|
||||||
|
return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
|
||||||
|
#endif // !MOZ_EME
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,6 @@ EXPORTS += [
|
||||||
'GMPAudioDecoderProxy.h',
|
'GMPAudioDecoderProxy.h',
|
||||||
'GMPAudioHost.h',
|
'GMPAudioHost.h',
|
||||||
'GMPCallbackBase.h',
|
'GMPCallbackBase.h',
|
||||||
'GMPCDMCallbackProxy.h',
|
|
||||||
'GMPCDMProxy.h',
|
|
||||||
'GMPChild.h',
|
'GMPChild.h',
|
||||||
'GMPContentChild.h',
|
'GMPContentChild.h',
|
||||||
'GMPContentParent.h',
|
'GMPContentParent.h',
|
||||||
|
|
@ -73,6 +71,12 @@ EXPORTS += [
|
||||||
'GMPVideoPlaneImpl.h',
|
'GMPVideoPlaneImpl.h',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if CONFIG['MOZ_EME']:
|
||||||
|
EXPORTS += [
|
||||||
|
'GMPCDMCallbackProxy.h',
|
||||||
|
'GMPCDMProxy.h',
|
||||||
|
]
|
||||||
|
|
||||||
# We link GMPLoader into xul on B2G/Fennec as its code does not need to be
|
# We link GMPLoader into xul on B2G/Fennec as its code does not need to be
|
||||||
# covered by a DRM vendor's voucher.
|
# covered by a DRM vendor's voucher.
|
||||||
if CONFIG['OS_TARGET'] == 'Android':
|
if CONFIG['OS_TARGET'] == 'Android':
|
||||||
|
|
@ -87,8 +91,6 @@ UNIFIED_SOURCES += [
|
||||||
'GMPAudioDecoderChild.cpp',
|
'GMPAudioDecoderChild.cpp',
|
||||||
'GMPAudioDecoderParent.cpp',
|
'GMPAudioDecoderParent.cpp',
|
||||||
'GMPAudioHost.cpp',
|
'GMPAudioHost.cpp',
|
||||||
'GMPCDMCallbackProxy.cpp',
|
|
||||||
'GMPCDMProxy.cpp',
|
|
||||||
'GMPChild.cpp',
|
'GMPChild.cpp',
|
||||||
'GMPContentChild.cpp',
|
'GMPContentChild.cpp',
|
||||||
'GMPContentParent.cpp',
|
'GMPContentParent.cpp',
|
||||||
|
|
@ -120,6 +122,12 @@ UNIFIED_SOURCES += [
|
||||||
'GMPVideoPlaneImpl.cpp',
|
'GMPVideoPlaneImpl.cpp',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if CONFIG['MOZ_EME']:
|
||||||
|
UNIFIED_SOURCES += [
|
||||||
|
'GMPCDMCallbackProxy.cpp',
|
||||||
|
'GMPCDMProxy.cpp',
|
||||||
|
]
|
||||||
|
|
||||||
DIRS += [
|
DIRS += [
|
||||||
'rlz',
|
'rlz',
|
||||||
'widevine-adapter',
|
'widevine-adapter',
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,10 @@ public:
|
||||||
void DownloadProgressed() override {}
|
void DownloadProgressed() override {}
|
||||||
void UpdateReadyState() override {}
|
void UpdateReadyState() override {}
|
||||||
void FirstFrameLoaded() override {}
|
void FirstFrameLoaded() override {}
|
||||||
|
#ifdef MOZ_EME
|
||||||
void DispatchEncrypted(const nsTArray<uint8_t>& aInitData,
|
void DispatchEncrypted(const nsTArray<uint8_t>& aInitData,
|
||||||
const nsAString& aInitDataType) override {}
|
const nsAString& aInitDataType) override {}
|
||||||
|
#endif
|
||||||
bool IsActive() const override { return true; }
|
bool IsActive() const override { return true; }
|
||||||
bool IsHidden() const override { return false; }
|
bool IsHidden() const override { return false; }
|
||||||
void DownloadSuspended() override {}
|
void DownloadSuspended() override {}
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,11 @@ UNIFIED_SOURCES += [
|
||||||
'TestWebMBuffered.cpp',
|
'TestWebMBuffered.cpp',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if CONFIG['MOZ_EME']:
|
||||||
|
UNIFIED_SOURCES += [
|
||||||
|
'TestEME.cpp',
|
||||||
|
]
|
||||||
|
|
||||||
if CONFIG['MOZ_WEBM_ENCODER']:
|
if CONFIG['MOZ_WEBM_ENCODER']:
|
||||||
UNIFIED_SOURCES += [
|
UNIFIED_SOURCES += [
|
||||||
'TestVideoTrackEncoder.cpp',
|
'TestVideoTrackEncoder.cpp',
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ private:
|
||||||
nsTArray<uint8_t> mInitData;
|
nsTArray<uint8_t> mInitData;
|
||||||
nsString mInitDataType;
|
nsString mInitDataType;
|
||||||
};
|
};
|
||||||
#endif
|
#endif // MOZ_EME
|
||||||
|
|
||||||
TrackBuffersManager::TrackBuffersManager(MediaSourceDecoder* aParentDecoder,
|
TrackBuffersManager::TrackBuffersManager(MediaSourceDecoder* aParentDecoder,
|
||||||
const nsACString& aType)
|
const nsACString& aType)
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ with Files('GetUserMedia*'):
|
||||||
BUG_COMPONENT = component_av
|
BUG_COMPONENT = component_av
|
||||||
|
|
||||||
DIRS += [
|
DIRS += [
|
||||||
'eme',
|
|
||||||
'encoder',
|
'encoder',
|
||||||
'flac',
|
'flac',
|
||||||
'gmp',
|
'gmp',
|
||||||
|
|
@ -49,6 +48,9 @@ if CONFIG['MOZ_FMP4']:
|
||||||
if CONFIG['MOZ_WEBRTC']:
|
if CONFIG['MOZ_WEBRTC']:
|
||||||
DIRS += ['bridge']
|
DIRS += ['bridge']
|
||||||
|
|
||||||
|
if CONFIG['MOZ_EME']:
|
||||||
|
DIRS += ['eme']
|
||||||
|
|
||||||
TEST_DIRS += [
|
TEST_DIRS += [
|
||||||
'gtest',
|
'gtest',
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@
|
||||||
#endif
|
#endif
|
||||||
#include "GMPDecoderModule.h"
|
#include "GMPDecoderModule.h"
|
||||||
|
|
||||||
#include "mozilla/CDMProxy.h"
|
|
||||||
#include "mozilla/ClearOnShutdown.h"
|
#include "mozilla/ClearOnShutdown.h"
|
||||||
#include "mozilla/SharedThreadPool.h"
|
#include "mozilla/SharedThreadPool.h"
|
||||||
#include "mozilla/StaticPtr.h"
|
#include "mozilla/StaticPtr.h"
|
||||||
|
|
@ -37,7 +36,11 @@
|
||||||
#include "H264Converter.h"
|
#include "H264Converter.h"
|
||||||
|
|
||||||
#include "AgnosticDecoderModule.h"
|
#include "AgnosticDecoderModule.h"
|
||||||
|
|
||||||
|
#ifdef MOZ_EME
|
||||||
|
#include "mozilla/CDMProxy.h"
|
||||||
#include "EMEDecoderModule.h"
|
#include "EMEDecoderModule.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "DecoderDoctorDiagnostics.h"
|
#include "DecoderDoctorDiagnostics.h"
|
||||||
|
|
||||||
|
|
@ -463,11 +466,13 @@ PDMFactory::GetDecoder(const TrackInfo& aTrackInfo,
|
||||||
return pdm.forget();
|
return pdm.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MOZ_EME
|
||||||
void
|
void
|
||||||
PDMFactory::SetCDMProxy(CDMProxy* aProxy)
|
PDMFactory::SetCDMProxy(CDMProxy* aProxy)
|
||||||
{
|
{
|
||||||
RefPtr<PDMFactory> m = new PDMFactory();
|
RefPtr<PDMFactory> m = new PDMFactory();
|
||||||
mEMEPDM = new EMEDecoderModule(aProxy, m);
|
mEMEPDM = new EMEDecoderModule(aProxy, m);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,9 @@
|
||||||
#include "mozilla/Function.h"
|
#include "mozilla/Function.h"
|
||||||
#include "mozilla/StaticMutex.h"
|
#include "mozilla/StaticMutex.h"
|
||||||
|
|
||||||
|
#ifdef MOZ_EME
|
||||||
class CDMProxy;
|
class CDMProxy;
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
|
|
@ -38,12 +40,14 @@ public:
|
||||||
bool Supports(const TrackInfo& aTrackInfo,
|
bool Supports(const TrackInfo& aTrackInfo,
|
||||||
DecoderDoctorDiagnostics* aDiagnostics) const;
|
DecoderDoctorDiagnostics* aDiagnostics) const;
|
||||||
|
|
||||||
|
#ifdef MOZ_EME
|
||||||
// Creates a PlatformDecoderModule that uses a CDMProxy to decrypt or
|
// Creates a PlatformDecoderModule that uses a CDMProxy to decrypt or
|
||||||
// decrypt-and-decode EME encrypted content. If the CDM only decrypts and
|
// decrypt-and-decode EME encrypted content. If the CDM only decrypts and
|
||||||
// does not decode, we create a PDM and use that to create MediaDataDecoders
|
// does not decode, we create a PDM and use that to create MediaDataDecoders
|
||||||
// that we use on on aTaskQueue to decode the decrypted stream.
|
// that we use on on aTaskQueue to decode the decrypted stream.
|
||||||
// This is called on the decode task queue.
|
// This is called on the decode task queue.
|
||||||
void SetCDMProxy(CDMProxy* aProxy);
|
void SetCDMProxy(CDMProxy* aProxy);
|
||||||
|
#endif
|
||||||
|
|
||||||
static constexpr int kYUV400 = 0;
|
static constexpr int kYUV400 = 0;
|
||||||
static constexpr int kYUV420 = 1;
|
static constexpr int kYUV420 = 1;
|
||||||
|
|
|
||||||
|
|
@ -30,11 +30,13 @@ UNIFIED_SOURCES += [
|
||||||
]
|
]
|
||||||
|
|
||||||
DIRS += [
|
DIRS += [
|
||||||
'agnostic/eme',
|
|
||||||
'agnostic/gmp',
|
'agnostic/gmp',
|
||||||
'omx'
|
'omx'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if CONFIG['MOZ_EME']:
|
||||||
|
DIRS += ['agnostic/eme']
|
||||||
|
|
||||||
if CONFIG['MOZ_WMF']:
|
if CONFIG['MOZ_WMF']:
|
||||||
DIRS += [ 'wmf' ];
|
DIRS += [ 'wmf' ];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -285,15 +285,7 @@ WEBIDL_FILES = [
|
||||||
'MediaDeviceInfo.webidl',
|
'MediaDeviceInfo.webidl',
|
||||||
'MediaDevices.webidl',
|
'MediaDevices.webidl',
|
||||||
'MediaElementAudioSourceNode.webidl',
|
'MediaElementAudioSourceNode.webidl',
|
||||||
'MediaEncryptedEvent.webidl',
|
|
||||||
'MediaError.webidl',
|
'MediaError.webidl',
|
||||||
'MediaKeyError.webidl',
|
|
||||||
'MediaKeyMessageEvent.webidl',
|
|
||||||
'MediaKeys.webidl',
|
|
||||||
'MediaKeySession.webidl',
|
|
||||||
'MediaKeysRequestStatus.webidl',
|
|
||||||
'MediaKeyStatusMap.webidl',
|
|
||||||
'MediaKeySystemAccess.webidl',
|
|
||||||
'MediaList.webidl',
|
'MediaList.webidl',
|
||||||
'MediaQueryList.webidl',
|
'MediaQueryList.webidl',
|
||||||
'MediaRecorder.webidl',
|
'MediaRecorder.webidl',
|
||||||
|
|
@ -565,7 +557,6 @@ WEBIDL_FILES = [
|
||||||
'WebKitCSSMatrix.webidl',
|
'WebKitCSSMatrix.webidl',
|
||||||
'WebSocket.webidl',
|
'WebSocket.webidl',
|
||||||
'WheelEvent.webidl',
|
'WheelEvent.webidl',
|
||||||
'WidevineCDMManifest.webidl',
|
|
||||||
'WifiOptions.webidl',
|
'WifiOptions.webidl',
|
||||||
'WindowOrWorkerGlobalScope.webidl',
|
'WindowOrWorkerGlobalScope.webidl',
|
||||||
'WindowRoot.webidl',
|
'WindowRoot.webidl',
|
||||||
|
|
@ -592,6 +583,19 @@ WEBIDL_FILES = [
|
||||||
'XULElement.webidl',
|
'XULElement.webidl',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if CONFIG['MOZ_EME']:
|
||||||
|
WEBIDL_FILES += [
|
||||||
|
'MediaEncryptedEvent.webidl',
|
||||||
|
'MediaKeyError.webidl',
|
||||||
|
'MediaKeyMessageEvent.webidl',
|
||||||
|
'MediaKeys.webidl',
|
||||||
|
'MediaKeySession.webidl',
|
||||||
|
'MediaKeysRequestStatus.webidl',
|
||||||
|
'MediaKeyStatusMap.webidl',
|
||||||
|
'MediaKeySystemAccess.webidl',
|
||||||
|
'WidevineCDMManifest.webidl',
|
||||||
|
]
|
||||||
|
|
||||||
if CONFIG['MOZ_WEBEXTENSIONS']:
|
if CONFIG['MOZ_WEBEXTENSIONS']:
|
||||||
WEBIDL_FILES += ['AddonManager.webidl']
|
WEBIDL_FILES += ['AddonManager.webidl']
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue