sprang@webrtc.org | ccd4284 | 2014-01-07 09:54:34 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
| 11 | #ifndef WEBRTC_VIDEO_SEND_STATISTICS_PROXY_H_ |
| 12 | #define WEBRTC_VIDEO_SEND_STATISTICS_PROXY_H_ |
| 13 | |
| 14 | #include <string> |
| 15 | |
pbos@webrtc.org | 38344ed | 2014-09-24 06:05:00 +0000 | [diff] [blame] | 16 | #include "webrtc/base/thread_annotations.h" |
sprang@webrtc.org | ccd4284 | 2014-01-07 09:54:34 +0000 | [diff] [blame] | 17 | #include "webrtc/common_types.h" |
| 18 | #include "webrtc/video_engine/include/vie_codec.h" |
| 19 | #include "webrtc/video_engine/include/vie_capture.h" |
| 20 | #include "webrtc/video_send_stream.h" |
| 21 | #include "webrtc/system_wrappers/interface/scoped_ptr.h" |
| 22 | |
| 23 | namespace webrtc { |
| 24 | |
| 25 | class CriticalSectionWrapper; |
| 26 | |
| 27 | class SendStatisticsProxy : public RtcpStatisticsCallback, |
| 28 | public StreamDataCountersCallback, |
| 29 | public BitrateStatisticsObserver, |
| 30 | public FrameCountObserver, |
| 31 | public ViEEncoderObserver, |
stefan@webrtc.org | 168f23f | 2014-07-11 13:44:02 +0000 | [diff] [blame] | 32 | public ViECaptureObserver, |
| 33 | public SendSideDelayObserver { |
sprang@webrtc.org | ccd4284 | 2014-01-07 09:54:34 +0000 | [diff] [blame] | 34 | public: |
stefan@webrtc.org | 168f23f | 2014-07-11 13:44:02 +0000 | [diff] [blame] | 35 | explicit SendStatisticsProxy(const VideoSendStream::Config& config); |
sprang@webrtc.org | ccd4284 | 2014-01-07 09:54:34 +0000 | [diff] [blame] | 36 | virtual ~SendStatisticsProxy(); |
| 37 | |
| 38 | VideoSendStream::Stats GetStats() const; |
| 39 | |
| 40 | protected: |
| 41 | // From RtcpStatisticsCallback. |
| 42 | virtual void StatisticsUpdated(const RtcpStatistics& statistics, |
| 43 | uint32_t ssrc) OVERRIDE; |
| 44 | // From StreamDataCountersCallback. |
| 45 | virtual void DataCountersUpdated(const StreamDataCounters& counters, |
| 46 | uint32_t ssrc) OVERRIDE; |
| 47 | |
| 48 | // From BitrateStatisticsObserver. |
| 49 | virtual void Notify(const BitrateStatistics& stats, uint32_t ssrc) OVERRIDE; |
| 50 | |
| 51 | // From FrameCountObserver. |
| 52 | virtual void FrameCountUpdated(FrameType frame_type, |
| 53 | uint32_t frame_count, |
| 54 | const unsigned int ssrc) OVERRIDE; |
| 55 | |
| 56 | // From ViEEncoderObserver. |
| 57 | virtual void OutgoingRate(const int video_channel, |
| 58 | const unsigned int framerate, |
| 59 | const unsigned int bitrate) OVERRIDE; |
| 60 | |
henrik.lundin@webrtc.org | b10363f | 2014-03-13 13:31:21 +0000 | [diff] [blame] | 61 | virtual void SuspendChange(int video_channel, bool is_suspended) OVERRIDE; |
sprang@webrtc.org | ccd4284 | 2014-01-07 09:54:34 +0000 | [diff] [blame] | 62 | |
| 63 | // From ViECaptureObserver. |
| 64 | virtual void BrightnessAlarm(const int capture_id, |
| 65 | const Brightness brightness) OVERRIDE {} |
| 66 | |
| 67 | virtual void CapturedFrameRate(const int capture_id, |
| 68 | const unsigned char frame_rate) OVERRIDE; |
| 69 | |
| 70 | virtual void NoPictureAlarm(const int capture_id, |
| 71 | const CaptureAlarm alarm) OVERRIDE {} |
| 72 | |
stefan@webrtc.org | 168f23f | 2014-07-11 13:44:02 +0000 | [diff] [blame] | 73 | virtual void SendSideDelayUpdated(int avg_delay_ms, |
| 74 | int max_delay_ms, |
| 75 | uint32_t ssrc) OVERRIDE; |
| 76 | |
sprang@webrtc.org | ccd4284 | 2014-01-07 09:54:34 +0000 | [diff] [blame] | 77 | private: |
pbos@webrtc.org | de1429e | 2014-04-28 13:00:21 +0000 | [diff] [blame] | 78 | StreamStats* GetStatsEntry(uint32_t ssrc) EXCLUSIVE_LOCKS_REQUIRED(crit_); |
sprang@webrtc.org | ccd4284 | 2014-01-07 09:54:34 +0000 | [diff] [blame] | 79 | |
| 80 | const VideoSendStream::Config config_; |
pbos@webrtc.org | de1429e | 2014-04-28 13:00:21 +0000 | [diff] [blame] | 81 | scoped_ptr<CriticalSectionWrapper> crit_; |
| 82 | VideoSendStream::Stats stats_ GUARDED_BY(crit_); |
sprang@webrtc.org | ccd4284 | 2014-01-07 09:54:34 +0000 | [diff] [blame] | 83 | }; |
| 84 | |
| 85 | } // namespace webrtc |
| 86 | #endif // WEBRTC_VIDEO_SEND_STATISTICS_PROXY_H_ |