tor-browser

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

fec_controller_default.h (2550B)


      1 /*
      2 *  Copyright (c) 2016 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_FEC_CONTROLLER_DEFAULT_H_
     12 #define MODULES_VIDEO_CODING_FEC_CONTROLLER_DEFAULT_H_
     13 
     14 #include <stddef.h>
     15 #include <stdint.h>
     16 
     17 #include <memory>
     18 #include <vector>
     19 
     20 #include "api/environment/environment.h"
     21 #include "api/fec_controller.h"
     22 #include "api/video/video_frame_type.h"
     23 #include "modules/video_coding/media_opt_util.h"
     24 #include "rtc_base/synchronization/mutex.h"
     25 #include "rtc_base/thread_annotations.h"
     26 
     27 namespace webrtc {
     28 
     29 class FecControllerDefault : public FecController {
     30 public:
     31  FecControllerDefault(const Environment& env,
     32                       VCMProtectionCallback* protection_callback);
     33  explicit FecControllerDefault(const Environment& env);
     34 
     35  FecControllerDefault(const FecControllerDefault&) = delete;
     36  FecControllerDefault& operator=(const FecControllerDefault&) = delete;
     37 
     38  ~FecControllerDefault() override;
     39 
     40  void SetProtectionCallback(
     41      VCMProtectionCallback* protection_callback) override;
     42  void SetProtectionMethod(bool enable_fec, bool enable_nack) override;
     43  void SetEncodingData(size_t width,
     44                       size_t height,
     45                       size_t num_temporal_layers,
     46                       size_t max_payload_size) override;
     47  uint32_t UpdateFecRates(uint32_t estimated_bitrate_bps,
     48                          int actual_framerate_fps,
     49                          uint8_t fraction_lost,
     50                          std::vector<bool> loss_mask_vector,
     51                          int64_t round_trip_time_ms) override;
     52  void UpdateWithEncodedData(size_t encoded_image_length,
     53                             VideoFrameType encoded_image_frametype) override;
     54  bool UseLossVectorMask() override;
     55  float GetProtectionOverheadRateThreshold();
     56 
     57 private:
     58  enum { kBitrateAverageWinMs = 1000 };
     59  const Environment env_;
     60  VCMProtectionCallback* protection_callback_;
     61  Mutex mutex_;
     62  std::unique_ptr<media_optimization::VCMLossProtectionLogic> loss_prot_logic_
     63      RTC_GUARDED_BY(mutex_);
     64  size_t max_payload_size_ RTC_GUARDED_BY(mutex_);
     65 
     66  const float overhead_threshold_;
     67 };
     68 
     69 }  // namespace webrtc
     70 #endif  // MODULES_VIDEO_CODING_FEC_CONTROLLER_DEFAULT_H_