| 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 15 matching lines...) Expand all Loading... |
| 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, | |
| 37 public VideoEncoderRateObserver, | 36 public VideoEncoderRateObserver, |
| 38 public SendSideDelayObserver { | 37 public SendSideDelayObserver { |
| 39 public: | 38 public: |
| 40 static const int kStatsTimeoutMs; | 39 static const int kStatsTimeoutMs; |
| 41 | 40 |
| 42 SendStatisticsProxy(Clock* clock, const VideoSendStream::Config& config); | 41 SendStatisticsProxy(Clock* clock, const VideoSendStream::Config& config); |
| 43 virtual ~SendStatisticsProxy(); | 42 virtual ~SendStatisticsProxy(); |
| 44 | 43 |
| 45 VideoSendStream::Stats GetStats(); | 44 VideoSendStream::Stats GetStats(); |
| 46 | 45 |
| 47 virtual void OnSendEncodedImage(const EncodedImage& encoded_image, | 46 virtual void OnSendEncodedImage(const EncodedImage& encoded_image, |
| 48 const RTPVideoHeader* rtp_video_header); | 47 const RTPVideoHeader* rtp_video_header); |
| 49 // Used to update incoming frame rate. | 48 // Used to update incoming frame rate. |
| 50 void OnIncomingFrame(int width, int height); | 49 void OnIncomingFrame(int width, int height); |
| 51 | 50 |
| 52 // Used to update encode time of frames. | 51 // Used to update encode time of frames. |
| 53 void OnEncodedFrame(int encode_time_ms); | 52 void OnEncodedFrame(int encode_time_ms); |
| 54 | 53 |
| 55 // From VideoEncoderRateObserver. | 54 // From VideoEncoderRateObserver. |
| 56 void OnSetRates(uint32_t bitrate_bps, int framerate) override; | 55 void OnSetRates(uint32_t bitrate_bps, int framerate) override; |
| 57 | 56 |
| 57 void OnOutgoingRate(uint32_t framerate, uint32_t bitrate); |
| 58 void OnSuspendChange(bool is_suspended); |
| 58 void OnInactiveSsrc(uint32_t ssrc); | 59 void OnInactiveSsrc(uint32_t ssrc); |
| 59 | 60 |
| 60 protected: | 61 protected: |
| 61 // From CpuOveruseMetricsObserver. | 62 // From CpuOveruseMetricsObserver. |
| 62 void CpuOveruseMetricsUpdated(const CpuOveruseMetrics& metrics) override; | 63 void CpuOveruseMetricsUpdated(const CpuOveruseMetrics& metrics) override; |
| 63 // From RtcpStatisticsCallback. | 64 // From RtcpStatisticsCallback. |
| 64 void StatisticsUpdated(const RtcpStatistics& statistics, | 65 void StatisticsUpdated(const RtcpStatistics& statistics, |
| 65 uint32_t ssrc) override; | 66 uint32_t ssrc) override; |
| 66 void CNameChanged(const char* cname, uint32_t ssrc) override; | 67 void CNameChanged(const char* cname, uint32_t ssrc) override; |
| 67 // From RtcpPacketTypeCounterObserver. | 68 // From RtcpPacketTypeCounterObserver. |
| 68 void RtcpPacketTypesCounterUpdated( | 69 void RtcpPacketTypesCounterUpdated( |
| 69 uint32_t ssrc, | 70 uint32_t ssrc, |
| 70 const RtcpPacketTypeCounter& packet_counter) override; | 71 const RtcpPacketTypeCounter& packet_counter) override; |
| 71 // From StreamDataCountersCallback. | 72 // From StreamDataCountersCallback. |
| 72 void DataCountersUpdated(const StreamDataCounters& counters, | 73 void DataCountersUpdated(const StreamDataCounters& counters, |
| 73 uint32_t ssrc) override; | 74 uint32_t ssrc) override; |
| 74 | 75 |
| 75 // From BitrateStatisticsObserver. | 76 // From BitrateStatisticsObserver. |
| 76 void Notify(const BitrateStatistics& total_stats, | 77 void Notify(const BitrateStatistics& total_stats, |
| 77 const BitrateStatistics& retransmit_stats, | 78 const BitrateStatistics& retransmit_stats, |
| 78 uint32_t ssrc) override; | 79 uint32_t ssrc) override; |
| 79 | 80 |
| 80 // From FrameCountObserver. | 81 // From FrameCountObserver. |
| 81 void FrameCountUpdated(const FrameCounts& frame_counts, | 82 void FrameCountUpdated(const FrameCounts& frame_counts, |
| 82 uint32_t ssrc) override; | 83 uint32_t ssrc) override; |
| 83 | 84 |
| 84 // From ViEEncoderObserver. | |
| 85 void OutgoingRate(const int video_channel, | |
| 86 const unsigned int framerate, | |
| 87 const unsigned int bitrate) override; | |
| 88 | |
| 89 void SuspendChange(int video_channel, bool is_suspended) override; | |
| 90 | |
| 91 void SendSideDelayUpdated(int avg_delay_ms, | 85 void SendSideDelayUpdated(int avg_delay_ms, |
| 92 int max_delay_ms, | 86 int max_delay_ms, |
| 93 uint32_t ssrc) override; | 87 uint32_t ssrc) override; |
| 94 | 88 |
| 95 private: | 89 private: |
| 96 struct SampleCounter { | 90 struct SampleCounter { |
| 97 SampleCounter() : sum(0), num_samples(0) {} | 91 SampleCounter() : sum(0), num_samples(0) {} |
| 98 void Add(int sample); | 92 void Add(int sample); |
| 99 int Avg(int min_required_samples) const; | 93 int Avg(int min_required_samples) const; |
| 100 | 94 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 125 int max_sent_height_per_timestamp_ GUARDED_BY(crit_); | 119 int max_sent_height_per_timestamp_ GUARDED_BY(crit_); |
| 126 SampleCounter input_width_counter_ GUARDED_BY(crit_); | 120 SampleCounter input_width_counter_ GUARDED_BY(crit_); |
| 127 SampleCounter input_height_counter_ GUARDED_BY(crit_); | 121 SampleCounter input_height_counter_ GUARDED_BY(crit_); |
| 128 SampleCounter sent_width_counter_ GUARDED_BY(crit_); | 122 SampleCounter sent_width_counter_ GUARDED_BY(crit_); |
| 129 SampleCounter sent_height_counter_ GUARDED_BY(crit_); | 123 SampleCounter sent_height_counter_ GUARDED_BY(crit_); |
| 130 SampleCounter encode_time_counter_ GUARDED_BY(crit_); | 124 SampleCounter encode_time_counter_ GUARDED_BY(crit_); |
| 131 }; | 125 }; |
| 132 | 126 |
| 133 } // namespace webrtc | 127 } // namespace webrtc |
| 134 #endif // WEBRTC_VIDEO_SEND_STATISTICS_PROXY_H_ | 128 #endif // WEBRTC_VIDEO_SEND_STATISTICS_PROXY_H_ |
| OLD | NEW |