Index: webrtc/modules/rtp_rtcp/source/rtp_sender_video.cc |
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_sender_video.cc b/webrtc/modules/rtp_rtcp/source/rtp_sender_video.cc |
index 378ef130d1a27811137462ace01ece5ca2fe4e19..3affb318aa70428e2a20489abf14d1cffdd3f397 100644 |
--- a/webrtc/modules/rtp_rtcp/source/rtp_sender_video.cc |
+++ b/webrtc/modules/rtp_rtcp/source/rtp_sender_video.cc |
@@ -31,7 +31,6 @@ |
RTPSenderVideo::RTPSenderVideo(Clock* clock, RTPSenderInterface* rtpSender) |
: _rtpSender(*rtpSender), |
- clock_(clock), |
_videoType(kRtpVideoGeneric), |
_retransmissionSettings(kRetransmitBaseLayer), |
// Generic FEC |
@@ -42,8 +41,8 @@ |
delta_fec_params_(), |
key_fec_params_(), |
producer_fec_(&fec_), |
- fec_bitrate_(1000, RateStatistics::kBpsScale), |
- video_bitrate_(1000, RateStatistics::kBpsScale) { |
+ _fecOverheadRate(clock, NULL), |
+ _videoBitrate(clock, NULL) { |
memset(&delta_fec_params_, 0, sizeof(delta_fec_params_)); |
memset(&key_fec_params_, 0, sizeof(key_fec_params_)); |
delta_fec_params_.max_fec_frames = key_fec_params_.max_fec_frames = 1; |
@@ -96,9 +95,7 @@ |
if (_rtpSender.SendToNetwork(data_buffer, payload_length, rtp_header_length, |
capture_time_ms, storage, |
RtpPacketSender::kLowPriority) == 0) { |
- rtc::CritScope cs(&stats_crit_); |
- video_bitrate_.Update(payload_length + rtp_header_length, |
- clock_->TimeInMilliseconds()); |
+ _videoBitrate.Update(payload_length + rtp_header_length); |
TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), |
"Video::PacketNormal", "timestamp", capture_timestamp, |
"seqnum", seq_num); |
@@ -144,8 +141,7 @@ |
red_packet->data(), red_packet->length() - rtp_header_length, |
rtp_header_length, capture_time_ms, media_packet_storage, |
RtpPacketSender::kLowPriority) == 0) { |
- rtc::CritScope cs(&stats_crit_); |
- video_bitrate_.Update(red_packet->length(), clock_->TimeInMilliseconds()); |
+ _videoBitrate.Update(red_packet->length()); |
TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), |
"Video::PacketRed", "timestamp", capture_timestamp, |
"seqnum", media_seq_num); |
@@ -157,8 +153,7 @@ |
fec_packet->data(), fec_packet->length() - rtp_header_length, |
rtp_header_length, capture_time_ms, fec_storage, |
RtpPacketSender::kLowPriority) == 0) { |
- rtc::CritScope cs(&stats_crit_); |
- fec_bitrate_.Update(fec_packet->length(), clock_->TimeInMilliseconds()); |
+ _fecOverheadRate.Update(fec_packet->length()); |
TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), |
"Video::PacketFec", "timestamp", capture_timestamp, |
"seqnum", next_fec_sequence_number); |
@@ -342,14 +337,17 @@ |
return 0; |
} |
+void RTPSenderVideo::ProcessBitrate() { |
+ _videoBitrate.Process(); |
+ _fecOverheadRate.Process(); |
+} |
+ |
uint32_t RTPSenderVideo::VideoBitrateSent() const { |
- rtc::CritScope cs(&stats_crit_); |
- return video_bitrate_.Rate(clock_->TimeInMilliseconds()).value_or(0); |
+ return _videoBitrate.BitrateLast(); |
} |
uint32_t RTPSenderVideo::FecOverheadRate() const { |
- rtc::CritScope cs(&stats_crit_); |
- return fec_bitrate_.Rate(clock_->TimeInMilliseconds()).value_or(0); |
+ return _fecOverheadRate.BitrateLast(); |
} |
int RTPSenderVideo::SelectiveRetransmissions() const { |