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 | |
| 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" |
| 21 | |
| 22 | namespace webrtc { |
| 23 | |
| 24 | class CriticalSectionWrapper; |
| 25 | |
| 26 | class SendStatisticsProxy : public RtcpStatisticsCallback, |
| 27 | public StreamDataCountersCallback, |
| 28 | public BitrateStatisticsObserver, |
| 29 | public FrameCountObserver, |
| 30 | public ViEEncoderObserver, |
| 31 | public ViECaptureObserver { |
| 32 | public: |
| 33 | class StreamStatsProvider { |
| 34 | public: |
| 35 | StreamStatsProvider() {} |
| 36 | virtual ~StreamStatsProvider() {} |
| 37 | |
| 38 | virtual bool GetSendSideDelay(VideoSendStream::Stats* stats) = 0; |
| 39 | virtual std::string GetCName() = 0; |
| 40 | }; |
| 41 | |
| 42 | SendStatisticsProxy(const VideoSendStream::Config& config, |
| 43 | StreamStatsProvider* stats_provider); |
| 44 | virtual ~SendStatisticsProxy(); |
| 45 | |
| 46 | VideoSendStream::Stats GetStats() const; |
| 47 | |
| 48 | protected: |
| 49 | // From RtcpStatisticsCallback. |
| 50 | virtual void StatisticsUpdated(const RtcpStatistics& statistics, |
| 51 | uint32_t ssrc) OVERRIDE; |
| 52 | // From StreamDataCountersCallback. |
| 53 | virtual void DataCountersUpdated(const StreamDataCounters& counters, |
| 54 | uint32_t ssrc) OVERRIDE; |
| 55 | |
| 56 | // From BitrateStatisticsObserver. |
| 57 | virtual void Notify(const BitrateStatistics& stats, uint32_t ssrc) OVERRIDE; |
| 58 | |
| 59 | // From FrameCountObserver. |
| 60 | virtual void FrameCountUpdated(FrameType frame_type, |
| 61 | uint32_t frame_count, |
| 62 | const unsigned int ssrc) OVERRIDE; |
| 63 | |
| 64 | // From ViEEncoderObserver. |
| 65 | virtual void OutgoingRate(const int video_channel, |
| 66 | const unsigned int framerate, |
| 67 | const unsigned int bitrate) OVERRIDE; |
| 68 | |
| 69 | virtual void SuspendChange(int video_channel, bool is_suspended) OVERRIDE {} |
| 70 | |
| 71 | // From ViECaptureObserver. |
| 72 | virtual void BrightnessAlarm(const int capture_id, |
| 73 | const Brightness brightness) OVERRIDE {} |
| 74 | |
| 75 | virtual void CapturedFrameRate(const int capture_id, |
| 76 | const unsigned char frame_rate) OVERRIDE; |
| 77 | |
| 78 | virtual void NoPictureAlarm(const int capture_id, |
| 79 | const CaptureAlarm alarm) OVERRIDE {} |
| 80 | |
| 81 | private: |
| 82 | StreamStats* GetStatsEntry(uint32_t ssrc); |
| 83 | |
| 84 | const VideoSendStream::Config config_; |
| 85 | scoped_ptr<CriticalSectionWrapper> lock_; |
| 86 | VideoSendStream::Stats stats_; |
| 87 | StreamStatsProvider* stats_provider_; |
| 88 | }; |
| 89 | |
| 90 | } // namespace webrtc |
| 91 | #endif // WEBRTC_VIDEO_SEND_STATISTICS_PROXY_H_ |