2018-11-30 22:52:05 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2018-11-30 18:39:55 +03:00
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2016-09-21 12:25:41 +03:00
|
|
|
/* 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/. */
|
2018-12-22 01:34:57 +03:00
|
|
|
#ifndef include_ipc_VideoDecoderChild_h
|
|
|
|
#define include_ipc_VideoDecoderChild_h
|
2016-09-21 12:25:41 +03:00
|
|
|
|
2017-09-13 10:37:24 +03:00
|
|
|
#include "MediaResult.h"
|
2016-09-21 12:25:41 +03:00
|
|
|
#include "PlatformDecoderModule.h"
|
2018-12-22 01:34:57 +03:00
|
|
|
#include "mozilla/PVideoDecoderChild.h"
|
2018-11-14 05:45:39 +03:00
|
|
|
#include "IRemoteDecoderChild.h"
|
2016-09-21 12:25:41 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
class RemoteVideoDecoder;
|
|
|
|
class RemoteDecoderModule;
|
2016-11-02 23:55:07 +03:00
|
|
|
class VideoDecoderManagerChild;
|
2019-02-13 17:11:45 +03:00
|
|
|
using mozilla::ipc::IPCResult;
|
2016-09-21 12:25:41 +03:00
|
|
|
|
|
|
|
class VideoDecoderChild final : public PVideoDecoderChild,
|
2018-11-14 05:45:39 +03:00
|
|
|
public IRemoteDecoderChild {
|
2019-02-13 17:11:45 +03:00
|
|
|
friend class PVideoDecoderChild;
|
|
|
|
|
2016-09-21 12:25:41 +03:00
|
|
|
public:
|
|
|
|
explicit VideoDecoderChild();
|
|
|
|
|
|
|
|
// PVideoDecoderChild
|
2019-02-13 17:11:45 +03:00
|
|
|
IPCResult RecvOutput(const VideoDataIPDL& aData);
|
|
|
|
IPCResult RecvInputExhausted();
|
|
|
|
IPCResult RecvDrainComplete();
|
|
|
|
IPCResult RecvError(const nsresult& aError);
|
|
|
|
IPCResult RecvInitComplete(const nsCString& aDecoderDescription,
|
|
|
|
const bool& aHardware,
|
|
|
|
const nsCString& aHardwareReason,
|
|
|
|
const uint32_t& aConversion);
|
|
|
|
IPCResult RecvInitFailed(const nsresult& aReason);
|
|
|
|
IPCResult RecvFlushComplete();
|
2019-05-09 19:38:54 +03:00
|
|
|
IPCResult RecvShutdownComplete();
|
2016-09-21 12:25:41 +03:00
|
|
|
|
|
|
|
void ActorDestroy(ActorDestroyReason aWhy) override;
|
|
|
|
|
2018-11-14 05:45:39 +03:00
|
|
|
RefPtr<MediaDataDecoder::InitPromise> Init() override;
|
|
|
|
RefPtr<MediaDataDecoder::DecodePromise> Decode(
|
|
|
|
MediaRawData* aSample) override;
|
|
|
|
RefPtr<MediaDataDecoder::DecodePromise> Drain() override;
|
|
|
|
RefPtr<MediaDataDecoder::FlushPromise> Flush() override;
|
2019-05-09 19:38:54 +03:00
|
|
|
RefPtr<ShutdownPromise> Shutdown() override;
|
2018-11-14 05:45:39 +03:00
|
|
|
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;
|
2016-09-21 12:25:41 +03:00
|
|
|
|
2016-09-27 15:02:43 +03:00
|
|
|
MOZ_IS_CLASS_INIT
|
2017-09-13 10:37:24 +03:00
|
|
|
MediaResult InitIPDL(const VideoInfo& aVideoInfo, float aFramerate,
|
2018-10-09 19:59:24 +03:00
|
|
|
const CreateDecoderParams::OptionSet& aOptions,
|
2017-09-13 10:37:24 +03:00
|
|
|
const layers::TextureFactoryIdentifier& aIdentifier);
|
2016-09-21 12:25:41 +03:00
|
|
|
|
|
|
|
// Called from IPDL when our actor has been destroyed
|
|
|
|
void IPDLActorDestroyed();
|
|
|
|
|
2016-11-02 23:55:07 +03:00
|
|
|
VideoDecoderManagerChild* GetManager();
|
|
|
|
|
2016-09-21 12:25:41 +03:00
|
|
|
private:
|
|
|
|
~VideoDecoderChild();
|
|
|
|
|
2017-02-18 00:19:55 +03:00
|
|
|
void AssertOnManagerThread() const;
|
2016-09-21 12:25:41 +03:00
|
|
|
|
|
|
|
RefPtr<VideoDecoderChild> mIPDLSelfRef;
|
|
|
|
RefPtr<nsIThread> mThread;
|
|
|
|
|
|
|
|
MozPromiseHolder<MediaDataDecoder::InitPromise> mInitPromise;
|
2017-01-26 15:56:46 +03:00
|
|
|
MozPromiseHolder<MediaDataDecoder::DecodePromise> mDecodePromise;
|
|
|
|
MozPromiseHolder<MediaDataDecoder::DecodePromise> mDrainPromise;
|
|
|
|
MozPromiseHolder<MediaDataDecoder::FlushPromise> mFlushPromise;
|
2019-05-09 19:38:54 +03:00
|
|
|
MozPromiseHolder<ShutdownPromise> mShutdownPromise;
|
2016-11-22 05:50:46 +03:00
|
|
|
|
2016-10-03 11:21:07 +03:00
|
|
|
nsCString mHardwareAcceleratedReason;
|
2017-09-01 19:22:55 +03:00
|
|
|
nsCString mDescription;
|
2016-09-21 12:25:41 +03:00
|
|
|
bool mCanSend;
|
2016-10-03 11:20:35 +03:00
|
|
|
bool mInitialized;
|
2017-09-01 23:51:20 +03:00
|
|
|
bool mIsHardwareAccelerated;
|
|
|
|
MediaDataDecoder::ConversionRequired mConversion;
|
2017-02-18 00:19:55 +03:00
|
|
|
|
2017-01-26 15:56:46 +03:00
|
|
|
// Set to true if the actor got destroyed and we haven't yet notified the
|
|
|
|
// caller.
|
|
|
|
bool mNeedNewDecoder;
|
|
|
|
MediaDataDecoder::DecodedData mDecodedData;
|
2017-08-29 10:19:05 +03:00
|
|
|
|
2017-09-01 19:22:55 +03:00
|
|
|
nsCString mBlacklistedD3D11Driver;
|
2017-08-29 10:19:05 +03:00
|
|
|
nsCString mBlacklistedD3D9Driver;
|
2017-08-31 12:21:28 +03:00
|
|
|
TimeStamp mGPUCrashTime;
|
2019-05-09 19:38:54 +03:00
|
|
|
// Keep this instance alive during SendShutdown RecvShutdownComplete
|
|
|
|
// handshake.
|
|
|
|
RefPtr<VideoDecoderChild> mShutdownSelfRef;
|
2016-09-21 12:25:41 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2018-12-22 01:34:57 +03:00
|
|
|
#endif // include_ipc_VideoDecoderChild_h
|