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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 received_seq_first_(0), | 44 received_seq_first_(0), |
45 received_seq_max_(0), | 45 received_seq_max_(0), |
46 received_seq_wraps_(0), | 46 received_seq_wraps_(0), |
47 received_packet_overhead_(12), | 47 received_packet_overhead_(12), |
48 last_report_inorder_packets_(0), | 48 last_report_inorder_packets_(0), |
49 last_report_old_packets_(0), | 49 last_report_old_packets_(0), |
50 last_report_seq_max_(0), | 50 last_report_seq_max_(0), |
51 rtcp_callback_(rtcp_callback), | 51 rtcp_callback_(rtcp_callback), |
52 rtp_callback_(rtp_callback) {} | 52 rtp_callback_(rtp_callback) {} |
53 | 53 |
54 void StreamStatisticianImpl::ResetStatistics() { | |
55 CriticalSectionScoped cs(stream_lock_.get()); | |
56 last_report_inorder_packets_ = 0; | |
57 last_report_old_packets_ = 0; | |
58 last_report_seq_max_ = 0; | |
59 last_reported_statistics_ = RtcpStatistics(); | |
60 jitter_q4_ = 0; | |
61 cumulative_loss_ = 0; | |
62 jitter_q4_transmission_time_offset_ = 0; | |
63 received_seq_wraps_ = 0; | |
64 received_seq_max_ = 0; | |
65 received_seq_first_ = 0; | |
66 stored_sum_receive_counters_.Add(receive_counters_); | |
67 receive_counters_ = StreamDataCounters(); | |
68 } | |
69 | |
70 void StreamStatisticianImpl::IncomingPacket(const RTPHeader& header, | 54 void StreamStatisticianImpl::IncomingPacket(const RTPHeader& header, |
71 size_t packet_length, | 55 size_t packet_length, |
72 bool retransmitted) { | 56 bool retransmitted) { |
73 UpdateCounters(header, packet_length, retransmitted); | 57 UpdateCounters(header, packet_length, retransmitted); |
74 NotifyRtpCallback(); | 58 NotifyRtpCallback(); |
75 } | 59 } |
76 | 60 |
77 void StreamStatisticianImpl::UpdateCounters(const RTPHeader& header, | 61 void StreamStatisticianImpl::UpdateCounters(const RTPHeader& header, |
78 size_t packet_length, | 62 size_t packet_length, |
79 bool retransmitted) { | 63 bool retransmitted) { |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 } | 297 } |
314 if (packets_received) { | 298 if (packets_received) { |
315 *packets_received = receive_counters_.transmitted.packets; | 299 *packets_received = receive_counters_.transmitted.packets; |
316 } | 300 } |
317 } | 301 } |
318 | 302 |
319 void StreamStatisticianImpl::GetReceiveStreamDataCounters( | 303 void StreamStatisticianImpl::GetReceiveStreamDataCounters( |
320 StreamDataCounters* data_counters) const { | 304 StreamDataCounters* data_counters) const { |
321 CriticalSectionScoped cs(stream_lock_.get()); | 305 CriticalSectionScoped cs(stream_lock_.get()); |
322 *data_counters = receive_counters_; | 306 *data_counters = receive_counters_; |
323 data_counters->Add(stored_sum_receive_counters_); | |
324 } | 307 } |
325 | 308 |
326 uint32_t StreamStatisticianImpl::BitrateReceived() const { | 309 uint32_t StreamStatisticianImpl::BitrateReceived() const { |
327 CriticalSectionScoped cs(stream_lock_.get()); | 310 CriticalSectionScoped cs(stream_lock_.get()); |
328 return incoming_bitrate_.BitrateNow(); | 311 return incoming_bitrate_.BitrateNow(); |
329 } | 312 } |
330 | 313 |
331 void StreamStatisticianImpl::ProcessBitrate() { | 314 void StreamStatisticianImpl::ProcessBitrate() { |
332 CriticalSectionScoped cs(stream_lock_.get()); | 315 CriticalSectionScoped cs(stream_lock_.get()); |
333 incoming_bitrate_.Process(); | 316 incoming_bitrate_.Process(); |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 | 539 |
557 int32_t NullReceiveStatistics::Process() { return 0; } | 540 int32_t NullReceiveStatistics::Process() { return 0; } |
558 | 541 |
559 void NullReceiveStatistics::RegisterRtcpStatisticsCallback( | 542 void NullReceiveStatistics::RegisterRtcpStatisticsCallback( |
560 RtcpStatisticsCallback* callback) {} | 543 RtcpStatisticsCallback* callback) {} |
561 | 544 |
562 void NullReceiveStatistics::RegisterRtpStatisticsCallback( | 545 void NullReceiveStatistics::RegisterRtpStatisticsCallback( |
563 StreamDataCountersCallback* callback) {} | 546 StreamDataCountersCallback* callback) {} |
564 | 547 |
565 } // namespace webrtc | 548 } // namespace webrtc |
OLD | NEW |