Bug 1672072 - P3. Remove IRemoteDecoderChild.h class. r=mattwoodrow,padenot,mjf,bryce

There's no longer have a GpuDecoderModule and RemoteGpuDecoder.

So we no longer need the IRemoteDecoderChild abstraction layer.

Differential Revision: https://phabricator.services.mozilla.com/D96359
This commit is contained in:
Jean-Yves Avenard 2020-11-13 04:21:14 +00:00
Родитель 8c9109c7c6
Коммит 98c87940d6
8 изменённых файлов: 27 добавлений и 77 удалений

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

@ -1,45 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef include_dom_media_ipc_IRemoteDecoderChild_h
#define include_dom_media_ipc_IRemoteDecoderChild_h
#include "PlatformDecoderModule.h"
#include "mozilla/TaskQueue.h"
namespace mozilla {
// This interface mirrors the MediaDataDecoder plus a bit (DestroyIPDL)
// to allow proxying to a remote decoder in RemoteDecoderModule or
// GpuDecoderModule. RemoteAudioDecoderChild, RemoteVideoDecoderChild,
// and VideoDecoderChild (for GPU) implement this interface.
class IRemoteDecoderChild {
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(IRemoteDecoderChild);
virtual RefPtr<MediaDataDecoder::InitPromise> Init() = 0;
virtual RefPtr<MediaDataDecoder::DecodePromise> Decode(
const nsTArray<RefPtr<MediaRawData>>& aSamples) = 0;
virtual RefPtr<MediaDataDecoder::DecodePromise> Drain() = 0;
virtual RefPtr<MediaDataDecoder::FlushPromise> Flush() = 0;
virtual RefPtr<ShutdownPromise> Shutdown() = 0;
virtual bool IsHardwareAccelerated(nsACString& aFailureReason) const {
return false;
}
virtual nsCString GetDescriptionName() const = 0;
virtual void SetSeekThreshold(const media::TimeUnit& aTime) {}
virtual MediaDataDecoder::ConversionRequired NeedsConversion() const {
return MediaDataDecoder::ConversionRequired::kNeedNone;
}
virtual void DestroyIPDL() = 0;
protected:
virtual ~IRemoteDecoderChild() = default;
};
} // namespace mozilla
#endif // include_dom_media_ipc_IRemoteDecoderChild_h

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

