Bug 1816060 - put cdm related files and functions under the config MOZ_MF_CDM. r=media-playback-reviewers,jolin

Differential Revision: https://phabricator.services.mozilla.com/D169495
This commit is contained in:
alwu 2023-02-11 01:48:59 +00:00
Родитель 38b0fef2bc
Коммит db4794e880
5 изменённых файлов: 33 добавлений и 9 удалений

Просмотреть файл

@ -8,7 +8,10 @@
#include <intsafe.h>
#include <mfapi.h>
#include "MFContentProtectionManager.h"
#ifdef MOZ_WMF_CDM
# include "MFContentProtectionManager.h"
#endif
#include "MFMediaEngineExtension.h"
#include "MFMediaEngineVideoStream.h"
#include "MFMediaEngineUtils.h"
@ -167,9 +170,11 @@ void MFMediaEngineParent::CreateMediaEngine() {
isLowLatency ? MF_MEDIA_ENGINE_REAL_TIME_MODE : MF_MEDIA_ENGINE_DEFAULT,
creationAttributes.Get(), &mMediaEngine));
#ifdef MOZ_WMF_CDM
// TODO : set the content protection manager to IMFMediaEngineProtectedContent
RETURN_VOID_IF_FAILED(MakeAndInitialize<MFContentProtectionManager>(
&mContentProtectionManager));
#endif
LOG("Created media engine successfully");
mIsCreatedMediaEngine = true;
@ -633,6 +638,7 @@ void MFMediaEngineParent::UpdateStatisticsData() {
}
}
#ifdef MOZ_WMF_CDM
void MFMediaEngineParent::SetCDMProxy(MFCDMProxy* aCDMProxy) {
AssertOnManagerThread();
MOZ_ASSERT(mContentProtectionManager);
@ -640,6 +646,7 @@ void MFMediaEngineParent::SetCDMProxy(MFCDMProxy* aCDMProxy) {
RETURN_VOID_IF_FAILED(mContentProtectionManager->SetCDMProxy(aCDMProxy));
mMediaSource->SetCDMProxy(aCDMProxy);
}
#endif
#undef LOG
#undef RETURN_IF_FAILED

Просмотреть файл

@ -62,7 +62,9 @@ class MFMediaEngineParent final : public PMFMediaEngineParent {
mozilla::ipc::IPCResult RecvNotifyEndOfStream(TrackInfo::TrackType aType);
mozilla::ipc::IPCResult RecvShutdown();
#ifdef MOZ_WMF_CDM
void SetCDMProxy(MFCDMProxy* aCDMProxy);
#endif
void Destroy();
@ -106,7 +108,9 @@ class MFMediaEngineParent final : public PMFMediaEngineParent {
Microsoft::WRL::ComPtr<MFMediaEngineNotify> mMediaEngineNotify;
Microsoft::WRL::ComPtr<MFMediaEngineExtension> mMediaEngineExtension;
Microsoft::WRL::ComPtr<MFMediaSource> mMediaSource;
#ifdef MOZ_WMF_CDM
Microsoft::WRL::ComPtr<MFContentProtectionManager> mContentProtectionManager;
#endif
MediaEventListener mMediaEngineEventListener;
MediaEventListener mRequestSampleListener;

Просмотреть файл

@ -525,7 +525,7 @@ HRESULT MFMediaSource::GetInputTrustAuthority(DWORD aStreamId, REFIID aRiid,
return MF_E_SHUTDOWN;
}
}
#ifdef MOZ_WMF_CDM
if (!mCDMProxy) {
return MF_E_NOT_PROTECTED;
}
@ -542,6 +542,7 @@ HRESULT MFMediaSource::GetInputTrustAuthority(DWORD aStreamId, REFIID aRiid,
RETURN_IF_FAILED(
mCDMProxy->GetInputTrustAuthority(aStreamId, nullptr, 0, aRiid, aITAOut));
#endif
return S_OK;
}
@ -571,12 +572,14 @@ MFMediaEngineStream* MFMediaSource::GetStreamByIndentifier(
return nullptr;
}
#ifdef MOZ_WMF_CDM
void MFMediaSource::SetCDMProxy(MFCDMProxy* aCDMProxy) {
// TODO : add threading assertion, not sure what thread it would be running on
// now.
mCDMProxy = aCDMProxy;
// TODO : ask cdm proxy to refresh trusted input
}
#endif
void MFMediaSource::AssertOnManagerThread() const {
MOZ_ASSERT(mManagerThread->IsOnCurrentThread());

Просмотреть файл

@ -95,7 +95,9 @@ class MFMediaSource : public Microsoft::WRL::RuntimeClass<
MFMediaEngineStream* GetStreamByIndentifier(DWORD aStreamId) const;
#ifdef MOZ_WMF_CDM
void SetCDMProxy(MFCDMProxy* aCDMProxy);
#endif
TaskQueue* GetTaskQueue() const { return mTaskQueue; }
@ -174,7 +176,9 @@ class MFMediaSource : public Microsoft::WRL::RuntimeClass<
// Modify and access on MF thread pool.
float mPlaybackRate = 0.0f;
#ifdef MOZ_WMF_CDM
RefPtr<MFCDMProxy> mCDMProxy;
#endif
};
} // namespace mozilla

Просмотреть файл

@ -20,10 +20,6 @@ EXPORTS += [
if CONFIG["MOZ_WMF_MEDIA_ENGINE"]:
EXPORTS += [
"MFCDMExtra.h",
"MFCDMProxy.h",
"MFCDMSession.h",
"MFContentProtectionManager.h",
"MFMediaEngineAudioStream.h",
"MFMediaEngineDecoderModule.h",
"MFMediaEngineExtra.h",
@ -32,9 +28,6 @@ if CONFIG["MOZ_WMF_MEDIA_ENGINE"]:
"MFMediaSource.h",
]
UNIFIED_SOURCES += [
"MFCDMProxy.cpp",
"MFCDMSession.cpp",
"MFContentProtectionManager.cpp",
"MFMediaEngineAudioStream.cpp",
"MFMediaEngineDecoderModule.cpp",
"MFMediaEngineExtension.cpp",
@ -44,6 +37,19 @@ if CONFIG["MOZ_WMF_MEDIA_ENGINE"]:
"MFMediaSource.cpp",
]
if CONFIG["MOZ_WMF_CDM"]:
EXPORTS += [
"MFCDMExtra.h",
"MFCDMProxy.h",
"MFCDMSession.h",
"MFContentProtectionManager.h",
]
UNIFIED_SOURCES += [
"MFCDMProxy.cpp",
"MFCDMSession.cpp",
"MFContentProtectionManager.cpp",
]
UNIFIED_SOURCES += [
"DXVA2Manager.cpp",
"MFTDecoder.cpp",