webrtc/modules/video_coding/fec_controller_default.h
Philipp Hancke a49e334141 IWYU modules/video_coding
using
  find modules/video_coding/ -name "*.h" -o -name "*.cc" | grep -v android | xargs tools_webrtc/iwyu/apply-include-cleaner
followed by
  tools_webrtc/gn_check_autofix.py -C out/Default/
and git cl format

H264 changes led to link failures so were reverted.

Manual changes required:
* added I420Buffer to test/testsupport/frame_reader.h
* modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc -- added VP8 constants
* modules/video_coding/codecs/vp9/test/vp9_impl_unittest.cc -- added uncompressed header parser
* modules/video_coding/codecs/vp9/libvpx_vp9_decoder.cc -- added vpx_encoder for VPX_DL_REALTIME
* modules/video_coding/video_receiver2_unittest.cc -- added video_coding_defines.h
* modules/video_coding/generic_decoder.cc -- same
* modules/video_coding/generic_decoder_unittest.cc -- same
* modules/video_coding/deprecated/jitter_buffer_unittest.cc -- added video_coding/encoded_frame.h
* media/engine/simulcast_encoder_adapter_unittest.cc -- added video_error_codes
* modules/video_coding/codecs/vp9/libvpx_vp9_decoder.cc -- same
* modules/video_coding/video_receiver2_unittest.cc -- same
* rtc_tools/video_replay.cc -- same
* test/video_codec_tester_unittest.cc -- same
* rtc_tools/video_encoder/video_encoder.cc -- same
* modules/video_coding/codecs/vp9/vp9_frame_buffer_pool.h -- moved around includes
* rtc_tools/DEPS: allowed include from video_coding:video_codec_interface
* modules/video_coding/codecs/av1/libaom_av1_encoder.cc -- expand full aom path

Additional changes resulting from moving VP9 defines and feedback.

BUG=webrtc:42226242

Change-Id: If7040e1cab93cf587f25ee8492604a7f7af9a573
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/381860
Commit-Queue: Philipp Hancke <phancke@meta.com>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#44345}
2025-04-09 23:33:14 -07:00

71 lines
2.5 KiB
C++

/*
* Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef MODULES_VIDEO_CODING_FEC_CONTROLLER_DEFAULT_H_
#define MODULES_VIDEO_CODING_FEC_CONTROLLER_DEFAULT_H_
#include <stddef.h>
#include <stdint.h>
#include <memory>
#include <vector>
#include "api/environment/environment.h"
#include "api/fec_controller.h"
#include "api/video/video_frame_type.h"
#include "modules/video_coding/media_opt_util.h"
#include "rtc_base/synchronization/mutex.h"
#include "rtc_base/thread_annotations.h"
namespace webrtc {
class FecControllerDefault : public FecController {
public:
FecControllerDefault(const Environment& env,
VCMProtectionCallback* protection_callback);
explicit FecControllerDefault(const Environment& env);
FecControllerDefault(const FecControllerDefault&) = delete;
FecControllerDefault& operator=(const FecControllerDefault&) = delete;
~FecControllerDefault() override;
void SetProtectionCallback(
VCMProtectionCallback* protection_callback) override;
void SetProtectionMethod(bool enable_fec, bool enable_nack) override;
void SetEncodingData(size_t width,
size_t height,
size_t num_temporal_layers,
size_t max_payload_size) override;
uint32_t UpdateFecRates(uint32_t estimated_bitrate_bps,
int actual_framerate_fps,
uint8_t fraction_lost,
std::vector<bool> loss_mask_vector,
int64_t round_trip_time_ms) override;
void UpdateWithEncodedData(size_t encoded_image_length,
VideoFrameType encoded_image_frametype) override;
bool UseLossVectorMask() override;
float GetProtectionOverheadRateThreshold();
private:
enum { kBitrateAverageWinMs = 1000 };
const Environment env_;
VCMProtectionCallback* protection_callback_;
Mutex mutex_;
std::unique_ptr<media_optimization::VCMLossProtectionLogic> loss_prot_logic_
RTC_GUARDED_BY(mutex_);
size_t max_payload_size_ RTC_GUARDED_BY(mutex_);
const float overhead_threshold_;
};
} // namespace webrtc
#endif // MODULES_VIDEO_CODING_FEC_CONTROLLER_DEFAULT_H_