tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

RemoteVideoDecoder.h (3050B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 #ifndef include_dom_media_ipc_RemoteVideoDecoderChild_h
      7 #define include_dom_media_ipc_RemoteVideoDecoderChild_h
      8 #include "RemoteDecoderChild.h"
      9 #include "RemoteDecoderParent.h"
     10 #include "RemoteMediaManagerChild.h"
     11 
     12 namespace mozilla::layers {
     13 class BufferRecycleBin;
     14 }  // namespace mozilla::layers
     15 
     16 namespace mozilla {
     17 
     18 class KnowsCompositorVideo : public layers::KnowsCompositor {
     19 public:
     20  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(KnowsCompositorVideo, override)
     21 
     22  layers::TextureForwarder* GetTextureForwarder() override;
     23  layers::LayersIPCActor* GetLayersIPCActor() override;
     24 
     25  static already_AddRefed<KnowsCompositorVideo> TryCreateForIdentifier(
     26      const layers::TextureFactoryIdentifier& aIdentifier);
     27 
     28 private:
     29  KnowsCompositorVideo() = default;
     30  virtual ~KnowsCompositorVideo() = default;
     31 };
     32 
     33 using mozilla::ipc::IPCResult;
     34 
     35 class RemoteVideoDecoderChild : public RemoteDecoderChild {
     36 public:
     37  explicit RemoteVideoDecoderChild(RemoteMediaIn aLocation);
     38 
     39  MOZ_IS_CLASS_INIT MediaResult
     40  InitIPDL(const VideoInfo& aVideoInfo, float aFramerate,
     41           const CreateDecoderParams::OptionSet& aOptions,
     42           mozilla::Maybe<layers::TextureFactoryIdentifier> aIdentifier,
     43           const Maybe<uint64_t>& aMediaEngineId,
     44           const Maybe<TrackingId>& aTrackingId, PRemoteCDMActor* aCDM);
     45 
     46  MediaResult ProcessOutput(DecodedOutputIPDL&& aDecodedData) override;
     47 
     48 private:
     49  RefPtr<mozilla::layers::BufferRecycleBin> mBufferRecycleBin;
     50 };
     51 
     52 class RemoteVideoDecoderParent final : public RemoteDecoderParent {
     53 public:
     54  RemoteVideoDecoderParent(
     55      RemoteMediaManagerParent* aParent, const VideoInfo& aVideoInfo,
     56      float aFramerate, const CreateDecoderParams::OptionSet& aOptions,
     57      const Maybe<layers::TextureFactoryIdentifier>& aIdentifier,
     58      nsISerialEventTarget* aManagerThread, TaskQueue* aDecodeTaskQueue,
     59      const Maybe<uint64_t>& aMediaEngineId, Maybe<TrackingId> aTrackingId,
     60      RemoteCDMParent* aCDM);
     61 
     62 protected:
     63  IPCResult RecvConstruct(ConstructResolver&& aResolver) override;
     64 
     65  MediaResult ProcessDecodedData(MediaDataDecoder::DecodedData&& aData,
     66                                 DecodedOutputIPDL& aDecodedData) override;
     67 
     68 private:
     69  // Can only be accessed from the manager thread
     70  // Note: we can't keep a reference to the original VideoInfo here
     71  // because unlike in typical MediaDataDecoder situations, we're being
     72  // passed a deserialized VideoInfo from RecvPRemoteDecoderConstructor
     73  // which is destroyed when RecvPRemoteDecoderConstructor returns.
     74  const VideoInfo mVideoInfo;
     75  const float mFramerate;
     76  RefPtr<KnowsCompositorVideo> mKnowsCompositor;
     77 };
     78 
     79 }  // namespace mozilla
     80 
     81 #endif  // include_dom_media_ipc_RemoteVideoDecoderChild_h