• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_RECEIVE_STATISTICS_PROXY_H_
12 #define WEBRTC_VIDEO_RECEIVE_STATISTICS_PROXY_H_
13 
14 #include <string>
15 
16 #include "webrtc/base/thread_annotations.h"
17 #include "webrtc/common_types.h"
18 #include "webrtc/frame_callback.h"
19 #include "webrtc/modules/remote_bitrate_estimator/rate_statistics.h"
20 #include "webrtc/video_engine/include/vie_codec.h"
21 #include "webrtc/video_engine/include/vie_rtp_rtcp.h"
22 #include "webrtc/video_receive_stream.h"
23 #include "webrtc/video_renderer.h"
24 
25 namespace webrtc {
26 
27 class Clock;
28 class CriticalSectionWrapper;
29 class ViECodec;
30 class ViEDecoderObserver;
31 
32 namespace internal {
33 
34 class ReceiveStatisticsProxy : public ViEDecoderObserver,
35                                public RtcpStatisticsCallback,
36                                public StreamDataCountersCallback {
37  public:
38   ReceiveStatisticsProxy(uint32_t ssrc,
39                          Clock* clock,
40                          ViERTP_RTCP* rtp_rtcp,
41                          ViECodec* codec,
42                          int channel);
43   virtual ~ReceiveStatisticsProxy();
44 
45   VideoReceiveStream::Stats GetStats() const;
46 
47   void OnDecodedFrame();
48   void OnRenderedFrame();
49 
50   // Overrides ViEDecoderObserver.
IncomingCodecChanged(const int video_channel,const VideoCodec & video_codec)51   virtual void IncomingCodecChanged(const int video_channel,
52                                     const VideoCodec& video_codec) OVERRIDE {}
53   virtual void IncomingRate(const int video_channel,
54                             const unsigned int framerate,
55                             const unsigned int bitrate) OVERRIDE;
DecoderTiming(int decode_ms,int max_decode_ms,int current_delay_ms,int target_delay_ms,int jitter_buffer_ms,int min_playout_delay_ms,int render_delay_ms)56   virtual void DecoderTiming(int decode_ms,
57                              int max_decode_ms,
58                              int current_delay_ms,
59                              int target_delay_ms,
60                              int jitter_buffer_ms,
61                              int min_playout_delay_ms,
62                              int render_delay_ms) OVERRIDE {}
RequestNewKeyFrame(const int video_channel)63   virtual void RequestNewKeyFrame(const int video_channel) OVERRIDE {}
64 
65   // Overrides RtcpStatisticsBallback.
66   virtual void StatisticsUpdated(const webrtc::RtcpStatistics& statistics,
67                                  uint32_t ssrc) OVERRIDE;
68 
69   // Overrides StreamDataCountersCallback.
70   virtual void DataCountersUpdated(const webrtc::StreamDataCounters& counters,
71                                    uint32_t ssrc) OVERRIDE;
72 
73  private:
74   std::string GetCName() const;
75 
76   const int channel_;
77   Clock* const clock_;
78   ViECodec* const codec_;
79   ViERTP_RTCP* const rtp_rtcp_;
80 
81   scoped_ptr<CriticalSectionWrapper> crit_;
82   VideoReceiveStream::Stats stats_ GUARDED_BY(crit_);
83   RateStatistics decode_fps_estimator_ GUARDED_BY(crit_);
84   RateStatistics renders_fps_estimator_ GUARDED_BY(crit_);
85 };
86 
87 }  // namespace internal
88 }  // namespace webrtc
89 #endif  // WEBRTC_VIDEO_RECEIVE_STATISTICS_PROXY_H_
90