@ -19,6 +19,8 @@ RemoteDecoderChild::RemoteDecoderChild(bool aRecreatedOnCrash)
"Must be created on the manager thread"); "Must be created on the manager thread");
} }
RemoteDecoderChild::~RemoteDecoderChild() = default;
void RemoteDecoderChild::HandleRejectionError( void RemoteDecoderChild::HandleRejectionError(
const ipc::ResponseRejectReason& aReason, const ipc::ResponseRejectReason& aReason,
std::function<void(const MediaResult&)>&& aCallback) { std::function<void(const MediaResult&)>&& aCallback) {

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

@ -8,7 +8,6 @@
#include <functional> #include <functional>
#include "IRemoteDecoderChild.h"
#include "mozilla/PRemoteDecoderChild.h" #include "mozilla/PRemoteDecoderChild.h"
#include "mozilla/ShmemRecycleAllocator.h" #include "mozilla/ShmemRecycleAllocator.h"
@ -19,27 +18,29 @@ using mozilla::MediaDataDecoder;
using mozilla::ipc::IPCResult; using mozilla::ipc::IPCResult;
class RemoteDecoderChild : public ShmemRecycleAllocator<RemoteDecoderChild>, class RemoteDecoderChild : public ShmemRecycleAllocator<RemoteDecoderChild>,
public PRemoteDecoderChild, public PRemoteDecoderChild {
public IRemoteDecoderChild {
friend class PRemoteDecoderChild; friend class PRemoteDecoderChild;
public: public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(RemoteDecoderChild);
explicit RemoteDecoderChild(bool aRecreatedOnCrash = false); explicit RemoteDecoderChild(bool aRecreatedOnCrash = false);
void ActorDestroy(ActorDestroyReason aWhy) override; void ActorDestroy(ActorDestroyReason aWhy) override;
// IRemoteDecoderChild // This interface closely mirrors the MediaDataDecoder plus a bit
RefPtr<MediaDataDecoder::InitPromise> Init() override; // (DestroyIPDL) to allow proxying to a remote decoder in RemoteDecoderModule.
RefPtr<MediaDataDecoder::InitPromise> Init();
RefPtr<MediaDataDecoder::DecodePromise> Decode( RefPtr<MediaDataDecoder::DecodePromise> Decode(
const nsTArray<RefPtr<MediaRawData>>& aSamples) override; const nsTArray<RefPtr<MediaRawData>>& aSamples);
RefPtr<MediaDataDecoder::DecodePromise> Drain() override; RefPtr<MediaDataDecoder::DecodePromise> Drain();
RefPtr<MediaDataDecoder::FlushPromise> Flush() override; RefPtr<MediaDataDecoder::FlushPromise> Flush();
RefPtr<mozilla::ShutdownPromise> Shutdown() override; RefPtr<mozilla::ShutdownPromise> Shutdown();
bool IsHardwareAccelerated(nsACString& aFailureReason) const override; bool IsHardwareAccelerated(nsACString& aFailureReason) const;
nsCString GetDescriptionName() const override; nsCString GetDescriptionName() const;
void SetSeekThreshold(const media::TimeUnit& aTime) override; void SetSeekThreshold(const media::TimeUnit& aTime);
MediaDataDecoder::ConversionRequired NeedsConversion() const override; MediaDataDecoder::ConversionRequired NeedsConversion() const;
void DestroyIPDL() override; void DestroyIPDL();
// Called from IPDL when our actor has been destroyed // Called from IPDL when our actor has been destroyed
void IPDLActorDestroyed(); void IPDLActorDestroyed();
@ -47,7 +48,7 @@ class RemoteDecoderChild : public ShmemRecycleAllocator<RemoteDecoderChild>,
RemoteDecoderManagerChild* GetManager(); RemoteDecoderManagerChild* GetManager();
protected: protected:
virtual ~RemoteDecoderChild() = default; virtual ~RemoteDecoderChild();
void AssertOnManagerThread() const; void AssertOnManagerThread() const;
virtual MediaResult ProcessOutput(DecodedOutputIPDL&& aDecodedData) = 0; virtual MediaResult ProcessOutput(DecodedOutputIPDL&& aDecodedData) = 0;

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

@ -6,7 +6,6 @@
#include "RemoteDecoderManagerChild.h" #include "RemoteDecoderManagerChild.h"
#include "RemoteAudioDecoder.h" #include "RemoteAudioDecoder.h"
#include "RemoteDecoderChild.h"
#include "RemoteMediaDataDecoder.h" #include "RemoteMediaDataDecoder.h"
#include "RemoteVideoDecoder.h" #include "RemoteVideoDecoder.h"
#include "VideoUtils.h" #include "VideoUtils.h"
@ -70,10 +69,10 @@ void RemoteDecoderManagerChild::Init() {
auto remoteDecoderManagerThread = sRemoteDecoderManagerChildThread.Lock(); auto remoteDecoderManagerThread = sRemoteDecoderManagerChildThread.Lock();
if (!*remoteDecoderManagerThread) { if (!*remoteDecoderManagerThread) {
// We can't use a MediaThreadType::CONTROLLER as the GpuDecoderModule and // We can't use a MediaThreadType::SUPERVISOR as the RemoteDecoderModule
// RemoteDecoderModule runs on it and dispatch synchronous tasks to the // runs on it and dispatch synchronous tasks to the manager thread, should
// manager thread, should more than 4 concurrent videos being instantiated // more than 4 concurrent videos being instantiated at the same time, we
// at the same time, we could end up in a deadlock. // could end up in a deadlock.
RefPtr<nsIThread> childThread; RefPtr<nsIThread> childThread;
nsresult rv = NS_NewNamedThread( nsresult rv = NS_NewNamedThread(
"RemVidChild", getter_AddRefs(childThread), "RemVidChild", getter_AddRefs(childThread),

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

@ -5,14 +5,12 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "RemoteMediaDataDecoder.h" #include "RemoteMediaDataDecoder.h"
#include "base/thread.h" #include "RemoteDecoderChild.h"
#include "IRemoteDecoderChild.h"
#include "RemoteDecoderManagerChild.h" #include "RemoteDecoderManagerChild.h"
namespace mozilla { namespace mozilla {
RemoteMediaDataDecoder::RemoteMediaDataDecoder(IRemoteDecoderChild* aChild) RemoteMediaDataDecoder::RemoteMediaDataDecoder(RemoteDecoderChild* aChild)
: mChild(aChild) {} : mChild(aChild) {}
RemoteMediaDataDecoder::~RemoteMediaDataDecoder() { RemoteMediaDataDecoder::~RemoteMediaDataDecoder() {

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

@ -11,8 +11,7 @@
namespace mozilla { namespace mozilla {
class GpuDecoderModule; class RemoteDecoderChild;
class IRemoteDecoderChild;
class RemoteDecoderManagerChild; class RemoteDecoderManagerChild;
class RemoteMediaDataDecoder; class RemoteMediaDataDecoder;
@ -27,7 +26,6 @@ class RemoteMediaDataDecoder
: public MediaDataDecoder, : public MediaDataDecoder,
public DecoderDoctorLifeLogger<RemoteMediaDataDecoder> { public DecoderDoctorLifeLogger<RemoteMediaDataDecoder> {
public: public:
friend class GpuDecoderModule;
friend class RemoteDecoderManagerChild; friend class RemoteDecoderManagerChild;
// MediaDataDecoder // MediaDataDecoder
@ -45,13 +43,13 @@ class RemoteMediaDataDecoder
ConversionRequired NeedsConversion() const override; ConversionRequired NeedsConversion() const override;
private: private:
explicit RemoteMediaDataDecoder(IRemoteDecoderChild* aChild); explicit RemoteMediaDataDecoder(RemoteDecoderChild* aChild);
~RemoteMediaDataDecoder(); ~RemoteMediaDataDecoder();
// Only ever written to from the reader task queue (during the constructor and // Only ever written to from the reader task queue (during the constructor and
// 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<IRemoteDecoderChild> mChild; RefPtr<RemoteDecoderChild> mChild;
// Only ever written/modified during decoder initialisation. // Only ever written/modified during decoder initialisation.
// As such can be accessed from any threads after that. // As such can be accessed from any threads after that.
nsCString mDescription = "RemoteMediaDataDecoder"_ns; nsCString mDescription = "RemoteMediaDataDecoder"_ns;

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

@ -13,7 +13,6 @@ IPDL_SOURCES += [
] ]
EXPORTS.mozilla += [ EXPORTS.mozilla += [
"IRemoteDecoderChild.h",
"RDDChild.h", "RDDChild.h",
"RDDParent.h", "RDDParent.h",
"RDDProcessHost.h", "RDDProcessHost.h",

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

@ -34,7 +34,6 @@ namespace layers {
class ImageContainer; class ImageContainer;
} // namespace layers } // namespace layers
class GpuDecoderModule;
class MediaDataDecoder; class MediaDataDecoder;
class RemoteDecoderModule; class RemoteDecoderModule;
class CDMProxy; class CDMProxy;
@ -275,7 +274,6 @@ class PlatformDecoderModule {
friend class MediaChangeMonitor; friend class MediaChangeMonitor;
friend class PDMFactory; friend class PDMFactory;
friend class GpuDecoderModule;
friend class EMEDecoderModule; friend class EMEDecoderModule;
friend class RemoteDecoderModule; friend class RemoteDecoderModule;