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

Side by Side Diff: webrtc/video_engine/vie_channel.cc

Issue 1213603002: Remove ResetStatistics from RTP feedback. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Remove more data counter resetting. Created 5 years, 6 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 unified diff | Download patch
« no previous file with comments | « webrtc/video_engine/vie_channel.h ('k') | webrtc/voice_engine/channel.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 if (rtcp_counter.nack_requests > 0) { 237 if (rtcp_counter.nack_requests > 0) {
238 RTC_HISTOGRAM_PERCENTAGE( 238 RTC_HISTOGRAM_PERCENTAGE(
239 "WebRTC.Video.UniqueNackRequestsReceivedInPercent", 239 "WebRTC.Video.UniqueNackRequestsReceivedInPercent",
240 rtcp_counter.UniqueNackRequestsInPercent()); 240 rtcp_counter.UniqueNackRequestsInPercent());
241 } 241 }
242 int fraction_lost = report_block_stats_sender_->FractionLostInPercent(); 242 int fraction_lost = report_block_stats_sender_->FractionLostInPercent();
243 if (fraction_lost != -1) { 243 if (fraction_lost != -1) {
244 RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.SentPacketsLostInPercent", 244 RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.SentPacketsLostInPercent",
245 fraction_lost); 245 fraction_lost);
246 } 246 }
247
248 StreamDataCounters rtp;
åsapersson 2015/07/07 12:18:43 move this outside if-statement above
pbos-webrtc 2015/07/07 13:31:26 Done.
249 StreamDataCounters rtx;
250 GetSendStreamDataCounters(&rtp, &rtx);
251 StreamDataCounters rtp_rtx = rtp;
252 rtp_rtx.Add(rtx);
253 elapsed_sec =
254 rtp_rtx.TimeSinceFirstPacketInMs(
255 Clock::GetRealTimeClock()->TimeInMilliseconds()) /
256 1000;
257 if (elapsed_sec > metrics::kMinRunTimeInSeconds) {
258 RTC_HISTOGRAM_COUNTS_100000(
259 "WebRTC.Video.BitrateSentInKbps",
260 static_cast<int>(rtp_rtx.transmitted.TotalBytes() * 8 /
261 elapsed_sec / 1000));
262 RTC_HISTOGRAM_COUNTS_10000(
263 "WebRTC.Video.MediaBitrateSentInKbps",
264 static_cast<int>(rtp.MediaPayloadBytes() * 8 / elapsed_sec / 1000));
265 RTC_HISTOGRAM_COUNTS_10000(
266 "WebRTC.Video.PaddingBitrateSentInKbps",
267 static_cast<int>(rtp_rtx.transmitted.padding_bytes * 8 /
268 elapsed_sec / 1000));
269 RTC_HISTOGRAM_COUNTS_10000(
270 "WebRTC.Video.RetransmittedBitrateSentInKbps",
271 static_cast<int>(rtp_rtx.retransmitted.TotalBytes() * 8 /
272 elapsed_sec / 1000));
273 if (rtp_rtcp_->RtxSendStatus() != kRtxOff) {
274 RTC_HISTOGRAM_COUNTS_10000(
275 "WebRTC.Video.RtxBitrateSentInKbps",
276 static_cast<int>(rtx.transmitted.TotalBytes() * 8 / elapsed_sec /
277 1000));
278 }
279 bool fec_enabled = false;
280 uint8_t pltype_red;
281 uint8_t pltype_fec;
282 rtp_rtcp_->GenericFECStatus(fec_enabled, pltype_red, pltype_fec);
283 if (fec_enabled) {
284 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.FecBitrateSentInKbps",
285 static_cast<int>(rtp_rtx.fec.TotalBytes() *
286 8 / elapsed_sec / 1000));
287 }
288 }
247 } 289 }
248 } else if (vie_receiver_.GetRemoteSsrc() > 0) { 290 } else if (vie_receiver_.GetRemoteSsrc() > 0) {
249 // Get receive stats if we are receiving packets, i.e. there is a remote 291 // Get receive stats if we are receiving packets, i.e. there is a remote
250 // ssrc. 292 // ssrc.
251 RtcpPacketTypeCounter rtcp_counter; 293 RtcpPacketTypeCounter rtcp_counter;
252 GetReceiveRtcpPacketTypeCounter(&rtcp_counter); 294 GetReceiveRtcpPacketTypeCounter(&rtcp_counter);
253 int64_t elapsed_sec = rtcp_counter.TimeSinceFirstPacketInMs(now) / 1000; 295 int64_t elapsed_sec = rtcp_counter.TimeSinceFirstPacketInMs(now) / 1000;
254 if (elapsed_sec > metrics::kMinRunTimeInSeconds) { 296 if (elapsed_sec > metrics::kMinRunTimeInSeconds) {
255 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.NackPacketsSentPerMinute", 297 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.NackPacketsSentPerMinute",
256 rtcp_counter.nack_packets * 60 / elapsed_sec); 298 rtcp_counter.nack_packets * 60 / elapsed_sec);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 } 337 }
296 if (vie_receiver_.IsFecEnabled()) { 338 if (vie_receiver_.IsFecEnabled()) {
297 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.FecBitrateReceivedInKbps", 339 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.FecBitrateReceivedInKbps",
298 static_cast<int>(rtp_rtx.fec.TotalBytes() * 340 static_cast<int>(rtp_rtx.fec.TotalBytes() *
299 8 / elapsed_sec / 1000)); 341 8 / elapsed_sec / 1000));
300 } 342 }
301 } 343 }
302 } 344 }
303 } 345 }
304 346
305 void ViEChannel::UpdateHistogramsAtStopSend() {
306 StreamDataCounters rtp;
307 StreamDataCounters rtx;
308 GetSendStreamDataCounters(&rtp, &rtx);
309 StreamDataCounters rtp_rtx = rtp;
310 rtp_rtx.Add(rtx);
311
312 int64_t elapsed_sec = rtp_rtx.TimeSinceFirstPacketInMs(
313 Clock::GetRealTimeClock()->TimeInMilliseconds()) / 1000;
314 if (elapsed_sec < metrics::kMinRunTimeInSeconds) {
315 return;
316 }
317 RTC_HISTOGRAM_COUNTS_100000(
318 "WebRTC.Video.BitrateSentInKbps",
319 static_cast<int>(rtp_rtx.transmitted.TotalBytes() * 8 / elapsed_sec /
320 1000));
321 RTC_HISTOGRAM_COUNTS_10000(
322 "WebRTC.Video.MediaBitrateSentInKbps",
323 static_cast<int>(rtp.MediaPayloadBytes() * 8 / elapsed_sec / 1000));
324 RTC_HISTOGRAM_COUNTS_10000(
325 "WebRTC.Video.PaddingBitrateSentInKbps",
326 static_cast<int>(rtp_rtx.transmitted.padding_bytes * 8 / elapsed_sec /
327 1000));
328 RTC_HISTOGRAM_COUNTS_10000(
329 "WebRTC.Video.RetransmittedBitrateSentInKbps",
330 static_cast<int>(rtp_rtx.retransmitted.TotalBytes() * 8 / elapsed_sec /
331 1000));
332 if (rtp_rtcp_->RtxSendStatus() != kRtxOff) {
333 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.RtxBitrateSentInKbps",
334 static_cast<int>(rtx.transmitted.TotalBytes() *
335 8 / elapsed_sec / 1000));
336 }
337 bool fec_enabled = false;
338 uint8_t pltype_red;
339 uint8_t pltype_fec;
340 rtp_rtcp_->GenericFECStatus(fec_enabled, pltype_red, pltype_fec);
341 if (fec_enabled) {
342 RTC_HISTOGRAM_COUNTS_10000(
343 "WebRTC.Video.FecBitrateSentInKbps",
344 static_cast<int>(rtp_rtx.fec.TotalBytes() * 8 / elapsed_sec / 1000));
345 }
346 }
347
348 int32_t ViEChannel::SetSendCodec(const VideoCodec& video_codec, 347 int32_t ViEChannel::SetSendCodec(const VideoCodec& video_codec,
349 bool new_stream) { 348 bool new_stream) {
350 if (!sender_) { 349 if (!sender_) {
351 return 0; 350 return 0;
352 } 351 }
353 if (video_codec.codecType == kVideoCodecRED || 352 if (video_codec.codecType == kVideoCodecRED ||
354 video_codec.codecType == kVideoCodecULPFEC) { 353 video_codec.codecType == kVideoCodecULPFEC) {
355 LOG_F(LS_ERROR) << "Not a valid send codec " << video_codec.codecType; 354 LOG_F(LS_ERROR) << "Not a valid send codec " << video_codec.codecType;
356 return -1; 355 return -1;
357 } 356 }
(...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after
1328 it++) { 1327 it++) {
1329 RtpRtcp* rtp_rtcp = *it; 1328 RtpRtcp* rtp_rtcp = *it;
1330 rtp_rtcp->SetSendingMediaStatus(true); 1329 rtp_rtcp->SetSendingMediaStatus(true);
1331 rtp_rtcp->SetSendingStatus(true); 1330 rtp_rtcp->SetSendingStatus(true);
1332 } 1331 }
1333 send_payload_router_->set_active(true); 1332 send_payload_router_->set_active(true);
1334 return 0; 1333 return 0;
1335 } 1334 }
1336 1335
1337 int32_t ViEChannel::StopSend() { 1336 int32_t ViEChannel::StopSend() {
1338 UpdateHistogramsAtStopSend();
1339 send_payload_router_->set_active(false); 1337 send_payload_router_->set_active(false);
1340 CriticalSectionScoped cs(rtp_rtcp_cs_.get()); 1338 CriticalSectionScoped cs(rtp_rtcp_cs_.get());
1341 rtp_rtcp_->SetSendingMediaStatus(false); 1339 rtp_rtcp_->SetSendingMediaStatus(false);
1342 for (std::list<RtpRtcp*>::iterator it = simulcast_rtp_rtcp_.begin(); 1340 for (std::list<RtpRtcp*>::iterator it = simulcast_rtp_rtcp_.begin();
1343 it != simulcast_rtp_rtcp_.end(); 1341 it != simulcast_rtp_rtcp_.end();
1344 it++) { 1342 it++) {
1345 RtpRtcp* rtp_rtcp = *it; 1343 RtpRtcp* rtp_rtcp = *it;
1346 rtp_rtcp->SetSendingMediaStatus(false); 1344 rtp_rtcp->SetSendingMediaStatus(false);
1347 } 1345 }
1348 if (!rtp_rtcp_->Sending()) { 1346 if (!rtp_rtcp_->Sending()) {
1349 return -1; 1347 return -1;
1350 } 1348 }
1351 1349
1352 // Reset.
1353 rtp_rtcp_->ResetSendDataCountersRTP();
1354 if (rtp_rtcp_->SetSendingStatus(false) != 0) { 1350 if (rtp_rtcp_->SetSendingStatus(false) != 0) {
1355 return -1; 1351 return -1;
1356 } 1352 }
1357 for (std::list<RtpRtcp*>::iterator it = simulcast_rtp_rtcp_.begin(); 1353 for (std::list<RtpRtcp*>::iterator it = simulcast_rtp_rtcp_.begin();
1358 it != simulcast_rtp_rtcp_.end(); 1354 it != simulcast_rtp_rtcp_.end();
1359 it++) { 1355 it++) {
1360 RtpRtcp* rtp_rtcp = *it; 1356 RtpRtcp* rtp_rtcp = *it;
1361 rtp_rtcp->ResetSendDataCountersRTP();
1362 rtp_rtcp->SetSendingStatus(false); 1357 rtp_rtcp->SetSendingStatus(false);
1363 } 1358 }
1364 return 0; 1359 return 0;
1365 } 1360 }
1366 1361
1367 bool ViEChannel::Sending() { 1362 bool ViEChannel::Sending() {
1368 return rtp_rtcp_->Sending(); 1363 return rtp_rtcp_->Sending();
1369 } 1364 }
1370 1365
1371 int32_t ViEChannel::StartReceive() { 1366 int32_t ViEChannel::StartReceive() {
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
1699 1694
1700 } 1695 }
1701 1696
1702 void ViEChannel::OnIncomingCSRCChanged(const int32_t id, 1697 void ViEChannel::OnIncomingCSRCChanged(const int32_t id,
1703 const uint32_t CSRC, 1698 const uint32_t CSRC,
1704 const bool added) { 1699 const bool added) {
1705 assert(channel_id_ == ChannelId(id)); 1700 assert(channel_id_ == ChannelId(id));
1706 CriticalSectionScoped cs(callback_cs_.get()); 1701 CriticalSectionScoped cs(callback_cs_.get());
1707 } 1702 }
1708 1703
1709 void ViEChannel::ResetStatistics(uint32_t ssrc) {
1710 StreamStatistician* statistician =
1711 vie_receiver_.GetReceiveStatistics()->GetStatistician(ssrc);
1712 if (statistician)
1713 statistician->ResetStatistics();
1714 }
1715
1716 void ViEChannel::RegisterSendFrameCountObserver( 1704 void ViEChannel::RegisterSendFrameCountObserver(
1717 FrameCountObserver* observer) { 1705 FrameCountObserver* observer) {
1718 send_frame_count_observer_.Set(observer); 1706 send_frame_count_observer_.Set(observer);
1719 } 1707 }
1720 1708
1721 void ViEChannel::RegisterReceiveStatisticsProxy( 1709 void ViEChannel::RegisterReceiveStatisticsProxy(
1722 ReceiveStatisticsProxy* receive_statistics_proxy) { 1710 ReceiveStatisticsProxy* receive_statistics_proxy) {
1723 CriticalSectionScoped cs(callback_cs_.get()); 1711 CriticalSectionScoped cs(callback_cs_.get());
1724 vcm_receive_stats_callback_ = receive_statistics_proxy; 1712 vcm_receive_stats_callback_ = receive_statistics_proxy;
1725 } 1713 }
1726 1714
1727 void ViEChannel::SetIncomingVideoStream( 1715 void ViEChannel::SetIncomingVideoStream(
1728 IncomingVideoStream* incoming_video_stream) { 1716 IncomingVideoStream* incoming_video_stream) {
1729 CriticalSectionScoped cs(callback_cs_.get()); 1717 CriticalSectionScoped cs(callback_cs_.get());
1730 incoming_video_stream_ = incoming_video_stream; 1718 incoming_video_stream_ = incoming_video_stream;
1731 } 1719 }
1732 } // namespace webrtc 1720 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video_engine/vie_channel.h ('k') | webrtc/voice_engine/channel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698