зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 4 changesets (bug 1821803) for build bustages on MFMediaEngineParent.cpp. CLOSED TREE
Backed out changeset 75db8a0db46f (bug 1821803) Backed out changeset ec91bc6abbd4 (bug 1821803) Backed out changeset a2ddd3db75c2 (bug 1821803) Backed out changeset 14892860eaee (bug 1821803)
This commit is contained in:
Родитель
b9acf99c16
Коммит
ddea690739
|
@ -448,9 +448,6 @@ RefPtr<ShutdownPromise> ExternalEngineStateMachine::Shutdown() {
|
|||
|
||||
mMetadataManager.Disconnect();
|
||||
|
||||
mSetCDMProxyPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_ABORT_ERR, __func__);
|
||||
mSetCDMProxyRequest.DisconnectIfExists();
|
||||
|
||||
mEngine->Shutdown();
|
||||
|
||||
auto* state = mState.AsShutdownEngine();
|
||||
|
@ -1033,38 +1030,10 @@ void ExternalEngineStateMachine::UpdateSecondaryVideoContainer() {
|
|||
|
||||
RefPtr<SetCDMPromise> ExternalEngineStateMachine::SetCDMProxy(
|
||||
CDMProxy* aProxy) {
|
||||
if (mState.IsShutdownEngine()) {
|
||||
return SetCDMPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
|
||||
}
|
||||
|
||||
if (mState.IsInitEngine() && mState.AsInitEngine()->mInitPromise) {
|
||||
LOG("SetCDMProxy is called before init");
|
||||
mState.AsInitEngine()->mInitPromise->Then(
|
||||
OwnerThread(), __func__,
|
||||
[self = RefPtr{this}, proxy = RefPtr{aProxy},
|
||||
this](const GenericNonExclusivePromise::ResolveOrRejectValue& aVal) {
|
||||
SetCDMProxy(proxy)
|
||||
->Then(OwnerThread(), __func__,
|
||||
[self = RefPtr{this},
|
||||
this](const SetCDMPromise::ResolveOrRejectValue& aVal) {
|
||||
mSetCDMProxyRequest.Complete();
|
||||
if (aVal.IsResolve()) {
|
||||
mSetCDMProxyPromise.Resolve(true, __func__);
|
||||
} else {
|
||||
mSetCDMProxyPromise.Reject(NS_ERROR_DOM_MEDIA_CDM_ERR,
|
||||
__func__);
|
||||
}
|
||||
})
|
||||
->Track(mSetCDMProxyRequest);
|
||||
});
|
||||
return mSetCDMProxyPromise.Ensure(__func__);
|
||||
}
|
||||
|
||||
// TODO : set CDM proxy again if we recreate the media engine after crash.
|
||||
LOG("SetCDMProxy=%p", aProxy);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mEngine);
|
||||
if (!mEngine->SetCDMProxy(aProxy)) {
|
||||
LOG("Failed to set CDM proxy on the engine");
|
||||
return SetCDMPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_CDM_ERR, __func__);
|
||||
}
|
||||
return MediaDecoderStateMachineBase::SetCDMProxy(aProxy);
|
||||
|
|
|
@ -286,10 +286,6 @@ class ExternalEngineStateMachine final
|
|||
bool mHasEnoughVideo = false;
|
||||
bool mSentPlaybackEndedEvent = false;
|
||||
bool mHasReceivedFirstDecodedVideoFrame = false;
|
||||
|
||||
// Only used if setting CDM happens before the engine finishes initialization.
|
||||
MozPromiseHolder<SetCDMPromise> mSetCDMProxyPromise;
|
||||
MozPromiseRequestHolder<SetCDMPromise> mSetCDMProxyRequest;
|
||||
};
|
||||
|
||||
class ExternalPlaybackEngine {
|
||||
|
|
|
@ -337,8 +337,8 @@ void MFMediaEngineWrapper::NotifyEndOfStream(TrackInfo::TrackType aType) {
|
|||
}
|
||||
|
||||
void MFMediaEngineWrapper::SetMediaInfo(const MediaInfo& aInfo) {
|
||||
WLOG("SetMediaInfo, hasAudio=%d, hasVideo=%d, encrypted=%d", aInfo.HasAudio(),
|
||||
aInfo.HasVideo(), aInfo.IsEncrypted());
|
||||
WLOG("SetMediaInfo, hasAudio=%d, hasVideo=%d", aInfo.HasAudio(),
|
||||
aInfo.HasVideo());
|
||||
MOZ_ASSERT(IsInited());
|
||||
Unused << ManagerThread()->Dispatch(NS_NewRunnableFunction(
|
||||
"MFMediaEngineWrapper::SetMediaInfo", [engine = mEngine, aInfo] {
|
||||
|
|
|
@ -375,7 +375,7 @@ mozilla::ipc::IPCResult MFMediaEngineParent::RecvNotifyMediaInfo(
|
|||
|
||||
auto errorExit = MakeScopeExit([&] {
|
||||
MediaResult error(NS_ERROR_DOM_MEDIA_FATAL_ERR,
|
||||
"Failed to create media source");
|
||||
"Failed to setup media source");
|
||||
DestroyEngineIfExists(Some(error));
|
||||
});
|
||||
|
||||
|
@ -384,59 +384,28 @@ mozilla::ipc::IPCResult MFMediaEngineParent::RecvNotifyMediaInfo(
|
|||
SUCCEEDED(MakeAndInitialize<MFMediaSource>(
|
||||
&mMediaSource, aInfo.audioInfo(), aInfo.videoInfo(), mManagerThread)),
|
||||
IPC_OK());
|
||||
|
||||
const bool isEncryted = mMediaSource->IsEncrypted();
|
||||
ENGINE_MARKER("MFMediaEngineParent,CreatedMediaSource");
|
||||
nsPrintfCString message(
|
||||
"Created the media source, audio=%s, video=%s, encrypted-audio=%s, "
|
||||
"encrypted-video=%s, isEncrypted=%d",
|
||||
aInfo.audioInfo() ? aInfo.audioInfo()->mMimeType.BeginReading() : "none",
|
||||
aInfo.videoInfo() ? aInfo.videoInfo()->mMimeType.BeginReading() : "none",
|
||||
aInfo.audioInfo() && aInfo.audioInfo()->mCrypto.IsEncrypted() ? "yes"
|
||||
: "no",
|
||||
aInfo.videoInfo() && aInfo.videoInfo()->mCrypto.IsEncrypted() ? "yes"
|
||||
: "no",
|
||||
isEncryted);
|
||||
LOG("%s", message.get());
|
||||
|
||||
mRequestSampleListener = mMediaSource->RequestSampleEvent().Connect(
|
||||
mManagerThread, this, &MFMediaEngineParent::HandleRequestSample);
|
||||
errorExit.release();
|
||||
|
||||
if (isEncryted && !mContentProtectionManager) {
|
||||
// We will set the source later when the CDM proxy is ready.
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
if (isEncryted && mContentProtectionManager) {
|
||||
auto* proxy = mContentProtectionManager->GetCDMProxy();
|
||||
MOZ_ASSERT(proxy);
|
||||
mMediaSource->SetCDMProxy(proxy);
|
||||
}
|
||||
SetMediaSourceOnEngine();
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
void MFMediaEngineParent::SetMediaSourceOnEngine() {
|
||||
AssertOnManagerThread();
|
||||
MOZ_ASSERT(mMediaSource);
|
||||
|
||||
auto errorExit = MakeScopeExit([&] {
|
||||
MediaResult error(NS_ERROR_DOM_MEDIA_FATAL_ERR,
|
||||
"Failed to set media source");
|
||||
DestroyEngineIfExists(Some(error));
|
||||
});
|
||||
|
||||
mMediaEngineExtension->SetMediaSource(mMediaSource.Get());
|
||||
|
||||
// We use the source scheme in order to let the media engine to load our
|
||||
// custom source.
|
||||
RETURN_VOID_IF_FAILED(
|
||||
mMediaEngine->SetSource(SysAllocString(L"MFRendererSrc")));
|
||||
NS_ENSURE_TRUE(
|
||||
SUCCEEDED(mMediaEngine->SetSource(SysAllocString(L"MFRendererSrc"))),
|
||||
IPC_OK());
|
||||
|
||||
LOG("Finished setup our custom media source to the media engine");
|
||||
ENGINE_MARKER("MFMediaEngineParent,FinishedSetupMediaSource");
|
||||
ENGINE_MARKER_TEXT(
|
||||
"MFMediaEngineParent,FinishedSetupMediaSource",
|
||||
nsPrintfCString(
|
||||
"audio=%s, video=%s",
|
||||
aInfo.audioInfo() ? aInfo.audioInfo()->mMimeType.BeginReading()
|
||||
: "none",
|
||||
aInfo.videoInfo() ? aInfo.videoInfo()->mMimeType.BeginReading()
|
||||
: "none"));
|
||||
mRequestSampleListener = mMediaSource->RequestSampleEvent().Connect(
|
||||
mManagerThread, this, &MFMediaEngineParent::HandleRequestSample);
|
||||
|
||||
errorExit.release();
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult MFMediaEngineParent::RecvPlay() {
|
||||
|
@ -521,7 +490,6 @@ mozilla::ipc::IPCResult MFMediaEngineParent::RecvSetCDMProxyId(
|
|||
// handle that as well.
|
||||
if (mMediaSource) {
|
||||
mMediaSource->SetCDMProxy(proxy);
|
||||
SetMediaSourceOnEngine();
|
||||
}
|
||||
LOG("Set CDM Proxy successfully on the media engine!");
|
||||
#endif
|
||||
|
|
|
@ -86,8 +86,6 @@ class MFMediaEngineParent final : public PMFMediaEngineParent {
|
|||
|
||||
void UpdateStatisticsData();
|
||||
|
||||
void SetMediaSourceOnEngine();
|
||||
|
||||
// This generates unique id for each MFMediaEngineParent instance, and it
|
||||
// would be increased monotonically.
|
||||
static inline uint64_t sMediaEngineIdx = 0;
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include "mozilla/EnumSet.h"
|
||||
#include "mozilla/GfxMessageUtils.h"
|
||||
#include "mozilla/gfx/Rect.h"
|
||||
#include "mozilla/dom/MFCDMSerializers.h"
|
||||
|
||||
namespace IPC {
|
||||
template <>
|
||||
|
@ -41,7 +40,6 @@ struct ParamTraits<mozilla::VideoInfo> {
|
|||
WriteParam(aWriter, aParam.mTransferFunction);
|
||||
WriteParam(aWriter, aParam.mColorRange);
|
||||
WriteParam(aWriter, aParam.HasAlpha());
|
||||
WriteParam(aWriter, aParam.mCrypto);
|
||||
}
|
||||
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
|
@ -60,8 +58,7 @@ struct ParamTraits<mozilla::VideoInfo> {
|
|||
ReadParam(aReader, &aResult->mColorPrimaries) &&
|
||||
ReadParam(aReader, &aResult->mTransferFunction) &&
|
||||
ReadParam(aReader, &aResult->mColorRange) &&
|
||||
ReadParam(aReader, &alphaPresent) &&
|
||||
ReadParam(aReader, &aResult->mCrypto)) {
|
||||
ReadParam(aReader, &alphaPresent)) {
|
||||
aResult->SetAlpha(alphaPresent);
|
||||
return true;
|
||||
}
|
||||
|
@ -185,7 +182,6 @@ struct ParamTraits<mozilla::AudioInfo> {
|
|||
WriteParam(aWriter, aParam.mProfile);
|
||||
WriteParam(aWriter, aParam.mExtendedProfile);
|
||||
WriteParam(aWriter, aParam.mCodecSpecificConfig);
|
||||
WriteParam(aWriter, aParam.mCrypto);
|
||||
}
|
||||
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
|
@ -196,8 +192,7 @@ struct ParamTraits<mozilla::AudioInfo> {
|
|||
ReadParam(aReader, &aResult->mBitDepth) &&
|
||||
ReadParam(aReader, &aResult->mProfile) &&
|
||||
ReadParam(aReader, &aResult->mExtendedProfile) &&
|
||||
ReadParam(aReader, &aResult->mCodecSpecificConfig) &&
|
||||
ReadParam(aReader, &aResult->mCrypto)) {
|
||||
ReadParam(aReader, &aResult->mCodecSpecificConfig)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -350,19 +345,6 @@ struct ParamTraits<mozilla::TrackingId> {
|
|||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::CryptoTrack> {
|
||||
typedef mozilla::CryptoTrack paramType;
|
||||
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mCryptoScheme);
|
||||
}
|
||||
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
return ReadParam(aReader, &aResult->mCryptoScheme);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace IPC
|
||||
|
||||
#endif // mozilla_dom_media_MediaIPCUtils_h
|
||||
|
|
|
@ -35,7 +35,6 @@ EXPORTS.mozilla += [
|
|||
|
||||
EXPORTS.mozilla.dom += [
|
||||
"MediaIPCUtils.h",
|
||||
"MFCDMSerializers.h",
|
||||
]
|
||||
|
||||
SOURCES += [
|
||||
|
|
|
@ -62,8 +62,6 @@ class MFContentProtectionManager
|
|||
|
||||
HRESULT SetCDMProxy(MFCDMProxy* aCDMProxy);
|
||||
|
||||
MFCDMProxy* GetCDMProxy() const { return mCDMProxy; }
|
||||
|
||||
private:
|
||||
HRESULT SetPMPServer(
|
||||
ABI::Windows::Media::Protection::IMediaProtectionPMPServer* aPMPServer);
|
||||
|
|
|
@ -68,9 +68,8 @@ HRESULT MFMediaEngineAudioStream::CreateMediaType(const TrackInfo& aInfo,
|
|||
MF_MT_USER_DATA, mAACUserData.Elements(), mAACUserData.Length()));
|
||||
}
|
||||
LOGV("Created audio type, subtype=%s, channel=%" PRIu32 ", rate=%" PRIu32
|
||||
", bitDepth=%" PRIu64 ", encrypted=%d",
|
||||
GUIDToStr(subType), info.mChannels, info.mRate, bitDepth,
|
||||
mAudioInfo.mCrypto.IsEncrypted());
|
||||
", bitDepth=%" PRIu64,
|
||||
GUIDToStr(subType), info.mChannels, info.mRate, bitDepth);
|
||||
|
||||
*aMediaType = mediaType.Detach();
|
||||
return S_OK;
|
||||
|
|
|
@ -175,11 +175,11 @@ HRESULT MFMediaEngineVideoStream::CreateMediaType(const TrackInfo& aInfo,
|
|||
|
||||
LOGV(
|
||||
"Created video type, subtype=%s, image=[%ux%u], display=[%ux%u], "
|
||||
"rotation=%s, tranFuns=%s, primaries=%s, encrypted=%d",
|
||||
"rotation=%s, tranFuns=%s, primaries=%s",
|
||||
GUIDToStr(subType), imageWidth, imageHeight, displayWidth, displayHeight,
|
||||
MFVideoRotationFormatToStr(rotation),
|
||||
MFVideoTransferFunctionToStr(transFunc),
|
||||
MFVideoPrimariesToStr(videoPrimaries), mIsEncrypted);
|
||||
MFVideoPrimariesToStr(videoPrimaries));
|
||||
*aMediaType = mediaType.Detach();
|
||||
return S_OK;
|
||||
}
|
||||
|
|
|
@ -581,12 +581,6 @@ void MFMediaSource::SetCDMProxy(MFCDMProxy* aCDMProxy) {
|
|||
}
|
||||
#endif
|
||||
|
||||
bool MFMediaSource::IsEncrypted() const {
|
||||
MutexAutoLock lock(mMutex);
|
||||
return (mAudioStream && mAudioStream->IsEncrypted()) ||
|
||||
(mVideoStream && mVideoStream->IsEncrypted());
|
||||
}
|
||||
|
||||
void MFMediaSource::AssertOnManagerThread() const {
|
||||
MOZ_ASSERT(mManagerThread->IsOnCurrentThread());
|
||||
}
|
||||
|
|
|
@ -126,8 +126,6 @@ class MFMediaSource : public Microsoft::WRL::RuntimeClass<
|
|||
|
||||
void ShutdownTaskQueue();
|
||||
|
||||
bool IsEncrypted() const;
|
||||
|
||||
private:
|
||||
void AssertOnManagerThread() const;
|
||||
void AssertOnMFThreadPool() const;
|
||||
|
|
|
@ -38,8 +38,7 @@ STDMETHODIMP MFPMPHostWrapper::ActivateClassById(LPCWSTR aId, IStream* aStream,
|
|||
STATSTG statstg;
|
||||
RETURN_IF_FAILED(
|
||||
aStream->Stat(&statstg, STATFLAG_NOOPEN | STATFLAG_NONAME));
|
||||
nsTArray<uint8_t> streamBlob;
|
||||
streamBlob.SetLength(statstg.cbSize.LowPart);
|
||||
nsTArray<uint8_t> streamBlob(statstg.cbSize.LowPart);
|
||||
unsigned long readSize = 0;
|
||||
RETURN_IF_FAILED(
|
||||
aStream->Read(&streamBlob[0], streamBlob.Length(), &readSize));
|
||||
|
|
Загрузка…
Ссылка в новой задаче