mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-17 23:57:59 +01:00
Remove frame rate and target bitrate from ProtectionBitrateCalculator::SetEncodingData
These arguments are not really known when calling SetEncodingData. They are still provided as argument to ProtectionBitrateCalculator::SetTargetRates though. This cl is broken out from https://codereview.webrtc.org/2060403002/ BUG=webrtc:5687 Review-Url: https://codereview.webrtc.org/2121983002 Cr-Commit-Position: refs/heads/master@{#13429}
This commit is contained in:
parent
5e12d36ba7
commit
c2c24f795e
6 changed files with 11 additions and 22 deletions
|
@ -599,7 +599,7 @@ void VCMLossProtectionLogic::UpdateKeyFrameSize(float keyFrameSize) {
|
|||
_keyFrameSize = keyFrameSize;
|
||||
}
|
||||
|
||||
void VCMLossProtectionLogic::UpdateFrameSize(uint16_t width, uint16_t height) {
|
||||
void VCMLossProtectionLogic::UpdateFrameSize(size_t width, size_t height) {
|
||||
_codecWidth = width;
|
||||
_codecHeight = height;
|
||||
}
|
||||
|
|
|
@ -282,7 +282,7 @@ class VCMLossProtectionLogic {
|
|||
// Input:
|
||||
// - width : The codec frame width.
|
||||
// - height : The codec frame height.
|
||||
void UpdateFrameSize(uint16_t width, uint16_t height);
|
||||
void UpdateFrameSize(size_t width, size_t height);
|
||||
|
||||
// Update the number of active layers
|
||||
//
|
||||
|
@ -350,8 +350,8 @@ class VCMLossProtectionLogic {
|
|||
uint8_t _shortMaxLossPr255;
|
||||
rtc::ExpFilter _packetsPerFrame;
|
||||
rtc::ExpFilter _packetsPerFrameKey;
|
||||
uint16_t _codecWidth;
|
||||
uint16_t _codecHeight;
|
||||
size_t _codecWidth;
|
||||
size_t _codecHeight;
|
||||
int _numLayers;
|
||||
};
|
||||
|
||||
|
|
|
@ -39,18 +39,11 @@ ProtectionBitrateCalculator::~ProtectionBitrateCalculator(void) {
|
|||
loss_prot_logic_->Release();
|
||||
}
|
||||
|
||||
void ProtectionBitrateCalculator::SetEncodingData(uint32_t target_bitrate,
|
||||
uint16_t width,
|
||||
uint16_t height,
|
||||
uint32_t frame_rate,
|
||||
void ProtectionBitrateCalculator::SetEncodingData(size_t width,
|
||||
size_t height,
|
||||
size_t num_temporal_layers,
|
||||
size_t max_payload_size) {
|
||||
CritScope lock(&crit_sect_);
|
||||
// Everything codec specific should be reset here since this means the codec
|
||||
// has changed.
|
||||
float target_bitrate_kbps = static_cast<float>(target_bitrate) / 1000.0f;
|
||||
loss_prot_logic_->UpdateBitRate(target_bitrate_kbps);
|
||||
loss_prot_logic_->UpdateFrameRate(static_cast<float>(frame_rate));
|
||||
loss_prot_logic_->UpdateFrameSize(width, height);
|
||||
loss_prot_logic_->UpdateNumLayers(num_temporal_layers);
|
||||
max_payload_size_ = max_payload_size;
|
||||
|
|
|
@ -43,10 +43,8 @@ class ProtectionBitrateCalculator {
|
|||
void SetProtectionMethod(bool enable_fec, bool enable_nack);
|
||||
|
||||
// Informs media optimization of initial encoding state.
|
||||
void SetEncodingData(uint32_t estimated_bitrate_bps,
|
||||
uint16_t width,
|
||||
uint16_t height,
|
||||
uint32_t frame_rate,
|
||||
void SetEncodingData(size_t width,
|
||||
size_t height,
|
||||
size_t num_temporal_layers,
|
||||
size_t max_payload_size);
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ TEST_F(ProtectionBitrateCalculatorTest, ProtectsUsingFecBitrate) {
|
|||
static const uint32_t kMaxBitrateBps = 130000;
|
||||
|
||||
media_opt_.SetProtectionMethod(true /*enable_fec*/, false /* enable_nack */);
|
||||
media_opt_.SetEncodingData(kCodecBitrateBps, 640, 480, 30, 1, 1000);
|
||||
media_opt_.SetEncodingData(640, 480, 1, 1000);
|
||||
|
||||
// Using 10% of codec bitrate for FEC.
|
||||
protection_callback_.fec_rate_bps_ = kCodecBitrateBps / 10;
|
||||
|
@ -73,7 +73,7 @@ TEST_F(ProtectionBitrateCalculatorTest, ProtectsUsingNackBitrate) {
|
|||
static const uint32_t kMaxBitrateBps = 130000;
|
||||
|
||||
media_opt_.SetProtectionMethod(false /*enable_fec*/, true /* enable_nack */);
|
||||
media_opt_.SetEncodingData(kCodecBitrateBps, 640, 480, 30, 1, 1000);
|
||||
media_opt_.SetEncodingData(640, 480, 1, 1000);
|
||||
|
||||
uint32_t target_bitrate = media_opt_.SetTargetRates(kMaxBitrateBps, 30, 0, 0);
|
||||
|
||||
|
@ -90,7 +90,7 @@ TEST_F(ProtectionBitrateCalculatorTest, NoProtection) {
|
|||
static const uint32_t kMaxBitrateBps = 130000;
|
||||
|
||||
media_opt_.SetProtectionMethod(false /*enable_fec*/, false /* enable_nack */);
|
||||
media_opt_.SetEncodingData(kCodecBitrateBps, 640, 480, 30, 1, 1000);
|
||||
media_opt_.SetEncodingData(640, 480, 1, 1000);
|
||||
|
||||
uint32_t target_bitrate =
|
||||
media_opt_.SetTargetRates(kMaxBitrateBps, 30, 128, 100);
|
||||
|
|
|
@ -617,10 +617,8 @@ void VideoSendStream::EncoderProcess() {
|
|||
.temporal_layer_thresholds_bps.size() +
|
||||
1;
|
||||
protection_bitrate_calculator_.SetEncodingData(
|
||||
current_encoder_settings_->video_codec.startBitrate * 1000,
|
||||
current_encoder_settings_->video_codec.width,
|
||||
current_encoder_settings_->video_codec.height,
|
||||
current_encoder_settings_->video_codec.maxFramerate,
|
||||
number_of_temporal_layers, payload_router_.MaxPayloadLength());
|
||||
|
||||
// We might've gotten new settings while configuring the encoder settings,
|
||||
|
|
Loading…
Reference in a new issue