Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / webrtc / video / send_statistics_proxy.h
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/base/thread_annotations.h"
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,
32                             public ViECaptureObserver,
33                             public SendSideDelayObserver {
34  public:
35   explicit SendStatisticsProxy(const VideoSendStream::Config& config);
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& total_stats,
50                       const BitrateStatistics& retransmit_stats,
51                       uint32_t ssrc) OVERRIDE;
52
53   // From FrameCountObserver.
54   virtual void FrameCountUpdated(FrameType frame_type,
55                                  uint32_t frame_count,
56                                  const unsigned int ssrc) OVERRIDE;
57
58   // From ViEEncoderObserver.
59   virtual void OutgoingRate(const int video_channel,
60                             const unsigned int framerate,
61                             const unsigned int bitrate) OVERRIDE;
62
63   virtual void SuspendChange(int video_channel, bool is_suspended) OVERRIDE;
64
65   // From ViECaptureObserver.
66   virtual void BrightnessAlarm(const int capture_id,
67                                const Brightness brightness) OVERRIDE {}
68
69   virtual void CapturedFrameRate(const int capture_id,
70                                  const unsigned char frame_rate) OVERRIDE;
71
72   virtual void NoPictureAlarm(const int capture_id,
73                               const CaptureAlarm alarm) OVERRIDE {}
74
75   virtual void SendSideDelayUpdated(int avg_delay_ms,
76                                     int max_delay_ms,
77                                     uint32_t ssrc) OVERRIDE;
78
79  private:
80   SsrcStats* GetStatsEntry(uint32_t ssrc) EXCLUSIVE_LOCKS_REQUIRED(crit_);
81
82   const VideoSendStream::Config config_;
83   scoped_ptr<CriticalSectionWrapper> crit_;
84   VideoSendStream::Stats stats_ GUARDED_BY(crit_);
85 };
86
87 }  // namespace webrtc
88 #endif  // WEBRTC_VIDEO_SEND_STATISTICS_PROXY_H_