Replace DataSize and DataRate factories with newer versions
This is search and replace change: find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/DataSize::Bytes<\(.*\)>()/DataSize::Bytes(\1)/g" find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/DataSize::bytes/DataSize::Bytes/g" find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/DataRate::BitsPerSec<\(.*\)>()/DataRate::BitsPerSec(\1)/g" find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/DataRate::BytesPerSec<\(.*\)>()/DataRate::BytesPerSec(\1)/g" find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/DataRate::KilobitsPerSec<\(.*\)>()/DataRate::KilobitsPerSec(\1)/g" find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/DataRate::bps/DataRate::BitsPerSec/g" find . -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/DataRate::kbps/DataRate::KilobitsPerSec/g" git cl format Bug: webrtc:9709 Change-Id: I65aaca69474ba038c1fe2dd8dc30d3f8e7b94c29 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/168647 Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/master@{#30545}
This commit is contained in:
committed by
Commit Bot
parent
701bd172d8
commit
cad3e0e2fa
@ -87,7 +87,7 @@ void SimulcastRateAllocator::DistributeAllocationToSimulcastLayers(
|
||||
DataRate left_in_stable_allocation = stable_bitrate;
|
||||
|
||||
if (codec_.maxBitrate) {
|
||||
DataRate max_rate = DataRate::kbps(codec_.maxBitrate);
|
||||
DataRate max_rate = DataRate::KilobitsPerSec(codec_.maxBitrate);
|
||||
left_in_total_allocation = std::min(left_in_total_allocation, max_rate);
|
||||
left_in_stable_allocation = std::min(left_in_stable_allocation, max_rate);
|
||||
}
|
||||
@ -97,7 +97,8 @@ void SimulcastRateAllocator::DistributeAllocationToSimulcastLayers(
|
||||
if (codec_.active) {
|
||||
allocated_bitrates->SetBitrate(
|
||||
0, 0,
|
||||
std::max(DataRate::kbps(codec_.minBitrate), left_in_total_allocation)
|
||||
std::max(DataRate::KilobitsPerSec(codec_.minBitrate),
|
||||
left_in_total_allocation)
|
||||
.bps());
|
||||
}
|
||||
return;
|
||||
@ -129,7 +130,7 @@ void SimulcastRateAllocator::DistributeAllocationToSimulcastLayers(
|
||||
// Always allocate enough bitrate for the minimum bitrate of the first
|
||||
// active layer. Suspending below min bitrate is controlled outside the
|
||||
// codec implementation and is not overridden by this.
|
||||
DataRate min_rate = DataRate::kbps(
|
||||
DataRate min_rate = DataRate::KilobitsPerSec(
|
||||
codec_.simulcastStream[layer_index[active_layer]].minBitrate);
|
||||
left_in_total_allocation = std::max(left_in_total_allocation, min_rate);
|
||||
left_in_stable_allocation = std::max(left_in_stable_allocation, min_rate);
|
||||
@ -157,8 +158,8 @@ void SimulcastRateAllocator::DistributeAllocationToSimulcastLayers(
|
||||
}
|
||||
// If we can't allocate to the current layer we can't allocate to higher
|
||||
// layers because they require a higher minimum bitrate.
|
||||
DataRate min_bitrate = DataRate::kbps(stream.minBitrate);
|
||||
DataRate target_bitrate = DataRate::kbps(stream.targetBitrate);
|
||||
DataRate min_bitrate = DataRate::KilobitsPerSec(stream.minBitrate);
|
||||
DataRate target_bitrate = DataRate::KilobitsPerSec(stream.targetBitrate);
|
||||
double hysteresis_factor =
|
||||
codec_.mode == VideoCodecMode::kRealtimeVideo
|
||||
? stable_rate_settings_.GetVideoHysteresisFactor()
|
||||
@ -193,11 +194,11 @@ void SimulcastRateAllocator::DistributeAllocationToSimulcastLayers(
|
||||
// better idea of possible performance implications.
|
||||
if (left_in_total_allocation > DataRate::Zero()) {
|
||||
const SimulcastStream& stream = codec_.simulcastStream[top_active_layer];
|
||||
DataRate initial_layer_rate =
|
||||
DataRate::bps(allocated_bitrates->GetSpatialLayerSum(top_active_layer));
|
||||
DataRate additional_allocation =
|
||||
std::min(left_in_total_allocation,
|
||||
DataRate::kbps(stream.maxBitrate) - initial_layer_rate);
|
||||
DataRate initial_layer_rate = DataRate::BitsPerSec(
|
||||
allocated_bitrates->GetSpatialLayerSum(top_active_layer));
|
||||
DataRate additional_allocation = std::min(
|
||||
left_in_total_allocation,
|
||||
DataRate::KilobitsPerSec(stream.maxBitrate) - initial_layer_rate);
|
||||
allocated_bitrates->SetBitrate(
|
||||
top_active_layer, 0,
|
||||
(initial_layer_rate + additional_allocation).bps());
|
||||
|
||||
Reference in New Issue
Block a user