Ying Wang | 3b790f3 | 2018-01-19 17:58:57 +0100 | [diff] [blame] | 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 <memory> |
| 15 | #include <vector> |
| 16 | #include "api/fec_controller.h" |
| 17 | #include "modules/include/module_common_types.h" |
| 18 | #include "modules/video_coding/media_opt_util.h" |
| 19 | #include "rtc_base/criticalsection.h" |
| 20 | #include "system_wrappers/include/clock.h" |
| 21 | |
| 22 | namespace webrtc { |
| 23 | |
| 24 | class FecControllerDefault : public FecController { |
| 25 | public: |
| 26 | FecControllerDefault(Clock* clock, |
| 27 | VCMProtectionCallback* protection_callback); |
| 28 | explicit FecControllerDefault(Clock* clock); |
Mirko Bonadei | 8fdcac3 | 2018-08-28 16:30:18 +0200 | [diff] [blame^] | 29 | ~FecControllerDefault() override; |
Ying Wang | 3b790f3 | 2018-01-19 17:58:57 +0100 | [diff] [blame] | 30 | void SetProtectionCallback( |
| 31 | VCMProtectionCallback* protection_callback) override; |
| 32 | void SetProtectionMethod(bool enable_fec, bool enable_nack) override; |
| 33 | void SetEncodingData(size_t width, |
| 34 | size_t height, |
| 35 | size_t num_temporal_layers, |
| 36 | size_t max_payload_size) override; |
| 37 | uint32_t UpdateFecRates(uint32_t estimated_bitrate_bps, |
| 38 | int actual_framerate_fps, |
| 39 | uint8_t fraction_lost, |
| 40 | std::vector<bool> loss_mask_vector, |
| 41 | int64_t round_trip_time_ms) override; |
Ying Wang | 0dd1b0a | 2018-02-20 12:50:27 +0100 | [diff] [blame] | 42 | void UpdateWithEncodedData(const size_t encoded_image_length, |
| 43 | const FrameType encoded_image_frametype) override; |
Mirko Bonadei | 8fdcac3 | 2018-08-28 16:30:18 +0200 | [diff] [blame^] | 44 | bool UseLossVectorMask() override; |
Ying Wang | 3b790f3 | 2018-01-19 17:58:57 +0100 | [diff] [blame] | 45 | |
| 46 | private: |
| 47 | enum { kBitrateAverageWinMs = 1000 }; |
| 48 | Clock* const clock_; |
| 49 | VCMProtectionCallback* protection_callback_; |
| 50 | rtc::CriticalSection crit_sect_; |
| 51 | std::unique_ptr<media_optimization::VCMLossProtectionLogic> loss_prot_logic_ |
| 52 | RTC_GUARDED_BY(crit_sect_); |
| 53 | size_t max_payload_size_ RTC_GUARDED_BY(crit_sect_); |
| 54 | RTC_DISALLOW_COPY_AND_ASSIGN(FecControllerDefault); |
| 55 | }; |
| 56 | |
| 57 | } // namespace webrtc |
| 58 | #endif // MODULES_VIDEO_CODING_FEC_CONTROLLER_DEFAULT_H_ |