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__();
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();

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

@ -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<MediaDataDecoder::InitPromise>
@ -53,7 +55,18 @@ RemoteVideoDecoder::Init()
{
RefPtr<RemoteVideoDecoder> 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<MediaDataDecoder::DecodePromise>
@ -183,5 +196,11 @@ RemoteDecoderModule::CreateVideoDecoder(const CreateDecoderParams& aParams)
return object.forget();
}
nsCString
RemoteVideoDecoder::GetDescriptionName() const
{
return mDescription;
}
} // namespace dom
} // namespace mozilla

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

@ -34,11 +34,7 @@ public:
RefPtr<ShutdownPromise> 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<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.

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

@ -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<MediaDataDecoder::ConversionRequired>(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)
{

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

@ -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<MediaDataDecoder::FlushPromise> 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<MediaDataDecoder::FlushPromise> mFlushPromise;
nsCString mHardwareAcceleratedReason;
nsCString mDescription;
bool mCanSend;
bool mInitialized;
Atomic<bool> mIsHardwareAccelerated;
@ -80,7 +83,7 @@ private:
bool mNeedNewDecoder;
MediaDataDecoder::DecodedData mDecodedData;
nsCString mBlacklistedD3D11Driver;
nsCString mBlacklistedD3D11Driver;
nsCString mBlacklistedD3D9Driver;
TimeStamp mGPUCrashTime;
};

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

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