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

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

Issue 1279433006: Add a rate tracker that tracks rate over a given interval split up into buckets that accumulate uni… (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fix type issues on win64. Created 5 years, 4 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) 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
11 #ifndef WEBRTC_VIDEO_SEND_STATISTICS_PROXY_H_ 11 #ifndef WEBRTC_VIDEO_SEND_STATISTICS_PROXY_H_
12 #define WEBRTC_VIDEO_SEND_STATISTICS_PROXY_H_ 12 #define WEBRTC_VIDEO_SEND_STATISTICS_PROXY_H_
13 13
14 #include <string> 14 #include <string>
15 15
16 #include "webrtc/base/bucketratetracker.h"
16 #include "webrtc/base/criticalsection.h" 17 #include "webrtc/base/criticalsection.h"
17 #include "webrtc/base/ratetracker.h"
18 #include "webrtc/base/scoped_ptr.h" 18 #include "webrtc/base/scoped_ptr.h"
19 #include "webrtc/base/thread_annotations.h" 19 #include "webrtc/base/thread_annotations.h"
20 #include "webrtc/common_types.h" 20 #include "webrtc/common_types.h"
21 #include "webrtc/modules/video_coding/codecs/interface/video_codec_interface.h" 21 #include "webrtc/modules/video_coding/codecs/interface/video_codec_interface.h"
22 #include "webrtc/modules/video_coding/main/interface/video_coding_defines.h" 22 #include "webrtc/modules/video_coding/main/interface/video_coding_defines.h"
23 #include "webrtc/system_wrappers/interface/clock.h" 23 #include "webrtc/system_wrappers/interface/clock.h"
24 #include "webrtc/video_engine/overuse_frame_detector.h" 24 #include "webrtc/video_engine/overuse_frame_detector.h"
25 #include "webrtc/video_engine/vie_encoder.h" 25 #include "webrtc/video_engine/vie_encoder.h"
26 #include "webrtc/video_send_stream.h" 26 #include "webrtc/video_send_stream.h"
27 27
28 namespace webrtc { 28 namespace webrtc {
29 29
30 class SendStatisticsProxy : public CpuOveruseMetricsObserver, 30 class SendStatisticsProxy : public CpuOveruseMetricsObserver,
31 public RtcpStatisticsCallback, 31 public RtcpStatisticsCallback,
32 public RtcpPacketTypeCounterObserver, 32 public RtcpPacketTypeCounterObserver,
33 public StreamDataCountersCallback, 33 public StreamDataCountersCallback,
34 public BitrateStatisticsObserver, 34 public BitrateStatisticsObserver,
35 public FrameCountObserver, 35 public FrameCountObserver,
36 public ViEEncoderObserver, 36 public ViEEncoderObserver,
37 public VideoEncoderRateObserver, 37 public VideoEncoderRateObserver,
38 public SendSideDelayObserver { 38 public SendSideDelayObserver {
39 public: 39 public:
40 static const int kStatsTimeoutMs; 40 static const int kStatsTimeoutMs;
41 static const size_t kFrameRateTrackerInterval;
41 42
42 SendStatisticsProxy(Clock* clock, const VideoSendStream::Config& config); 43 SendStatisticsProxy(Clock* clock, const VideoSendStream::Config& config);
43 virtual ~SendStatisticsProxy(); 44 virtual ~SendStatisticsProxy();
44 45
45 VideoSendStream::Stats GetStats(); 46 VideoSendStream::Stats GetStats();
46 47
47 virtual void OnSendEncodedImage(const EncodedImage& encoded_image, 48 virtual void OnSendEncodedImage(const EncodedImage& encoded_image,
48 const RTPVideoHeader* rtp_video_header); 49 const RTPVideoHeader* rtp_video_header);
49 // Used to update incoming frame rate. 50 // Used to update incoming frame rate.
50 void OnIncomingFrame(int width, int height); 51 void OnIncomingFrame(int width, int height);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 }; 110 };
110 void PurgeOldStats() EXCLUSIVE_LOCKS_REQUIRED(crit_); 111 void PurgeOldStats() EXCLUSIVE_LOCKS_REQUIRED(crit_);
111 VideoSendStream::StreamStats* GetStatsEntry(uint32_t ssrc) 112 VideoSendStream::StreamStats* GetStatsEntry(uint32_t ssrc)
112 EXCLUSIVE_LOCKS_REQUIRED(crit_); 113 EXCLUSIVE_LOCKS_REQUIRED(crit_);
113 void UpdateHistograms() EXCLUSIVE_LOCKS_REQUIRED(crit_); 114 void UpdateHistograms() EXCLUSIVE_LOCKS_REQUIRED(crit_);
114 115
115 Clock* const clock_; 116 Clock* const clock_;
116 const VideoSendStream::Config config_; 117 const VideoSendStream::Config config_;
117 mutable rtc::CriticalSection crit_; 118 mutable rtc::CriticalSection crit_;
118 VideoSendStream::Stats stats_ GUARDED_BY(crit_); 119 VideoSendStream::Stats stats_ GUARDED_BY(crit_);
119 rtc::RateTracker input_frame_rate_tracker_ GUARDED_BY(crit_); 120 rtc::IntervalRateTracker input_frame_rate_tracker_ GUARDED_BY(crit_);
120 rtc::RateTracker input_frame_rate_tracker_total_ GUARDED_BY(crit_); 121 rtc::IntervalRateTracker input_frame_rate_tracker_total_ GUARDED_BY(crit_);
121 rtc::RateTracker sent_frame_rate_tracker_total_ GUARDED_BY(crit_); 122 rtc::IntervalRateTracker sent_frame_rate_tracker_total_ GUARDED_BY(crit_);
122 uint32_t last_sent_frame_timestamp_ GUARDED_BY(crit_); 123 uint32_t last_sent_frame_timestamp_ GUARDED_BY(crit_);
123 std::map<uint32_t, StatsUpdateTimes> update_times_ GUARDED_BY(crit_); 124 std::map<uint32_t, StatsUpdateTimes> update_times_ GUARDED_BY(crit_);
124 125
125 int max_sent_width_per_timestamp_ GUARDED_BY(crit_); 126 int max_sent_width_per_timestamp_ GUARDED_BY(crit_);
126 int max_sent_height_per_timestamp_ GUARDED_BY(crit_); 127 int max_sent_height_per_timestamp_ GUARDED_BY(crit_);
127 SampleCounter input_width_counter_ GUARDED_BY(crit_); 128 SampleCounter input_width_counter_ GUARDED_BY(crit_);
128 SampleCounter input_height_counter_ GUARDED_BY(crit_); 129 SampleCounter input_height_counter_ GUARDED_BY(crit_);
129 SampleCounter sent_width_counter_ GUARDED_BY(crit_); 130 SampleCounter sent_width_counter_ GUARDED_BY(crit_);
130 SampleCounter sent_height_counter_ GUARDED_BY(crit_); 131 SampleCounter sent_height_counter_ GUARDED_BY(crit_);
131 SampleCounter encode_time_counter_ GUARDED_BY(crit_); 132 SampleCounter encode_time_counter_ GUARDED_BY(crit_);
132 }; 133 };
133 134
134 } // namespace webrtc 135 } // namespace webrtc
135 #endif // WEBRTC_VIDEO_SEND_STATISTICS_PROXY_H_ 136 #endif // WEBRTC_VIDEO_SEND_STATISTICS_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698