Revert "Ensure that we always set values for min and max audio bitrate."
This reverts commit e47aee3b864fe5a4f964d405a7f6f3ac8c49f174. Reason for revert: Breaks downstream project Original change's description: > Ensure that we always set values for min and max audio bitrate. > > Use (in order from lowest to highest precedence): > -- fixed 32000bps > -- fixed target bitrate from codec > -- explicit values from the rtp encoding parameters > -- Final precedence is given to field trial values from > WebRTC-Audio-Allocation > > Bug: webrtc:10487 > Change-Id: I7e289f209a927785572058b6fbfdf60fa14edf05 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/126229 > Reviewed-by: Minyue Li <minyue@google.com> > Reviewed-by: Stefan Holmer <stefan@webrtc.org> > Reviewed-by: Sebastian Jansson <srte@webrtc.org> > Commit-Queue: Daniel Lee <dklee@google.com> > Cr-Commit-Position: refs/heads/master@{#27667} TBR=solenberg@webrtc.org,stefan@webrtc.org,srte@webrtc.org,crodbro@webrtc.org,minyue@webrtc.org,minyue@google.com,dklee@google.com Change-Id: Ie975cf40e65105d1e4cfab417b220b6bfc34592b No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:10487 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/133481 Reviewed-by: Åsa Persson <asapersson@webrtc.org> Commit-Queue: Daniel Lee <dklee@google.com> Cr-Commit-Position: refs/heads/master@{#27670}
This commit is contained in:
@ -12,6 +12,9 @@
|
||||
|
||||
namespace webrtc {
|
||||
namespace {
|
||||
// For SendSideBwe, Opus bitrate should be in the range between 6000 and 32000.
|
||||
const int kOpusMinBitrateBps = 6000;
|
||||
const int kOpusBitrateFbBps = 32000;
|
||||
// OverheadPerPacket = Ipv4(20B) + UDP(8B) + SRTP(10B) + RTP(12)
|
||||
constexpr int kOverheadPerPacket = 20 + 8 + 10 + 12;
|
||||
} // namespace
|
||||
@ -20,8 +23,8 @@ AudioAllocationSettings::AudioAllocationSettings()
|
||||
allocate_audio_without_feedback_("Enabled"),
|
||||
force_no_audio_feedback_("Enabled"),
|
||||
send_side_bwe_with_overhead_("Enabled"),
|
||||
min_bitrate_("min"),
|
||||
max_bitrate_("max"),
|
||||
default_min_bitrate_("min", DataRate::bps(kOpusMinBitrateBps)),
|
||||
default_max_bitrate_("max", DataRate::bps(kOpusBitrateFbBps)),
|
||||
priority_bitrate_("prio", DataRate::Zero()) {
|
||||
ParseFieldTrial({&audio_send_side_bwe_},
|
||||
field_trial::FindFullName("WebRTC-Audio-SendSideBwe"));
|
||||
@ -32,8 +35,9 @@ AudioAllocationSettings::AudioAllocationSettings()
|
||||
|
||||
ParseFieldTrial({&send_side_bwe_with_overhead_},
|
||||
field_trial::FindFullName("WebRTC-SendSideBwe-WithOverhead"));
|
||||
ParseFieldTrial({&min_bitrate_, &max_bitrate_, &priority_bitrate_},
|
||||
field_trial::FindFullName("WebRTC-Audio-Allocation"));
|
||||
ParseFieldTrial(
|
||||
{&default_min_bitrate_, &default_max_bitrate_, &priority_bitrate_},
|
||||
field_trial::FindFullName("WebRTC-Audio-Allocation"));
|
||||
|
||||
// TODO(mflodman): Keep testing this and set proper values.
|
||||
// Note: This is an early experiment currently only supported by Opus.
|
||||
@ -96,15 +100,25 @@ bool AudioAllocationSettings::IncludeAudioInAllocationOnReconfigure(
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AudioAllocationSettings::IncludeOverheadInAudioAllocation() const {
|
||||
return send_side_bwe_with_overhead_;
|
||||
int AudioAllocationSettings::MinBitrateBps() const {
|
||||
return default_min_bitrate_->bps() + min_overhead_bps_;
|
||||
}
|
||||
|
||||
absl::optional<DataRate> AudioAllocationSettings::MinBitrate() const {
|
||||
return min_bitrate_.GetOptional();
|
||||
}
|
||||
absl::optional<DataRate> AudioAllocationSettings::MaxBitrate() const {
|
||||
return max_bitrate_.GetOptional();
|
||||
int AudioAllocationSettings::MaxBitrateBps(
|
||||
absl::optional<int> rtp_parameter_max_bitrate_bps) const {
|
||||
// We assume that the max is a hard limit on the payload bitrate, so we add
|
||||
// min_overhead_bps to it to ensure that, when overhead is deducted, the
|
||||
// payload rate never goes beyond the limit. Note: this also means that if a
|
||||
// higher overhead is forced, we cannot reach the limit.
|
||||
// TODO(minyue): Reconsider this when the signaling to BWE is done
|
||||
// through a dedicated API.
|
||||
|
||||
// This means that when RtpParameters is reset, we may change the
|
||||
// encoder's bit rate immediately (through ReconfigureAudioSendStream()),
|
||||
// meanwhile change the cap to the output of BWE.
|
||||
if (rtp_parameter_max_bitrate_bps)
|
||||
return *rtp_parameter_max_bitrate_bps + min_overhead_bps_;
|
||||
return default_max_bitrate_->bps() + min_overhead_bps_;
|
||||
}
|
||||
DataRate AudioAllocationSettings::DefaultPriorityBitrate() const {
|
||||
DataRate max_overhead = DataRate::Zero();
|
||||
|
||||
@ -60,13 +60,14 @@ class AudioAllocationSettings {
|
||||
int max_bitrate_bps,
|
||||
bool has_dscp,
|
||||
int transport_seq_num_extension_header_id) const;
|
||||
// Returns true if we should include packet overhead in audio allocation.
|
||||
bool IncludeOverheadInAudioAllocation() const;
|
||||
|
||||
// Returns the min bitrate for audio rate allocation.
|
||||
absl::optional<DataRate> MinBitrate() const;
|
||||
// Returns the max bitrate for audio rate allocation.
|
||||
absl::optional<DataRate> MaxBitrate() const;
|
||||
// Returns the min bitrate for audio rate allocation, potentially including
|
||||
// overhead.
|
||||
int MinBitrateBps() const;
|
||||
// Returns the max bitrate for audio rate allocation, potentially including
|
||||
// overhead. |rtp_parameter_max_bitrate_bps| max bitrate as configured in rtp
|
||||
// parameters, excluding overhead.
|
||||
int MaxBitrateBps(absl::optional<int> rtp_parameter_max_bitrate_bps) const;
|
||||
// Indicates the default priority bitrate for audio streams. The bitrate
|
||||
// allocator will prioritize audio until it reaches this bitrate and will
|
||||
// divide bitrate evently between audio and video above this bitrate.
|
||||
@ -78,10 +79,10 @@ class AudioAllocationSettings {
|
||||
FieldTrialFlag force_no_audio_feedback_;
|
||||
FieldTrialFlag send_side_bwe_with_overhead_;
|
||||
int min_overhead_bps_ = 0;
|
||||
// Field Trial configured bitrates to use as overrides over default/user
|
||||
// configured bitrate range when audio bitrate allocation is enabled.
|
||||
FieldTrialOptional<DataRate> min_bitrate_;
|
||||
FieldTrialOptional<DataRate> max_bitrate_;
|
||||
// Default bitrates to use as range if there's no user configured
|
||||
// bitrate range but audio bitrate allocation is enabled.
|
||||
FieldTrialParameter<DataRate> default_min_bitrate_;
|
||||
FieldTrialParameter<DataRate> default_max_bitrate_;
|
||||
FieldTrialParameter<DataRate> priority_bitrate_;
|
||||
};
|
||||
} // namespace webrtc
|
||||
|
||||
Reference in New Issue
Block a user