Bug 1394591 - P4. Pass decoder description to RemoteVideoDecoder. r=mattwoodrow

This makes it easier to determine the actual decoder in use within the GPU process.

MozReview-Commit-ID: 5TF6AsyXYWW

--HG--
extra : rebase_source : 0e73dc17206a83006040cf422182da560b3cf70a
This commit is contained in:
Jean-Yves Avenard 2017-09-01 18:22:55 +02:00
Родитель 23c55d9a28
Коммит ec392e67b8
6 изменённых файлов: 45 добавлений и 13 удалений

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

@ -59,7 +59,7 @@ parent:
async __delete__(); async __delete__();
child: 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 InitFailed(nsresult reason);
async FlushComplete(); async FlushComplete();

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

@ -23,6 +23,7 @@ using namespace gfx;
RemoteVideoDecoder::RemoteVideoDecoder() RemoteVideoDecoder::RemoteVideoDecoder()
: mActor(new VideoDecoderChild()) : mActor(new VideoDecoderChild())
, mDescription("RemoteVideoDecoder")
{ {
} }
@ -45,7 +46,8 @@ RemoteVideoDecoder::~RemoteVideoDecoder()
actor = nullptr; actor = nullptr;
mActor = nullptr; mActor = nullptr;
VideoDecoderManagerChild::GetManagerThread()->Dispatch(task.forget(), NS_DISPATCH_NORMAL); VideoDecoderManagerChild::GetManagerThread()->Dispatch(task.forget(),
NS_DISPATCH_NORMAL);
} }
RefPtr<MediaDataDecoder::InitPromise> RefPtr<MediaDataDecoder::InitPromise>
@ -53,7 +55,18 @@ RemoteVideoDecoder::Init()
{ {
RefPtr<RemoteVideoDecoder> self = this; RefPtr<RemoteVideoDecoder> self = this;
return InvokeAsync(VideoDecoderManagerChild::GetManagerAbstractThread(), 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<MediaDataDecoder::DecodePromise> RefPtr<MediaDataDecoder::DecodePromise>
@ -183,5 +196,11 @@ RemoteDecoderModule::CreateVideoDecoder(const CreateDecoderParams& aParams)
return object.forget(); return object.forget();
} }
nsCString
RemoteVideoDecoder::GetDescriptionName() const
{
return mDescription;
}
} // namespace dom } // namespace dom
} // namespace mozilla } // namespace mozilla

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

@ -34,11 +34,7 @@ public:
RefPtr<ShutdownPromise> Shutdown() override; RefPtr<ShutdownPromise> Shutdown() override;
bool IsHardwareAccelerated(nsACString& aFailureReason) const override; bool IsHardwareAccelerated(nsACString& aFailureReason) const override;
void SetSeekThreshold(const media::TimeUnit& aTime) override; void SetSeekThreshold(const media::TimeUnit& aTime) override;
nsCString GetDescriptionName() const override;
nsCString GetDescriptionName() const override
{
return NS_LITERAL_CSTRING("RemoteVideoDecoder");
}
ConversionRequired NeedsConversion() const override; ConversionRequired NeedsConversion() const override;
private: private:
@ -49,6 +45,9 @@ private:
// destructor when we can guarantee no other threads are accessing it). Only // destructor when we can guarantee no other threads are accessing it). Only
// read from the manager thread. // read from the manager thread.
RefPtr<VideoDecoderChild> mActor; RefPtr<VideoDecoderChild> 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. // A PDM implementation that creates RemoteVideoDecoders.

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

