| OLD | NEW |
| 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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 } | 388 } |
| 389 } | 389 } |
| 390 | 390 |
| 391 VideoSendStream::StreamStats* SendStatisticsProxy::GetStatsEntry( | 391 VideoSendStream::StreamStats* SendStatisticsProxy::GetStatsEntry( |
| 392 uint32_t ssrc) { | 392 uint32_t ssrc) { |
| 393 std::map<uint32_t, VideoSendStream::StreamStats>::iterator it = | 393 std::map<uint32_t, VideoSendStream::StreamStats>::iterator it = |
| 394 stats_.substreams.find(ssrc); | 394 stats_.substreams.find(ssrc); |
| 395 if (it != stats_.substreams.end()) | 395 if (it != stats_.substreams.end()) |
| 396 return &it->second; | 396 return &it->second; |
| 397 | 397 |
| 398 bool is_rtx = false; |
| 398 if (std::find(config_.rtp.ssrcs.begin(), config_.rtp.ssrcs.end(), ssrc) == | 399 if (std::find(config_.rtp.ssrcs.begin(), config_.rtp.ssrcs.end(), ssrc) == |
| 399 config_.rtp.ssrcs.end() && | 400 config_.rtp.ssrcs.end()) { |
| 400 std::find(config_.rtp.rtx.ssrcs.begin(), | 401 if (std::find(config_.rtp.rtx.ssrcs.begin(), config_.rtp.rtx.ssrcs.end(), |
| 401 config_.rtp.rtx.ssrcs.end(), | 402 ssrc) == config_.rtp.rtx.ssrcs.end()) { |
| 402 ssrc) == config_.rtp.rtx.ssrcs.end()) { | 403 return nullptr; |
| 403 return nullptr; | 404 } |
| 405 is_rtx = true; |
| 404 } | 406 } |
| 405 | 407 |
| 406 return &stats_.substreams[ssrc]; // Insert new entry and return ptr. | 408 // Insert new entry and return ptr. |
| 409 VideoSendStream::StreamStats* entry = &stats_.substreams[ssrc]; |
| 410 entry->is_rtx = is_rtx; |
| 411 |
| 412 return entry; |
| 407 } | 413 } |
| 408 | 414 |
| 409 void SendStatisticsProxy::OnInactiveSsrc(uint32_t ssrc) { | 415 void SendStatisticsProxy::OnInactiveSsrc(uint32_t ssrc) { |
| 410 rtc::CritScope lock(&crit_); | 416 rtc::CritScope lock(&crit_); |
| 411 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); | 417 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); |
| 412 if (!stats) | 418 if (!stats) |
| 413 return; | 419 return; |
| 414 | 420 |
| 415 stats->total_bitrate_bps = 0; | 421 stats->total_bitrate_bps = 0; |
| 416 stats->retransmit_bitrate_bps = 0; | 422 stats->retransmit_bitrate_bps = 0; |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 return Fraction(min_required_samples, 1000.0f); | 633 return Fraction(min_required_samples, 1000.0f); |
| 628 } | 634 } |
| 629 | 635 |
| 630 int SendStatisticsProxy::BoolSampleCounter::Fraction( | 636 int SendStatisticsProxy::BoolSampleCounter::Fraction( |
| 631 int min_required_samples, float multiplier) const { | 637 int min_required_samples, float multiplier) const { |
| 632 if (num_samples < min_required_samples || num_samples == 0) | 638 if (num_samples < min_required_samples || num_samples == 0) |
| 633 return -1; | 639 return -1; |
| 634 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); | 640 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); |
| 635 } | 641 } |
| 636 } // namespace webrtc | 642 } // namespace webrtc |
| OLD | NEW |