Move more calls to webrtc::field_trial::FindFullName into ctor, thereby minimizing the non-trivial cost of repeated string comparisons.

BUG=webrtc:7059

Review-Url: https://codereview.webrtc.org/2657863002
Cr-Commit-Position: refs/heads/master@{#16378}
This commit is contained in:
elad.alon
2017-01-31 05:48:37 -08:00
committed by Commit bot
parent 89f281c51a
commit 0fe1216c9c
6 changed files with 39 additions and 27 deletions

View File

@ -174,7 +174,9 @@ AudioEncoderOpus::AudioEncoderOpus(
const Config& config,
AudioNetworkAdaptorCreator&& audio_network_adaptor_creator,
std::unique_ptr<SmoothingFilter> bitrate_smoother)
: packet_loss_rate_(0.0),
: send_side_bwe_with_overhead_(webrtc::field_trial::FindFullName(
"WebRTC-SendSideBwe-WithOverhead") == "Enabled"),
packet_loss_rate_(0.0),
inst_(nullptr),
packet_loss_fraction_smoother_(new PacketLossFractionSmoother(
config.clock)),
@ -314,8 +316,7 @@ void AudioEncoderOpus::OnReceivedUplinkBandwidth(
bitrate_smoother_->AddSample(target_audio_bitrate_bps);
ApplyAudioNetworkAdaptor();
} else if (webrtc::field_trial::FindFullName(
"WebRTC-SendSideBwe-WithOverhead") == "Enabled") {
} else if (send_side_bwe_with_overhead_) {
if (!overhead_bytes_per_packet_) {
LOG(LS_INFO)
<< "AudioEncoderOpus: Overhead unknown, target audio bitrate "

View File

@ -161,6 +161,7 @@ class AudioEncoderOpus final : public AudioEncoder {
void MaybeUpdateUplinkBandwidth();
Config config_;
const bool send_side_bwe_with_overhead_;
float packet_loss_rate_;
std::vector<int16_t> input_buffer_;
OpusEncInst* inst_;