@ -107,13 +107,15 @@ VideoDecoderChild::RecvError(const nsresult& aError)
} }
mozilla::ipc::IPCResult mozilla::ipc::IPCResult
VideoDecoderChild::RecvInitComplete(const bool& aHardware, VideoDecoderChild::RecvInitComplete(const nsCString& aDecoderDescription,
const bool& aHardware,
const nsCString& aHardwareReason, const nsCString& aHardwareReason,
const uint32_t& aConversion) const uint32_t& aConversion)
{ {
AssertOnManagerThread(); AssertOnManagerThread();
mInitPromise.ResolveIfExists(TrackInfo::kVideoTrack, __func__); mInitPromise.ResolveIfExists(TrackInfo::kVideoTrack, __func__);
mInitialized = true; mInitialized = true;
mDescription = aDecoderDescription;
mIsHardwareAccelerated = aHardware; mIsHardwareAccelerated = aHardware;
mHardwareAcceleratedReason = aHardwareReason; mHardwareAcceleratedReason = aHardwareReason;
mConversion = static_cast<MediaDataDecoder::ConversionRequired>(aConversion); mConversion = static_cast<MediaDataDecoder::ConversionRequired>(aConversion);
@ -329,6 +331,13 @@ VideoDecoderChild::IsHardwareAccelerated(nsACString& aFailureReason) const
return mIsHardwareAccelerated; return mIsHardwareAccelerated;
} }
nsCString
VideoDecoderChild::GetDescriptionName() const
{
AssertOnManagerThread();
return mDescription;
}
void void
VideoDecoderChild::SetSeekThreshold(const media::TimeUnit& aTime) VideoDecoderChild::SetSeekThreshold(const media::TimeUnit& aTime)
{ {

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

@ -29,7 +29,8 @@ public:
mozilla::ipc::IPCResult RecvInputExhausted() override; mozilla::ipc::IPCResult RecvInputExhausted() override;
mozilla::ipc::IPCResult RecvDrainComplete() override; mozilla::ipc::IPCResult RecvDrainComplete() override;
mozilla::ipc::IPCResult RecvError(const nsresult& aError) 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 nsCString& aHardwareReason,
const uint32_t& aConversion) override; const uint32_t& aConversion) override;
mozilla::ipc::IPCResult RecvInitFailed(const nsresult& aReason) override; mozilla::ipc::IPCResult RecvInitFailed(const nsresult& aReason) override;
@ -43,6 +44,7 @@ public:
RefPtr<MediaDataDecoder::FlushPromise> Flush(); RefPtr<MediaDataDecoder::FlushPromise> Flush();
void Shutdown(); void Shutdown();
bool IsHardwareAccelerated(nsACString& aFailureReason) const; bool IsHardwareAccelerated(nsACString& aFailureReason) const;
nsCString GetDescriptionName() const;
void SetSeekThreshold(const media::TimeUnit& aTime); void SetSeekThreshold(const media::TimeUnit& aTime);
MediaDataDecoder::ConversionRequired NeedsConversion() const; MediaDataDecoder::ConversionRequired NeedsConversion() const;
@ -70,6 +72,7 @@ private:
MozPromiseHolder<MediaDataDecoder::FlushPromise> mFlushPromise; MozPromiseHolder<MediaDataDecoder::FlushPromise> mFlushPromise;
nsCString mHardwareAcceleratedReason; nsCString mHardwareAcceleratedReason;
nsCString mDescription;
bool mCanSend; bool mCanSend;
bool mInitialized; bool mInitialized;
Atomic<bool> mIsHardwareAccelerated; Atomic<bool> mIsHardwareAccelerated;
@ -80,7 +83,7 @@ private:
bool mNeedNewDecoder; bool mNeedNewDecoder;
MediaDataDecoder::DecodedData mDecodedData; MediaDataDecoder::DecodedData mDecodedData;
nsCString mBlacklistedD3D11Driver; nsCString mBlacklistedD3D11Driver;
nsCString mBlacklistedD3D9Driver; nsCString mBlacklistedD3D9Driver;
TimeStamp mGPUCrashTime; TimeStamp mGPUCrashTime;
}; };

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

@ -112,8 +112,10 @@ VideoDecoderParent::RecvInit()
self->mDecoder->IsHardwareAccelerated(hardwareReason); self->mDecoder->IsHardwareAccelerated(hardwareReason);
uint32_t conversion = uint32_t conversion =
static_cast<uint32_t>(self->mDecoder->NeedsConversion()); static_cast<uint32_t>(self->mDecoder->NeedsConversion());
Unused << self->SendInitComplete( Unused << self->SendInitComplete(self->mDecoder->GetDescriptionName(),
hardwareAccelerated, hardwareReason, conversion); hardwareAccelerated,
hardwareReason,
conversion);
} }
}, },
[self] (MediaResult aReason) { [self] (MediaResult aReason) {