2019-02-14 22:08:21 +03:00
|
|
|
/* -*- 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_RemoteVideoDecoderChild_h
|
|
|
|
#define include_dom_media_ipc_RemoteVideoDecoderChild_h
|
|
|
|
#include "RemoteDecoderChild.h"
|
2020-10-21 02:23:58 +03:00
|
|
|
#include "RemoteDecoderManagerChild.h"
|
2019-02-14 22:08:21 +03:00
|
|
|
#include "RemoteDecoderParent.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
class BufferRecycleBin;
|
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
2020-10-21 02:26:27 +03:00
|
|
|
class KnowsCompositorVideo : public layers::KnowsCompositor {
|
|
|
|
public:
|
|
|
|
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(KnowsCompositorVideo, override)
|
|
|
|
|
|
|
|
layers::TextureForwarder* GetTextureForwarder() override;
|
|
|
|
layers::LayersIPCActor* GetLayersIPCActor() override;
|
|
|
|
|
|
|
|
static already_AddRefed<KnowsCompositorVideo> TryCreateForIdentifier(
|
|
|
|
const layers::TextureFactoryIdentifier& aIdentifier);
|
|
|
|
|
|
|
|
private:
|
|
|
|
KnowsCompositorVideo() = default;
|
|
|
|
virtual ~KnowsCompositorVideo() = default;
|
|
|
|
};
|
2020-10-21 02:23:58 +03:00
|
|
|
|
2019-02-14 22:08:21 +03:00
|
|
|
using mozilla::ipc::IPCResult;
|
|
|
|
|
2019-06-11 05:01:51 +03:00
|
|
|
class RemoteVideoDecoderChild : public RemoteDecoderChild {
|
2019-02-14 22:08:21 +03:00
|
|
|
public:
|
2020-10-21 02:23:58 +03:00
|
|
|
explicit RemoteVideoDecoderChild(RemoteDecodeIn aLocation);
|
2019-02-14 22:08:21 +03:00
|
|
|
|
2020-10-21 02:23:58 +03:00
|
|
|
MOZ_IS_CLASS_INIT MediaResult
|
|
|
|
InitIPDL(const VideoInfo& aVideoInfo, float aFramerate,
|
|
|
|
const CreateDecoderParams::OptionSet& aOptions,
|
2020-11-17 01:41:08 +03:00
|
|
|
mozilla::Maybe<layers::TextureFactoryIdentifier> aIdentifier);
|
2019-02-14 22:08:21 +03:00
|
|
|
|
2020-09-17 09:21:44 +03:00
|
|
|
MediaResult ProcessOutput(DecodedOutputIPDL&& aDecodedData) override;
|
2019-02-14 22:08:21 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
RefPtr<mozilla::layers::BufferRecycleBin> mBufferRecycleBin;
|
2019-06-11 05:01:51 +03:00
|
|
|
};
|
|
|
|
|
2019-02-14 22:08:21 +03:00
|
|
|
class RemoteVideoDecoderParent final : public RemoteDecoderParent {
|
|
|
|
public:
|
2019-06-28 09:32:16 +03:00
|
|
|
RemoteVideoDecoderParent(
|
|
|
|
RemoteDecoderManagerParent* aParent, const VideoInfo& aVideoInfo,
|
|
|
|
float aFramerate, const CreateDecoderParams::OptionSet& aOptions,
|
|
|
|
const Maybe<layers::TextureFactoryIdentifier>& aIdentifier,
|
2020-11-13 10:46:44 +03:00
|
|
|
nsISerialEventTarget* aManagerThread, TaskQueue* aDecodeTaskQueue);
|
2019-02-14 22:08:21 +03:00
|
|
|
|
|
|
|
protected:
|
2020-11-13 10:46:44 +03:00
|
|
|
IPCResult RecvConstruct(ConstructResolver&& aResolver) override;
|
|
|
|
|
2020-09-29 08:02:40 +03:00
|
|
|
MediaResult ProcessDecodedData(MediaDataDecoder::DecodedData&& aData,
|
2019-09-28 15:17:44 +03:00
|
|
|
DecodedOutputIPDL& aDecodedData) override;
|
2019-02-14 22:08:21 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
// Can only be accessed from the manager thread
|
|
|
|
// Note: we can't keep a reference to the original VideoInfo here
|
|
|
|
// because unlike in typical MediaDataDecoder situations, we're being
|
|
|
|
// passed a deserialized VideoInfo from RecvPRemoteDecoderConstructor
|
|
|
|
// which is destroyed when RecvPRemoteDecoderConstructor returns.
|
|
|
|
const VideoInfo mVideoInfo;
|
2020-11-13 10:46:44 +03:00
|
|
|
const float mFramerate;
|
2019-06-11 05:01:51 +03:00
|
|
|
RefPtr<KnowsCompositorVideo> mKnowsCompositor;
|
2019-02-14 22:08:21 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // include_dom_media_ipc_RemoteVideoDecoderChild_h
|