diff --git a/dom/media/ipc/PVideoDecoder.ipdl b/dom/media/ipc/PVideoDecoder.ipdl index 9c4d9e6d6e90..bdd4ff571cba 100644 --- a/dom/media/ipc/PVideoDecoder.ipdl +++ b/dom/media/ipc/PVideoDecoder.ipdl @@ -59,7 +59,7 @@ parent: async __delete__(); child: - async InitComplete(bool hardware, nsCString hardwareReason, uint32_t conversion); + async InitComplete(nsCString decoderDescription, bool hardware, nsCString hardwareReason, uint32_t conversion); async InitFailed(nsresult reason); async FlushComplete(); diff --git a/dom/media/ipc/RemoteVideoDecoder.cpp b/dom/media/ipc/RemoteVideoDecoder.cpp index d4e1df158882..63b514f4185a 100644 --- a/dom/media/ipc/RemoteVideoDecoder.cpp +++ b/dom/media/ipc/RemoteVideoDecoder.cpp @@ -23,6 +23,7 @@ using namespace gfx; RemoteVideoDecoder::RemoteVideoDecoder() : mActor(new VideoDecoderChild()) + , mDescription("RemoteVideoDecoder") { } @@ -45,7 +46,8 @@ RemoteVideoDecoder::~RemoteVideoDecoder() actor = nullptr; mActor = nullptr; - VideoDecoderManagerChild::GetManagerThread()->Dispatch(task.forget(), NS_DISPATCH_NORMAL); + VideoDecoderManagerChild::GetManagerThread()->Dispatch(task.forget(), + NS_DISPATCH_NORMAL); } RefPtr @@ -53,7 +55,18 @@ RemoteVideoDecoder::Init() { RefPtr self = this; return InvokeAsync(VideoDecoderManagerChild::GetManagerAbstractThread(), - __func__, [self, this]() { return mActor->Init(); }); + __func__, + [self, this]() { return mActor->Init(); }) + ->Then(VideoDecoderManagerChild::GetManagerAbstractThread(), + __func__, + [self, this](TrackType aTrack) { + mDescription = + mActor->GetDescriptionName() + NS_LITERAL_CSTRING(" (remote)"); + return InitPromise::CreateAndResolve(aTrack, __func__); + }, + [self, this](const MediaResult& aError) { + return InitPromise::CreateAndReject(aError, __func__); + }); } RefPtr @@ -183,5 +196,11 @@ RemoteDecoderModule::CreateVideoDecoder(const CreateDecoderParams& aParams) return object.forget(); } +nsCString +RemoteVideoDecoder::GetDescriptionName() const +{ + return mDescription; +} + } // namespace dom } // namespace mozilla diff --git a/dom/media/ipc/RemoteVideoDecoder.h b/dom/media/ipc/RemoteVideoDecoder.h index c9a20f8986e3..361f66658d48 100644 --- a/dom/media/ipc/RemoteVideoDecoder.h +++ b/dom/media/ipc/RemoteVideoDecoder.h @@ -34,11 +34,7 @@ public: RefPtr Shutdown() override; bool IsHardwareAccelerated(nsACString& aFailureReason) const override; void SetSeekThreshold(const media::TimeUnit& aTime) override; - - nsCString GetDescriptionName() const override - { - return NS_LITERAL_CSTRING("RemoteVideoDecoder"); - } + nsCString GetDescriptionName() const override; ConversionRequired NeedsConversion() const override; private: @@ -49,6 +45,9 @@ private: // destructor when we can guarantee no other threads are accessing it). Only // read from the manager thread. RefPtr mActor; + // Only ever written/modified during decoder initialisation. + // As such can be accessed from any threads after that. + nsCString mDescription; }; // A PDM implementation that creates RemoteVideoDecoders. diff --git a/dom/media/ipc/VideoDecoderChild.cpp b/dom/media/ipc/VideoDecoderChild.cpp index 1341a0054503..496c92cf74dc 100644 --- a/dom/media/ipc/VideoDecoderChild.cpp +++ b/dom/media/ipc/VideoDecoderChild.cpp @@ -107,13 +107,15 @@ VideoDecoderChild::RecvError(const nsresult& aError) } mozilla::ipc::IPCResult -VideoDecoderChild::RecvInitComplete(const bool& aHardware, +VideoDecoderChild::RecvInitComplete(const nsCString& aDecoderDescription, + const bool& aHardware, const nsCString& aHardwareReason, const uint32_t& aConversion) { AssertOnManagerThread(); mInitPromise.ResolveIfExists(TrackInfo::kVideoTrack, __func__); mInitialized = true; + mDescription = aDecoderDescription; mIsHardwareAccelerated = aHardware; mHardwareAcceleratedReason = aHardwareReason; mConversion = static_cast(aConversion); @@ -329,6 +331,13 @@ VideoDecoderChild::IsHardwareAccelerated(nsACString& aFailureReason) const return mIsHardwareAccelerated; } +nsCString +VideoDecoderChild::GetDescriptionName() const +{ + AssertOnManagerThread(); + return mDescription; +} + void VideoDecoderChild::SetSeekThreshold(const media::TimeUnit& aTime) { diff --git a/dom/media/ipc/VideoDecoderChild.h b/dom/media/ipc/VideoDecoderChild.h index be96c9180f10..0e59f89c00ae 100644 --- a/dom/media/ipc/VideoDecoderChild.h +++ b/dom/media/ipc/VideoDecoderChild.h @@ -29,7 +29,8 @@ public: mozilla::ipc::IPCResult RecvInputExhausted() override; mozilla::ipc::IPCResult RecvDrainComplete() override; mozilla::ipc::IPCResult RecvError(const nsresult& aError) override; - mozilla::ipc::IPCResult RecvInitComplete(const bool& aHardware, + mozilla::ipc::IPCResult RecvInitComplete(const nsCString& aDecoderDescription, + const bool& aHardware, const nsCString& aHardwareReason, const uint32_t& aConversion) override; mozilla::ipc::IPCResult RecvInitFailed(const nsresult& aReason) override; @@ -43,6 +44,7 @@ public: RefPtr Flush(); void Shutdown(); bool IsHardwareAccelerated(nsACString& aFailureReason) const; + nsCString GetDescriptionName() const; void SetSeekThreshold(const media::TimeUnit& aTime); MediaDataDecoder::ConversionRequired NeedsConversion() const; @@ -70,6 +72,7 @@ private: MozPromiseHolder mFlushPromise; nsCString mHardwareAcceleratedReason; + nsCString mDescription; bool mCanSend; bool mInitialized; Atomic mIsHardwareAccelerated; @@ -80,7 +83,7 @@ private: bool mNeedNewDecoder; MediaDataDecoder::DecodedData mDecodedData; - nsCString mBlacklistedD3D11Driver; + nsCString mBlacklistedD3D11Driver; nsCString mBlacklistedD3D9Driver; TimeStamp mGPUCrashTime; }; diff --git a/dom/media/ipc/VideoDecoderParent.cpp b/dom/media/ipc/VideoDecoderParent.cpp index 400b98b8fda2..98ba7c928287 100644 --- a/dom/media/ipc/VideoDecoderParent.cpp +++ b/dom/media/ipc/VideoDecoderParent.cpp @@ -112,8 +112,10 @@ VideoDecoderParent::RecvInit() self->mDecoder->IsHardwareAccelerated(hardwareReason); uint32_t conversion = static_cast(self->mDecoder->NeedsConversion()); - Unused << self->SendInitComplete( - hardwareAccelerated, hardwareReason, conversion); + Unused << self->SendInitComplete(self->mDecoder->GetDescriptionName(), + hardwareAccelerated, + hardwareReason, + conversion); } }, [self] (MediaResult aReason) {