tor-browser

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

WebrtcMediaDataDecoderCodec.h (2086B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
      3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 #ifndef WebrtcMediaDataDecoderCodec_h__
      6 #define WebrtcMediaDataDecoderCodec_h__
      7 
      8 #include "MediaConduitInterface.h"
      9 #include "MediaInfo.h"
     10 #include "MediaResult.h"
     11 #include "PlatformDecoderModule.h"
     12 #include "VideoConduit.h"
     13 #include "WebrtcImageBuffer.h"
     14 #include "common_video/include/video_frame_buffer.h"
     15 #include "modules/video_coding/include/video_codec_interface.h"
     16 
     17 namespace webrtc {
     18 class DecodedImageCallback;
     19 }
     20 namespace mozilla {
     21 namespace layers {
     22 class Image;
     23 class ImageContainer;
     24 }  // namespace layers
     25 
     26 class PDMFactory;
     27 class SharedThreadPool;
     28 class TaskQueue;
     29 
     30 class WebrtcMediaDataDecoder : public WebrtcVideoDecoder {
     31 public:
     32  WebrtcMediaDataDecoder(nsACString& aCodecMimeType, TrackingId aTrackingId);
     33 
     34  bool Configure(const webrtc::VideoDecoder::Settings& settings) override;
     35 
     36  int32_t Decode(const webrtc::EncodedImage& inputImage, bool missingFrames,
     37                 int64_t renderTimeMs = -1) override;
     38 
     39  int32_t RegisterDecodeCompleteCallback(
     40      webrtc::DecodedImageCallback* callback) override;
     41 
     42  int32_t Release() override;
     43 
     44 private:
     45  ~WebrtcMediaDataDecoder();
     46  void QueueFrame(MediaRawData* aFrame);
     47  bool OnTaskQueue() const;
     48  int32_t CreateDecoder();
     49 
     50  const RefPtr<SharedThreadPool> mThreadPool;
     51  const RefPtr<TaskQueue> mTaskQueue;
     52  const RefPtr<layers::ImageContainer> mImageContainer;
     53  const RefPtr<PDMFactory> mFactory;
     54  RefPtr<MediaDataDecoder> mDecoder;
     55  webrtc::DecodedImageCallback* mCallback = nullptr;
     56  VideoInfo mInfo;
     57  TrackInfo::TrackType mTrackType;
     58  bool mNeedKeyframe = true;
     59  MozPromiseRequestHolder<MediaDataDecoder::DecodePromise> mDecodeRequest;
     60 
     61  MediaResult mError = NS_OK;
     62  MediaDataDecoder::DecodedData mResults;
     63  const nsCString mCodecType;
     64  bool mDisabledHardwareAcceleration = false;
     65  const TrackingId mTrackingId;
     66 };
     67 
     68 }  // namespace mozilla
     69 
     70 #endif  // WebrtcMediaDataDecoderCodec_h__