tor-browser

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

video_receiver2.h (2624B)


      1 /*
      2 *  Copyright (c) 2019 The WebRTC project authors. All Rights Reserved.
      3 *
      4 *  Use of this source code is governed by a BSD-style license
      5 *  that can be found in the LICENSE file in the root of the source
      6 *  tree. An additional intellectual property rights grant can be found
      7 *  in the file PATENTS.  All contributing project authors may
      8 *  be found in the AUTHORS file in the root of the source tree.
      9 */
     10 
     11 #ifndef MODULES_VIDEO_CODING_VIDEO_RECEIVER2_H_
     12 #define MODULES_VIDEO_CODING_VIDEO_RECEIVER2_H_
     13 
     14 #include <cstdint>
     15 #include <memory>
     16 
     17 #include "api/field_trials_view.h"
     18 #include "api/sequence_checker.h"
     19 #include "api/video/encoded_frame.h"
     20 #include "api/video_codecs/video_decoder.h"
     21 #include "common_video/include/corruption_score_calculator.h"
     22 #include "modules/video_coding/decoder_database.h"
     23 #include "modules/video_coding/generic_decoder.h"
     24 #include "modules/video_coding/timing/timing.h"
     25 #include "rtc_base/system/no_unique_address.h"
     26 #include "system_wrappers/include/clock.h"
     27 
     28 namespace webrtc {
     29 
     30 // This class is a copy of vcm::VideoReceiver, trimmed down to what's used by
     31 // VideoReceive stream, with the aim to incrementally trim it down further and
     32 // ultimately delete it. It's difficult to do this incrementally with the
     33 // original VideoReceiver class, since it is used by the legacy
     34 // VideoCodingModule api.
     35 class VideoReceiver2 {
     36 public:
     37  VideoReceiver2(Clock* clock,
     38                 VCMTiming* timing,
     39                 const FieldTrialsView& field_trials,
     40                 CorruptionScoreCalculator* corruption_score_calculator);
     41  ~VideoReceiver2();
     42 
     43  void RegisterReceiveCodec(uint8_t payload_type,
     44                            const VideoDecoder::Settings& decoder_settings);
     45  void DeregisterReceiveCodec(uint8_t payload_type);
     46  void DeregisterReceiveCodecs();
     47 
     48  void RegisterExternalDecoder(std::unique_ptr<VideoDecoder> decoder,
     49                               uint8_t payload_type);
     50 
     51  bool IsExternalDecoderRegistered(uint8_t payload_type) const;
     52  int32_t RegisterReceiveCallback(VCMReceiveCallback* receive_callback);
     53 
     54  int32_t Decode(const EncodedFrame* frame);
     55 
     56 private:
     57  RTC_NO_UNIQUE_ADDRESS SequenceChecker construction_sequence_checker_;
     58  RTC_NO_UNIQUE_ADDRESS SequenceChecker decoder_sequence_checker_;
     59  Clock* const clock_;
     60  VCMDecodedFrameCallback decoded_frame_callback_;
     61  // Callbacks are set before the decoder thread starts.
     62  // Once the decoder thread has been started, usage of `_codecDataBase` moves
     63  // over to the decoder thread.
     64  VCMDecoderDatabase codec_database_;
     65 };
     66 
     67 }  // namespace webrtc
     68 
     69 #endif  // MODULES_VIDEO_CODING_VIDEO_RECEIVER2_H_