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

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

Issue 1228393008: Add resolution and fps stats to histograms. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 5 years, 5 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
« no previous file with comments | « webrtc/video/receive_statistics_proxy.cc ('k') | webrtc/video/send_statistics_proxy.cc » ('j') | 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 29 matching lines...) Expand all
40 static const int kStatsTimeoutMs; 40 static const int kStatsTimeoutMs;
41 41
42 SendStatisticsProxy(Clock* clock, const VideoSendStream::Config& config); 42 SendStatisticsProxy(Clock* clock, const VideoSendStream::Config& config);
43 virtual ~SendStatisticsProxy(); 43 virtual ~SendStatisticsProxy();
44 44
45 VideoSendStream::Stats GetStats(); 45 VideoSendStream::Stats GetStats();
46 46
47 virtual void OnSendEncodedImage(const EncodedImage& encoded_image, 47 virtual void OnSendEncodedImage(const EncodedImage& encoded_image,
48 const RTPVideoHeader* rtp_video_header); 48 const RTPVideoHeader* rtp_video_header);
49 // Used to update incoming frame rate. 49 // Used to update incoming frame rate.
50 void OnIncomingFrame(); 50 void OnIncomingFrame(int width, int height);
51 51
52 // From VideoEncoderRateObserver. 52 // From VideoEncoderRateObserver.
53 void OnSetRates(uint32_t bitrate_bps, int framerate) override; 53 void OnSetRates(uint32_t bitrate_bps, int framerate) override;
54 54
55 void OnInactiveSsrc(uint32_t ssrc); 55 void OnInactiveSsrc(uint32_t ssrc);
56 56
57 protected: 57 protected:
58 // From CpuOveruseMetricsObserver. 58 // From CpuOveruseMetricsObserver.
59 void CpuOveruseMetricsUpdated(const CpuOveruseMetrics& metrics) override; 59 void CpuOveruseMetricsUpdated(const CpuOveruseMetrics& metrics) override;
60 // From RtcpStatisticsCallback. 60 // From RtcpStatisticsCallback.
61 void StatisticsUpdated(const RtcpStatistics& statistics, 61 void StatisticsUpdated(const RtcpStatistics& statistics,
62 uint32_t ssrc) override; 62 uint32_t ssrc) override;
63 void CNameChanged(const char* cname, uint32_t ssrc) override; 63 void CNameChanged(const char* cname, uint32_t ssrc) override;
64 // From RtcpPacketTypeCounterObserver 64 // From RtcpPacketTypeCounterObserver.
65 void RtcpPacketTypesCounterUpdated( 65 void RtcpPacketTypesCounterUpdated(
66 uint32_t ssrc, 66 uint32_t ssrc,
67 const RtcpPacketTypeCounter& packet_counter) override; 67 const RtcpPacketTypeCounter& packet_counter) override;
68 // From StreamDataCountersCallback. 68 // From StreamDataCountersCallback.
69 void DataCountersUpdated(const StreamDataCounters& counters, 69 void DataCountersUpdated(const StreamDataCounters& counters,
70 uint32_t ssrc) override; 70 uint32_t ssrc) override;
71 71
72 // From BitrateStatisticsObserver. 72 // From BitrateStatisticsObserver.
73 void Notify(const BitrateStatistics& total_stats, 73 void Notify(const BitrateStatistics& total_stats,
74 const BitrateStatistics& retransmit_stats, 74 const BitrateStatistics& retransmit_stats,
75 uint32_t ssrc) override; 75 uint32_t ssrc) override;
76 76
77 // From FrameCountObserver. 77 // From FrameCountObserver.
78 void FrameCountUpdated(const FrameCounts& frame_counts, 78 void FrameCountUpdated(const FrameCounts& frame_counts,
79 uint32_t ssrc) override; 79 uint32_t ssrc) override;
80 80
81 // From ViEEncoderObserver. 81 // From ViEEncoderObserver.
82 void OutgoingRate(const int video_channel, 82 void OutgoingRate(const int video_channel,
83 const unsigned int framerate, 83 const unsigned int framerate,
84 const unsigned int bitrate) override; 84 const unsigned int bitrate) override;
85 85
86 void SuspendChange(int video_channel, bool is_suspended) override; 86 void SuspendChange(int video_channel, bool is_suspended) override;
87 87
88 void SendSideDelayUpdated(int avg_delay_ms, 88 void SendSideDelayUpdated(int avg_delay_ms,
89 int max_delay_ms, 89 int max_delay_ms,
90 uint32_t ssrc) override; 90 uint32_t ssrc) override;
91 91
92 private: 92 private:
93 struct SampleCounter {
94 SampleCounter() : sum(0), num_samples(0) {}
95 void Add(int sample);
96 int Avg(int min_required_samples) const;
97
98 private:
99 int sum;
100 int num_samples;
101 };
93 struct StatsUpdateTimes { 102 struct StatsUpdateTimes {
94 StatsUpdateTimes() : resolution_update_ms(0) {} 103 StatsUpdateTimes() : resolution_update_ms(0) {}
95 int64_t resolution_update_ms; 104 int64_t resolution_update_ms;
96 int64_t bitrate_update_ms; 105 int64_t bitrate_update_ms;
97 }; 106 };
98 void PurgeOldStats() EXCLUSIVE_LOCKS_REQUIRED(crit_); 107 void PurgeOldStats() EXCLUSIVE_LOCKS_REQUIRED(crit_);
99 VideoSendStream::StreamStats* GetStatsEntry(uint32_t ssrc) 108 VideoSendStream::StreamStats* GetStatsEntry(uint32_t ssrc)
100 EXCLUSIVE_LOCKS_REQUIRED(crit_); 109 EXCLUSIVE_LOCKS_REQUIRED(crit_);
101 void UpdateHistograms() EXCLUSIVE_LOCKS_REQUIRED(crit_); 110 void UpdateHistograms() EXCLUSIVE_LOCKS_REQUIRED(crit_);
102 111
103 Clock* const clock_; 112 Clock* const clock_;
104 const VideoSendStream::Config config_; 113 const VideoSendStream::Config config_;
105 mutable rtc::CriticalSection crit_; 114 mutable rtc::CriticalSection crit_;
106 VideoSendStream::Stats stats_ GUARDED_BY(crit_); 115 VideoSendStream::Stats stats_ GUARDED_BY(crit_);
107 rtc::RateTracker input_frame_rate_tracker_ GUARDED_BY(crit_); 116 rtc::RateTracker input_frame_rate_tracker_ GUARDED_BY(crit_);
108 rtc::RateTracker input_frame_rate_tracker_total_ GUARDED_BY(crit_); 117 rtc::RateTracker input_frame_rate_tracker_total_ GUARDED_BY(crit_);
109 rtc::RateTracker sent_frame_rate_tracker_total_ GUARDED_BY(crit_); 118 rtc::RateTracker sent_frame_rate_tracker_total_ GUARDED_BY(crit_);
110 uint32_t last_sent_frame_timestamp_ GUARDED_BY(crit_); 119 uint32_t last_sent_frame_timestamp_ GUARDED_BY(crit_);
111 std::map<uint32_t, StatsUpdateTimes> update_times_ GUARDED_BY(crit_); 120 std::map<uint32_t, StatsUpdateTimes> update_times_ GUARDED_BY(crit_);
121
122 int max_sent_width_per_timestamp_ GUARDED_BY(crit_);
123 int max_sent_height_per_timestamp_ GUARDED_BY(crit_);
124 SampleCounter input_width_counter_ GUARDED_BY(crit_);
125 SampleCounter input_height_counter_ GUARDED_BY(crit_);
126 SampleCounter sent_width_counter_ GUARDED_BY(crit_);
127 SampleCounter sent_height_counter_ GUARDED_BY(crit_);
112 }; 128 };
113 129
114 } // namespace webrtc 130 } // namespace webrtc
115 #endif // WEBRTC_VIDEO_SEND_STATISTICS_PROXY_H_ 131 #endif // WEBRTC_VIDEO_SEND_STATISTICS_PROXY_H_
OLDNEW
« no previous file with comments | « webrtc/video/receive_statistics_proxy.cc ('k') | webrtc/video/send_statistics_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698