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

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

Issue 2307913002: Update AvgCounter to have the ability to include last period metric for subsequent intervals withou… (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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 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
11 #include "webrtc/video/send_delay_stats.h" 11 #include "webrtc/video/send_delay_stats.h"
12 12
13 #include <utility>
14
13 #include "webrtc/base/logging.h" 15 #include "webrtc/base/logging.h"
14 #include "webrtc/system_wrappers/include/metrics.h" 16 #include "webrtc/system_wrappers/include/metrics.h"
15 17
16 namespace webrtc { 18 namespace webrtc {
17 namespace { 19 namespace {
18 // Packet with a larger delay are removed and excluded from the delay stats. 20 // Packet with a larger delay are removed and excluded from the delay stats.
19 // Set to larger than max histogram delay which is 10000. 21 // Set to larger than max histogram delay which is 10000.
20 const int64_t kMaxSentPacketDelayMs = 11000; 22 const int64_t kMaxSentPacketDelayMs = 11000;
21 const size_t kMaxPacketMapSize = 2000; 23 const size_t kMaxPacketMapSize = 2000;
22 24
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 return; 56 return;
55 for (const auto& ssrc : config.rtp.ssrcs) 57 for (const auto& ssrc : config.rtp.ssrcs)
56 ssrcs_.insert(ssrc); 58 ssrcs_.insert(ssrc);
57 } 59 }
58 60
59 AvgCounter* SendDelayStats::GetSendDelayCounter(uint32_t ssrc) { 61 AvgCounter* SendDelayStats::GetSendDelayCounter(uint32_t ssrc) {
60 const auto& it = send_delay_counters_.find(ssrc); 62 const auto& it = send_delay_counters_.find(ssrc);
61 if (it != send_delay_counters_.end()) 63 if (it != send_delay_counters_.end())
62 return it->second.get(); 64 return it->second.get();
63 65
64 AvgCounter* counter = new AvgCounter(clock_, nullptr); 66 AvgCounter* counter = new AvgCounter(clock_, nullptr, false);
65 send_delay_counters_[ssrc].reset(counter); 67 send_delay_counters_[ssrc].reset(counter);
66 return counter; 68 return counter;
67 } 69 }
68 70
69 void SendDelayStats::OnSendPacket(uint16_t packet_id, 71 void SendDelayStats::OnSendPacket(uint16_t packet_id,
70 int64_t capture_time_ms, 72 int64_t capture_time_ms,
71 uint32_t ssrc) { 73 uint32_t ssrc) {
72 // Packet sent to transport. 74 // Packet sent to transport.
73 rtc::CritScope lock(&crit_); 75 rtc::CritScope lock(&crit_);
74 if (ssrcs_.find(ssrc) == ssrcs_.end()) 76 if (ssrcs_.find(ssrc) == ssrcs_.end())
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 auto it = packets->begin(); 110 auto it = packets->begin();
109 if (now - it->second.capture_time_ms < kMaxSentPacketDelayMs) 111 if (now - it->second.capture_time_ms < kMaxSentPacketDelayMs)
110 break; 112 break;
111 113
112 packets->erase(it); 114 packets->erase(it);
113 ++num_old_packets_; 115 ++num_old_packets_;
114 } 116 }
115 } 117 }
116 118
117 } // namespace webrtc 119 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/call/call.cc ('k') | webrtc/video/stats_counter.h » ('j') | webrtc/video/stats_counter.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698