зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1672087 - P2. Recreate remote decoder when parent dies. r=mattwoodrow,bryce
The RDD process startup being asynchronous make the operation trivial. Unlike with the GPU process, we can immediately tell the MediaFormatDecoder that a new decoder is needed when the RDD died. Recovery will immediately occur with little visible interruption. Differential Revision: https://phabricator.services.mozilla.com/D98571
This commit is contained in:
Родитель
9cf6c54ce4
Коммит
771993d760
|
@ -13,7 +13,8 @@
|
|||
|
||||
namespace mozilla {
|
||||
|
||||
RemoteAudioDecoderChild::RemoteAudioDecoderChild() : RemoteDecoderChild() {}
|
||||
RemoteAudioDecoderChild::RemoteAudioDecoderChild()
|
||||
: RemoteDecoderChild(RemoteDecodeIn::RddProcess) {}
|
||||
|
||||
MediaResult RemoteAudioDecoderChild::ProcessOutput(
|
||||
DecodedOutputIPDL&& aDecodedData) {
|
||||
|
@ -38,7 +39,7 @@ MediaResult RemoteAudioDecoderChild::InitIPDL(
|
|||
const AudioInfo& aAudioInfo,
|
||||
const CreateDecoderParams::OptionSet& aOptions) {
|
||||
RefPtr<RemoteDecoderManagerChild> manager =
|
||||
RemoteDecoderManagerChild::GetSingleton(RemoteDecodeIn::RddProcess);
|
||||
RemoteDecoderManagerChild::GetSingleton(mLocation);
|
||||
|
||||
// The manager isn't available because RemoteDecoderManagerChild has been
|
||||
// initialized with null end points and we don't want to decode video on RDD
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
|
||||
namespace mozilla {
|
||||
|
||||
RemoteDecoderChild::RemoteDecoderChild(bool aRecreatedOnCrash)
|
||||
RemoteDecoderChild::RemoteDecoderChild(RemoteDecodeIn aLocation)
|
||||
: ShmemRecycleAllocator(this),
|
||||
mThread(GetCurrentSerialEventTarget()),
|
||||
mRecreatedOnCrash(aRecreatedOnCrash) {
|
||||
mLocation(aLocation),
|
||||
mThread(GetCurrentSerialEventTarget()) {
|
||||
MOZ_DIAGNOSTIC_ASSERT(
|
||||
RemoteDecoderManagerChild::GetManagerThread() &&
|
||||
RemoteDecoderManagerChild::GetManagerThread()->IsOnCurrentThread(),
|
||||
|
@ -30,9 +30,12 @@ void RemoteDecoderChild::HandleRejectionError(
|
|||
// longer be used.
|
||||
|
||||
// The GPU/RDD process crashed.
|
||||
if (mRecreatedOnCrash) {
|
||||
// Defer reporting an error until we've recreated the manager so that
|
||||
// it'll be safe for MediaFormatReader to recreate decoders
|
||||
if (mLocation == RemoteDecodeIn::GpuProcess) {
|
||||
// The GPU process will get automatically restarted by the parent process.
|
||||
// Once it has been restarted the ContentChild will receive the message and
|
||||
// will call GetManager()->InitForGPUProcess.
|
||||
// We defer reporting an error until we've recreated the RemoteDecoder
|
||||
// manager so that it'll be safe for MediaFormatReader to recreate decoders
|
||||
RefPtr<RemoteDecoderChild> self = this;
|
||||
GetManager()->RunWhenGPUProcessRecreated(NS_NewRunnableFunction(
|
||||
"RemoteDecoderChild::HandleRejectionError",
|
||||
|
@ -42,7 +45,10 @@ void RemoteDecoderChild::HandleRejectionError(
|
|||
}));
|
||||
return;
|
||||
}
|
||||
aCallback(MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__));
|
||||
// The RDD process is restarted on demand and asynchronously, we can
|
||||
// immediately inform the caller that a new decoder is needed. The RDD will
|
||||
// then be restarted during the new decoder creation.
|
||||
aCallback(MediaResult(NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER, __func__));
|
||||
}
|
||||
|
||||
// ActorDestroy is called if the channel goes down while waiting for a response.
|
||||
|
|
|
@ -24,7 +24,7 @@ class RemoteDecoderChild : public ShmemRecycleAllocator<RemoteDecoderChild>,
|
|||
public:
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(RemoteDecoderChild);
|
||||
|
||||
explicit RemoteDecoderChild(bool aRecreatedOnCrash = false);
|
||||
explicit RemoteDecoderChild(RemoteDecodeIn aLocation);
|
||||
|
||||
void ActorDestroy(ActorDestroyReason aWhy) override;
|
||||
|
||||
|
@ -56,6 +56,7 @@ class RemoteDecoderChild : public ShmemRecycleAllocator<RemoteDecoderChild>,
|
|||
|
||||
RefPtr<RemoteDecoderChild> mIPDLSelfRef;
|
||||
MediaDataDecoder::DecodedData mDecodedData;
|
||||
const RemoteDecodeIn mLocation;
|
||||
|
||||
private:
|
||||
const nsCOMPtr<nsISerialEventTarget> mThread;
|
||||
|
@ -74,7 +75,6 @@ class RemoteDecoderChild : public ShmemRecycleAllocator<RemoteDecoderChild>,
|
|||
nsCString mHardwareAcceleratedReason;
|
||||
nsCString mDescription;
|
||||
bool mIsHardwareAccelerated = false;
|
||||
const bool mRecreatedOnCrash;
|
||||
MediaDataDecoder::ConversionRequired mConversion =
|
||||
MediaDataDecoder::ConversionRequired::kNeedNone;
|
||||
};
|
||||
|
|
|
@ -55,9 +55,7 @@ KnowsCompositorVideo::TryCreateForIdentifier(
|
|||
}
|
||||
|
||||
RemoteVideoDecoderChild::RemoteVideoDecoderChild(RemoteDecodeIn aLocation)
|
||||
: RemoteDecoderChild(aLocation == RemoteDecodeIn::GpuProcess),
|
||||
mBufferRecycleBin(new BufferRecycleBin),
|
||||
mLocation(aLocation) {}
|
||||
: RemoteDecoderChild(aLocation), mBufferRecycleBin(new BufferRecycleBin) {}
|
||||
|
||||
MediaResult RemoteVideoDecoderChild::ProcessOutput(
|
||||
DecodedOutputIPDL&& aDecodedData) {
|
||||
|
|
|
@ -47,9 +47,6 @@ class RemoteVideoDecoderChild : public RemoteDecoderChild {
|
|||
|
||||
private:
|
||||
RefPtr<mozilla::layers::BufferRecycleBin> mBufferRecycleBin;
|
||||
|
||||
// The location of the RemoteVideoDecoderParent - Gpu or Rdd process.
|
||||
const RemoteDecodeIn mLocation;
|
||||
};
|
||||
|
||||
class RemoteVideoDecoderParent final : public RemoteDecoderParent {
|
||||
|
|
Загрузка…
Ссылка в новой задаче