Chromium Code Reviews

Side by Side Diff: webrtc/video/send_statistics_proxy.cc

Issue 2498393002: Make SendStatisticsProxy let through FlexFEC packets. (Closed)
Patch Set: Rebase. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « no previous file | no next file » | 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) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 326 matching lines...)
337 RTC_HISTOGRAMS_COUNTS_10000( 337 RTC_HISTOGRAMS_COUNTS_10000(
338 kIndex, uma_prefix_ + "RetransmittedBitrateSentInKbps", 338 kIndex, uma_prefix_ + "RetransmittedBitrateSentInKbps",
339 static_cast<int>(rtp_rtx.retransmitted.TotalBytes() * 8 / 339 static_cast<int>(rtp_rtx.retransmitted.TotalBytes() * 8 /
340 elapsed_sec / 1000)); 340 elapsed_sec / 1000));
341 if (!rtp_config.rtx.ssrcs.empty()) { 341 if (!rtp_config.rtx.ssrcs.empty()) {
342 RTC_HISTOGRAMS_COUNTS_10000( 342 RTC_HISTOGRAMS_COUNTS_10000(
343 kIndex, uma_prefix_ + "RtxBitrateSentInKbps", 343 kIndex, uma_prefix_ + "RtxBitrateSentInKbps",
344 static_cast<int>(rtx.transmitted.TotalBytes() * 8 / elapsed_sec / 344 static_cast<int>(rtx.transmitted.TotalBytes() * 8 / elapsed_sec /
345 1000)); 345 1000));
346 } 346 }
347 if (rtp_config.ulpfec.red_payload_type != -1) { 347 if (rtp_config.flexfec.flexfec_payload_type != -1 ||
348 rtp_config.ulpfec.red_payload_type != -1) {
348 RTC_HISTOGRAMS_COUNTS_10000(kIndex, 349 RTC_HISTOGRAMS_COUNTS_10000(kIndex,
349 uma_prefix_ + "FecBitrateSentInKbps", 350 uma_prefix_ + "FecBitrateSentInKbps",
350 static_cast<int>(rtp_rtx.fec.TotalBytes() * 351 static_cast<int>(rtp_rtx.fec.TotalBytes() *
351 8 / elapsed_sec / 1000)); 352 8 / elapsed_sec / 1000));
352 } 353 }
353 } 354 }
354 } 355 }
355 } 356 }
356 357
357 void SendStatisticsProxy::OnEncoderReconfigured( 358 void SendStatisticsProxy::OnEncoderReconfigured(
(...skipping 53 matching lines...)
411 } 412 }
412 } 413 }
413 414
414 VideoSendStream::StreamStats* SendStatisticsProxy::GetStatsEntry( 415 VideoSendStream::StreamStats* SendStatisticsProxy::GetStatsEntry(
415 uint32_t ssrc) { 416 uint32_t ssrc) {
416 std::map<uint32_t, VideoSendStream::StreamStats>::iterator it = 417 std::map<uint32_t, VideoSendStream::StreamStats>::iterator it =
417 stats_.substreams.find(ssrc); 418 stats_.substreams.find(ssrc);
418 if (it != stats_.substreams.end()) 419 if (it != stats_.substreams.end())
419 return &it->second; 420 return &it->second;
420 421
421 bool is_rtx = false; 422 bool is_media = std::find(rtp_config_.ssrcs.begin(), rtp_config_.ssrcs.end(),
422 if (std::find(rtp_config_.ssrcs.begin(), rtp_config_.ssrcs.end(), ssrc) == 423 ssrc) != rtp_config_.ssrcs.end();
423 rtp_config_.ssrcs.end()) { 424 bool is_flexfec = rtp_config_.flexfec.flexfec_payload_type != -1 &&
424 if (std::find(rtp_config_.rtx.ssrcs.begin(), rtp_config_.rtx.ssrcs.end(), 425 ssrc == rtp_config_.flexfec.flexfec_ssrc;
425 ssrc) == rtp_config_.rtx.ssrcs.end()) { 426 bool is_rtx =
426 return nullptr; 427 std::find(rtp_config_.rtx.ssrcs.begin(), rtp_config_.rtx.ssrcs.end(),
427 } 428 ssrc) != rtp_config_.rtx.ssrcs.end();
428 is_rtx = true; 429 if (!is_media && !is_flexfec && !is_rtx)
429 } 430 return nullptr;
430 431
431 // Insert new entry and return ptr. 432 // Insert new entry and return ptr.
432 VideoSendStream::StreamStats* entry = &stats_.substreams[ssrc]; 433 VideoSendStream::StreamStats* entry = &stats_.substreams[ssrc];
433 entry->is_rtx = is_rtx; 434 entry->is_rtx = is_rtx;
434 435
435 return entry; 436 return entry;
436 } 437 }
437 438
438 void SendStatisticsProxy::OnInactiveSsrc(uint32_t ssrc) { 439 void SendStatisticsProxy::OnInactiveSsrc(uint32_t ssrc) {
439 rtc::CritScope lock(&crit_); 440 rtc::CritScope lock(&crit_);
(...skipping 244 matching lines...)
684 return Fraction(min_required_samples, 1000.0f); 685 return Fraction(min_required_samples, 1000.0f);
685 } 686 }
686 687
687 int SendStatisticsProxy::BoolSampleCounter::Fraction( 688 int SendStatisticsProxy::BoolSampleCounter::Fraction(
688 int min_required_samples, float multiplier) const { 689 int min_required_samples, float multiplier) const {
689 if (num_samples < min_required_samples || num_samples == 0) 690 if (num_samples < min_required_samples || num_samples == 0)
690 return -1; 691 return -1;
691 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); 692 return static_cast<int>((sum * multiplier / num_samples) + 0.5f);
692 } 693 }
693 } // namespace webrtc 694 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine