Avoid multiple calls to webrtc::field_trial::FindFullName in RTPSender; it's inefficient to perform string comparison whenever we send a packet.

BUG=None

Review-Url: https://codereview.webrtc.org/2637203002
Cr-Commit-Position: refs/heads/master@{#16291}
This commit is contained in:
elad.alon
2017-01-26 02:46:55 -08:00
committed by Commit bot
parent 52cdd3bb30
commit c3dfff3126
2 changed files with 7 additions and 3 deletions

View File

@ -123,7 +123,10 @@ RTPSender::RTPSender(
rtx_(kRtxOff),
rtp_overhead_bytes_per_packet_(0),
retransmission_rate_limiter_(retransmission_rate_limiter),
overhead_observer_(overhead_observer) {
overhead_observer_(overhead_observer),
send_side_bwe_with_overhead_(
webrtc::field_trial::FindFullName(
"WebRTC-SendSideBwe-WithOverhead") == "Enabled") {
ssrc_ = ssrc_db_->CreateSSRC();
RTC_DCHECK(ssrc_ != 0);
ssrc_rtx_ = ssrc_db_->CreateSSRC();
@ -1256,8 +1259,7 @@ void RTPSender::AddPacketToTransportFeedback(uint16_t packet_id,
const RtpPacketToSend& packet,
int probe_cluster_id) {
size_t packet_size = packet.payload_size() + packet.padding_size();
if (webrtc::field_trial::FindFullName("WebRTC-SendSideBwe-WithOverhead") ==
"Enabled") {
if (send_side_bwe_with_overhead_) {
packet_size = packet.size();
}

View File

@ -327,6 +327,8 @@ class RTPSender {
RateLimiter* const retransmission_rate_limiter_;
OverheadObserver* overhead_observer_;
const bool send_side_bwe_with_overhead_;
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RTPSender);
};