From def92d1b8e9d373e2f6f27c366d578d97d8960c6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 15 May 2024 05:34:50 +0200 Subject: Merging upstream version 126.0. Signed-off-by: Daniel Baumann --- dom/media/ipc/MFMediaEngineChild.cpp | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) (limited to 'dom/media/ipc/MFMediaEngineChild.cpp') diff --git a/dom/media/ipc/MFMediaEngineChild.cpp b/dom/media/ipc/MFMediaEngineChild.cpp index 02013056d5..cc32d15ea4 100644 --- a/dom/media/ipc/MFMediaEngineChild.cpp +++ b/dom/media/ipc/MFMediaEngineChild.cpp @@ -47,20 +47,22 @@ MFMediaEngineChild::MFMediaEngineChild(MFMediaEngineWrapper* aOwner, } RefPtr MFMediaEngineChild::Init( - bool aShouldPreload) { + const MediaInfo& aInfo, bool aShouldPreload) { if (!mManagerThread) { return GenericNonExclusivePromise::CreateAndReject(NS_ERROR_FAILURE, __func__); } - CLOG("Init"); + CLOG("Init, hasAudio=%d, hasVideo=%d, encrypted=%d", aInfo.HasAudio(), + aInfo.HasVideo(), aInfo.IsEncrypted()); + MOZ_ASSERT(mMediaEngineId == 0); RefPtr self = this; RemoteDecoderManagerChild::LaunchUtilityProcessIfNeeded( RemoteDecodeIn::UtilityProcess_MFMediaEngineCDM) ->Then( mManagerThread, __func__, - [self, this, aShouldPreload](bool) { + [self, this, aShouldPreload, info = aInfo](bool) { RefPtr manager = RemoteDecoderManagerChild::GetSingleton( RemoteDecodeIn::UtilityProcess_MFMediaEngineCDM); @@ -72,8 +74,13 @@ RefPtr MFMediaEngineChild::Init( mIPDLSelfRef = this; Unused << manager->SendPMFMediaEngineConstructor(this); - MediaEngineInfoIPDL info(aShouldPreload); - SendInitMediaEngine(info) + + MediaInfoIPDL mediaInfo( + info.HasAudio() ? Some(info.mAudio) : Nothing(), + info.HasVideo() ? Some(info.mVideo) : Nothing()); + + MediaEngineInfoIPDL initInfo(mediaInfo, aShouldPreload); + SendInitMediaEngine(initInfo) ->Then( mManagerThread, __func__, [self, this](uint64_t aId) { @@ -256,9 +263,9 @@ MFMediaEngineWrapper::MFMediaEngineWrapper(ExternalEngineStateMachine* aOwner, mCurrentTimeInSecond(0.0) {} RefPtr MFMediaEngineWrapper::Init( - bool aShouldPreload) { + const MediaInfo& aInfo, bool aShouldPreload) { WLOG("Init"); - return mEngine->Init(aShouldPreload); + return mEngine->Init(aInfo, aShouldPreload); } MFMediaEngineWrapper::~MFMediaEngineWrapper() { mEngine->OwnerDestroyed(); } @@ -335,18 +342,6 @@ void MFMediaEngineWrapper::NotifyEndOfStream(TrackInfo::TrackType aType) { [engine = mEngine, aType] { engine->SendNotifyEndOfStream(aType); })); } -void MFMediaEngineWrapper::SetMediaInfo(const MediaInfo& aInfo) { - WLOG("SetMediaInfo, hasAudio=%d, hasVideo=%d, encrypted=%d", aInfo.HasAudio(), - aInfo.HasVideo(), aInfo.IsEncrypted()); - MOZ_ASSERT(IsInited()); - Unused << ManagerThread()->Dispatch(NS_NewRunnableFunction( - "MFMediaEngineWrapper::SetMediaInfo", [engine = mEngine, aInfo] { - MediaInfoIPDL info(aInfo.HasAudio() ? Some(aInfo.mAudio) : Nothing(), - aInfo.HasVideo() ? Some(aInfo.mVideo) : Nothing()); - engine->SendNotifyMediaInfo(info); - })); -} - bool MFMediaEngineWrapper::SetCDMProxy(CDMProxy* aProxy) { #ifdef MOZ_WMF_CDM WMFCDMProxy* proxy = aProxy->AsWMFCDMProxy(); -- cgit v1.2.3