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_VideoDecoderParent_h
|
|
|
|
#define include_ipc_VideoDecoderParent_h
|
2016-09-21 12:25:41 +03:00
|
|
|
|
2017-01-26 15:56:46 +03:00
|
|
|
#include "ImageContainer.h"
|
|
|
|
#include "MediaData.h"
|
|
|
|
#include "PlatformDecoderModule.h"
|
|
|
|
#include "VideoDecoderManagerParent.h"
|
|
|
|
#include "mozilla/MozPromise.h"
|
2018-12-22 01:34:57 +03:00
|
|
|
#include "mozilla/PVideoDecoderParent.h"
|
2016-10-07 11:13:33 +03:00
|
|
|
#include "mozilla/layers/TextureForwarder.h"
|
2016-09-21 12:25:41 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
2016-10-07 11:13:33 +03:00
|
|
|
class KnowsCompositorVideo;
|
|
|
|
|
2017-01-26 15:56:46 +03:00
|
|
|
class VideoDecoderParent final : public PVideoDecoderParent {
|
2016-09-21 12:25:41 +03:00
|
|
|
public:
|
|
|
|
// We refcount this class since the task queue can have runnables
|
|
|
|
// that reference us.
|
|
|
|
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(VideoDecoderParent)
|
|
|
|
|
|
|
|
VideoDecoderParent(VideoDecoderManagerParent* aParent,
|
2016-11-22 05:44:38 +03:00
|
|
|
const VideoInfo& aVideoInfo, float aFramerate,
|
2018-10-09 19:59:24 +03:00
|
|
|
const CreateDecoderParams::OptionSet& aOptions,
|
2016-11-22 05:44:38 +03:00
|
|
|
const layers::TextureFactoryIdentifier& aIdentifier,
|
2016-09-21 12:25:41 +03:00
|
|
|
TaskQueue* aManagerTaskQueue, TaskQueue* aDecodeTaskQueue,
|
2017-09-13 10:37:24 +03:00
|
|
|
bool* aSuccess, nsCString* aErrorDescription);
|
2016-09-21 12:25:41 +03:00
|
|
|
|
|
|
|
void Destroy();
|
|
|
|
|
|
|
|
// PVideoDecoderParent
|
2016-11-22 05:44:38 +03:00
|
|
|
mozilla::ipc::IPCResult RecvInit() override;
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult RecvInput(const MediaRawDataIPDL& aData) override;
|
|
|
|
mozilla::ipc::IPCResult RecvFlush() override;
|
|
|
|
mozilla::ipc::IPCResult RecvDrain() override;
|
|
|
|
mozilla::ipc::IPCResult RecvShutdown() override;
|
|
|
|
mozilla::ipc::IPCResult RecvSetSeekThreshold(const int64_t& aTime) override;
|
2016-09-21 12:25:41 +03:00
|
|
|
|
|
|
|
void ActorDestroy(ActorDestroyReason aWhy) override;
|
|
|
|
|
|
|
|
private:
|
2016-11-22 11:48:21 +03:00
|
|
|
bool OnManagerThread();
|
2017-01-26 15:56:46 +03:00
|
|
|
void Error(const MediaResult& aError);
|
2016-11-22 11:48:21 +03:00
|
|
|
|
2016-09-21 12:25:41 +03:00
|
|
|
~VideoDecoderParent();
|
2018-11-09 18:45:31 +03:00
|
|
|
void ProcessDecodedData(MediaDataDecoder::DecodedData&& aData);
|
2016-09-21 12:25:41 +03:00
|
|
|
|
|
|
|
RefPtr<VideoDecoderManagerParent> mParent;
|
|
|
|
RefPtr<VideoDecoderParent> mIPDLSelfRef;
|
|
|
|
RefPtr<TaskQueue> mManagerTaskQueue;
|
|
|
|
RefPtr<TaskQueue> mDecodeTaskQueue;
|
|
|
|
RefPtr<MediaDataDecoder> mDecoder;
|
2016-10-07 11:13:33 +03:00
|
|
|
RefPtr<KnowsCompositorVideo> mKnowsCompositor;
|
2016-09-21 12:25:41 +03:00
|
|
|
|
|
|
|
// Can only be accessed from the manager thread
|
|
|
|
bool mDestroyed;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2018-12-22 01:34:57 +03:00
|
|
|
#endif // include_ipc_VideoDecoderParent_h
|