2016-09-21 12:25:41 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=99: */
|
|
|
|
/* 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_ipc_VideoDecoderChild_h
|
|
|
|
#define include_dom_ipc_VideoDecoderChild_h
|
|
|
|
|
2017-09-13 10:37:24 +03:00
|
|
|
#include "MediaResult.h"
|
2016-09-21 12:25:41 +03:00
|
|
|
#include "PlatformDecoderModule.h"
|
2017-01-26 15:56:46 +03:00
|
|
|
#include "mozilla/dom/PVideoDecoderChild.h"
|
2016-09-21 12:25:41 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
|
|
|
class RemoteVideoDecoder;
|
|
|
|
class RemoteDecoderModule;
|
2016-11-02 23:55:07 +03:00
|
|
|
class VideoDecoderManagerChild;
|
2016-09-21 12:25:41 +03:00
|
|
|
|
|
|
|
class VideoDecoderChild final : public PVideoDecoderChild
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit VideoDecoderChild();
|
|
|
|
|
|
|
|
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(VideoDecoderChild)
|
|
|
|
|
|
|
|
// PVideoDecoderChild
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult RecvOutput(const VideoDataIPDL& aData) override;
|
|
|
|
mozilla::ipc::IPCResult RecvInputExhausted() override;
|
|
|
|
mozilla::ipc::IPCResult RecvDrainComplete() override;
|
|
|
|
mozilla::ipc::IPCResult RecvError(const nsresult& aError) override;
|
2017-09-01 19:22:55 +03:00
|
|
|
mozilla::ipc::IPCResult RecvInitComplete(const nsCString& aDecoderDescription,
|
|
|
|
const bool& aHardware,
|
2017-02-18 00:19:55 +03:00
|
|
|
const nsCString& aHardwareReason,
|
|
|
|
const uint32_t& aConversion) override;
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult RecvInitFailed(const nsresult& aReason) override;
|
2016-11-22 05:50:46 +03:00
|
|
|
mozilla::ipc::IPCResult RecvFlushComplete() override;
|
2016-09-21 12:25:41 +03:00
|
|
|
|
|
|
|
void ActorDestroy(ActorDestroyReason aWhy) override;
|
|
|
|
|
|
|
|
RefPtr<MediaDataDecoder::InitPromise> Init();
|
2017-01-26 15:56:46 +03:00
|
|
|
RefPtr<MediaDataDecoder::DecodePromise> Decode(MediaRawData* aSample);
|
|
|
|
RefPtr<MediaDataDecoder::DecodePromise> Drain();
|
|
|
|
RefPtr<MediaDataDecoder::FlushPromise> Flush();
|
2016-09-21 12:25:41 +03:00
|
|
|
void Shutdown();
|
2016-10-03 11:21:07 +03:00
|
|
|
bool IsHardwareAccelerated(nsACString& aFailureReason) const;
|
2017-09-01 19:22:55 +03:00
|
|
|
nsCString GetDescriptionName() const;
|
2016-10-03 11:20:54 +03:00
|
|
|
void SetSeekThreshold(const media::TimeUnit& aTime);
|
2017-02-18 00:19:55 +03:00
|
|
|
MediaDataDecoder::ConversionRequired NeedsConversion() const;
|
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,
|
2017-09-12 19:29:40 +03:00
|
|
|
float aFramerate,
|
2017-09-13 10:37:24 +03:00
|
|
|
const layers::TextureFactoryIdentifier& aIdentifier);
|
2016-09-21 12:25:41 +03:00
|
|
|
void DestroyIPDL();
|
|
|
|
|
|
|
|
// 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;
|
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;
|
2016-09-21 12:25:41 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // include_dom_ipc_VideoDecoderChild_h
|