gecko-dev/dom/media/ipc/RemoteDecoderChild.h
Michael Froman 9599965900 Bug 1500596 - pt3 - Add remote audio decoding for Vorbis. r=jya
- Use a single remote decoder IPDL spec and make a remote decoding
  base class.
Renames PRemoteVideoDecoder.ipdl to PRemoteDecoder.ipdl
Renames RemoteVideoDecoder{Child|Parent}.{cpp|h} to
        RemoteDecoder{Child|Parent}.{cpp|h}

- Move remote video decoding to new subclasses.
Creates RemoteVideoDecoder.{cpp|h} that contains both the parent
and child sides of the RemoteVideoDecoder{Child|Parent} classes.

- Create new remote audio decoder
Creates RemoteAudioDecoder.{cpp|h} that contains both the parent
and child sides of the RemoteAudioDecoder{Child|Parent} classes.

- Connect all the plumbing to use the new remote audio decoder to
  decode Vorbis in RDD including a new pref to control whether
  Vorbis is decoding in the AgnosticDecoderModule or the
  RemoteDecoderModule/RDD (media.rdd-vorbis.enabled).

Depends on D18640

Differential Revision: https://phabricator.services.mozilla.com/D18641

--HG--
rename : dom/media/ipc/PRemoteVideoDecoder.ipdl => dom/media/ipc/PRemoteDecoder.ipdl
rename : dom/media/ipc/RemoteVideoDecoderChild.cpp => dom/media/ipc/RemoteDecoderChild.cpp
rename : dom/media/ipc/RemoteVideoDecoderChild.h => dom/media/ipc/RemoteDecoderChild.h
rename : dom/media/ipc/RemoteVideoDecoderParent.cpp => dom/media/ipc/RemoteDecoderParent.cpp
rename : dom/media/ipc/RemoteVideoDecoderParent.h => dom/media/ipc/RemoteDecoderParent.h
extra : moz-landing-system : lando
2019-02-14 19:08:21 +00:00

82 lines
2.9 KiB
C++

/* -*- 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_RemoteDecoderChild_h
#define include_dom_media_ipc_RemoteDecoderChild_h
#include "mozilla/PRemoteDecoderChild.h"
#include "IRemoteDecoderChild.h"
namespace mozilla {
class RemoteDecoderManagerChild;
using mozilla::MediaDataDecoder;
using mozilla::ipc::IPCResult;
class RemoteDecoderChild : public PRemoteDecoderChild,
public IRemoteDecoderChild {
friend class PRemoteDecoderChild;
public:
explicit RemoteDecoderChild();
// PRemoteDecoderChild
virtual IPCResult RecvOutput(const DecodedOutputIPDL& aDecodedData) = 0;
IPCResult RecvInputExhausted();
IPCResult RecvDrainComplete();
IPCResult RecvError(const nsresult& aError);
IPCResult RecvInitComplete(const TrackInfo::TrackType& trackType,
const nsCString& aDecoderDescription,
const ConversionRequired& aConversion);
IPCResult RecvInitFailed(const nsresult& aReason);
IPCResult RecvFlushComplete();
void ActorDestroy(ActorDestroyReason aWhy) override;
// IRemoteDecoderChild
RefPtr<MediaDataDecoder::InitPromise> Init() override;
RefPtr<MediaDataDecoder::DecodePromise> Decode(
MediaRawData* aSample) override;
RefPtr<MediaDataDecoder::DecodePromise> Drain() override;
RefPtr<MediaDataDecoder::FlushPromise> Flush() override;
void Shutdown() override;
bool IsHardwareAccelerated(nsACString& aFailureReason) const override;
nsCString GetDescriptionName() const override;
void SetSeekThreshold(const media::TimeUnit& aTime) override;
MediaDataDecoder::ConversionRequired NeedsConversion() const override;
void DestroyIPDL() override;
// Called from IPDL when our actor has been destroyed
void IPDLActorDestroyed();
RemoteDecoderManagerChild* GetManager();
protected:
virtual ~RemoteDecoderChild();
void AssertOnManagerThread() const;
RefPtr<RemoteDecoderChild> mIPDLSelfRef;
bool mCanSend = false;
MediaDataDecoder::DecodedData mDecodedData;
private:
RefPtr<nsIThread> mThread;
MozPromiseHolder<MediaDataDecoder::InitPromise> mInitPromise;
MozPromiseHolder<MediaDataDecoder::DecodePromise> mDecodePromise;
MozPromiseHolder<MediaDataDecoder::DecodePromise> mDrainPromise;
MozPromiseHolder<MediaDataDecoder::FlushPromise> mFlushPromise;
nsCString mHardwareAcceleratedReason;
nsCString mDescription;
bool mInitialized = false;
bool mIsHardwareAccelerated = false;
MediaDataDecoder::ConversionRequired mConversion =
MediaDataDecoder::ConversionRequired::kNeedNone;
};
} // namespace mozilla
#endif // include_dom_media_ipc_RemoteDecoderChild_h