Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Unified Diff: webrtc/modules/rtp_rtcp/source/rtp_sender.cc

Issue 2352023002: Minor cleanups in RTPSender::UpdateRtpStats (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/rtp_rtcp/source/rtp_sender.cc
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_sender.cc b/webrtc/modules/rtp_rtcp/source/rtp_sender.cc
index b9d2bb9fffbbdcf542f9cc4a162818ebbe804c34..38069688f2ba635e826d245132f172d8e12396c1 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_sender.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtp_sender.cc
@@ -828,35 +828,27 @@ bool RTPSender::PrepareAndSendPacket(std::unique_ptr<RtpPacketToSend> packet,
void RTPSender::UpdateRtpStats(const RtpPacketToSend& packet,
bool is_rtx,
bool is_retransmit) {
- StreamDataCounters* counters;
- // Get ssrc before taking statistics_crit_ to avoid possible deadlock.
- uint32_t ssrc = is_rtx ? RtxSsrc() : SSRC();
int64_t now_ms = clock_->TimeInMilliseconds();
rtc::CritScope lock(&statistics_crit_);
- if (is_rtx) {
- counters = &rtx_rtp_stats_;
- } else {
- counters = &rtp_stats_;
- }
+ StreamDataCounters* counters = is_rtx ? &rtx_rtp_stats_ : &rtp_stats_;
total_bitrate_sent_.Update(packet.size(), now_ms);
- if (counters->first_packet_time_ms == -1) {
- counters->first_packet_time_ms = clock_->TimeInMilliseconds();
- }
- if (IsFecPacket(packet)) {
+ if (counters->first_packet_time_ms == -1)
+ counters->first_packet_time_ms = now_ms;
+
+ if (IsFecPacket(packet))
CountPacket(&counters->fec, packet);
- }
+
if (is_retransmit) {
CountPacket(&counters->retransmitted, packet);
nack_bitrate_sent_.Update(packet.size(), now_ms);
}
CountPacket(&counters->transmitted, packet);
- if (rtp_stats_callback_) {
- rtp_stats_callback_->DataCountersUpdated(*counters, ssrc);
- }
+ if (rtp_stats_callback_)
+ rtp_stats_callback_->DataCountersUpdated(*counters, packet.Ssrc());
}
bool RTPSender::IsFecPacket(const RtpPacketToSend& packet) const {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698