sprang@webrtc.org | 49812e6 | 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 | |
| 16 | #include "webrtc/common_types.h" |
| 17 | #include "webrtc/video_engine/include/vie_codec.h" |
| 18 | #include "webrtc/video_engine/include/vie_capture.h" |
| 19 | #include "webrtc/video_send_stream.h" |
| 20 | #include "webrtc/system_wrappers/interface/scoped_ptr.h" |
henrik.lundin@webrtc.org | 9376c69 | 2014-03-13 13:31:21 +0000 | [diff] [blame] | 21 | #include "webrtc/system_wrappers/interface/thread_annotations.h" |
sprang@webrtc.org | 49812e6 | 2014-01-07 09:54:34 +0000 | [diff] [blame] | 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, |
| 32 | public ViECaptureObserver { |
| 33 | public: |
sprang@webrtc.org | c8ab721 | 2014-02-07 12:06:29 +0000 | [diff] [blame] | 34 | class StatsProvider { |
| 35 | protected: |
| 36 | StatsProvider() {} |
| 37 | virtual ~StatsProvider() {} |
sprang@webrtc.org | 49812e6 | 2014-01-07 09:54:34 +0000 | [diff] [blame] | 38 | |
sprang@webrtc.org | c8ab721 | 2014-02-07 12:06:29 +0000 | [diff] [blame] | 39 | public: |
sprang@webrtc.org | 49812e6 | 2014-01-07 09:54:34 +0000 | [diff] [blame] | 40 | virtual bool GetSendSideDelay(VideoSendStream::Stats* stats) = 0; |
| 41 | virtual std::string GetCName() = 0; |
| 42 | }; |
| 43 | |
| 44 | SendStatisticsProxy(const VideoSendStream::Config& config, |
sprang@webrtc.org | c8ab721 | 2014-02-07 12:06:29 +0000 | [diff] [blame] | 45 | StatsProvider* stats_provider); |
sprang@webrtc.org | 49812e6 | 2014-01-07 09:54:34 +0000 | [diff] [blame] | 46 | virtual ~SendStatisticsProxy(); |
| 47 | |
| 48 | VideoSendStream::Stats GetStats() const; |
| 49 | |
| 50 | protected: |
| 51 | // From RtcpStatisticsCallback. |
| 52 | virtual void StatisticsUpdated(const RtcpStatistics& statistics, |
| 53 | uint32_t ssrc) OVERRIDE; |
| 54 | // From StreamDataCountersCallback. |
| 55 | virtual void DataCountersUpdated(const StreamDataCounters& counters, |
| 56 | uint32_t ssrc) OVERRIDE; |
| 57 | |
| 58 | // From BitrateStatisticsObserver. |
| 59 | virtual void Notify(const BitrateStatistics& stats, uint32_t ssrc) OVERRIDE; |
| 60 | |
| 61 | // From FrameCountObserver. |
| 62 | virtual void FrameCountUpdated(FrameType frame_type, |
| 63 | uint32_t frame_count, |
| 64 | const unsigned int ssrc) OVERRIDE; |
| 65 | |
| 66 | // From ViEEncoderObserver. |
| 67 | virtual void OutgoingRate(const int video_channel, |
| 68 | const unsigned int framerate, |
| 69 | const unsigned int bitrate) OVERRIDE; |
| 70 | |
henrik.lundin@webrtc.org | 9376c69 | 2014-03-13 13:31:21 +0000 | [diff] [blame] | 71 | virtual void SuspendChange(int video_channel, bool is_suspended) OVERRIDE; |
sprang@webrtc.org | 49812e6 | 2014-01-07 09:54:34 +0000 | [diff] [blame] | 72 | |
| 73 | // From ViECaptureObserver. |
| 74 | virtual void BrightnessAlarm(const int capture_id, |
| 75 | const Brightness brightness) OVERRIDE {} |
| 76 | |
| 77 | virtual void CapturedFrameRate(const int capture_id, |
| 78 | const unsigned char frame_rate) OVERRIDE; |
| 79 | |
| 80 | virtual void NoPictureAlarm(const int capture_id, |
| 81 | const CaptureAlarm alarm) OVERRIDE {} |
| 82 | |
| 83 | private: |
henrik.lundin@webrtc.org | 9376c69 | 2014-03-13 13:31:21 +0000 | [diff] [blame] | 84 | StreamStats* GetStatsEntry(uint32_t ssrc) EXCLUSIVE_LOCKS_REQUIRED(lock_); |
sprang@webrtc.org | 49812e6 | 2014-01-07 09:54:34 +0000 | [diff] [blame] | 85 | |
| 86 | const VideoSendStream::Config config_; |
| 87 | scoped_ptr<CriticalSectionWrapper> lock_; |
henrik.lundin@webrtc.org | 9376c69 | 2014-03-13 13:31:21 +0000 | [diff] [blame] | 88 | VideoSendStream::Stats stats_ GUARDED_BY(lock_); |
| 89 | StatsProvider* const stats_provider_; |
sprang@webrtc.org | 49812e6 | 2014-01-07 09:54:34 +0000 | [diff] [blame] | 90 | }; |
| 91 | |
| 92 | } // namespace webrtc |
| 93 | #endif // WEBRTC_VIDEO_SEND_STATISTICS_PROXY_H_ |