2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
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.
11 #ifndef WEBRTC_VIDEO_RECEIVE_STATISTICS_PROXY_H_
12 #define WEBRTC_VIDEO_RECEIVE_STATISTICS_PROXY_H_
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"
28 class CriticalSectionWrapper;
30 class ViEDecoderObserver;
34 class ReceiveStatisticsProxy : public ViEDecoderObserver,
35 public RtcpStatisticsCallback,
36 public StreamDataCountersCallback {
38 ReceiveStatisticsProxy(uint32_t ssrc,
40 ViERTP_RTCP* rtp_rtcp,
43 virtual ~ReceiveStatisticsProxy();
45 VideoReceiveStream::Stats GetStats() const;
47 void OnDecodedFrame();
48 void OnRenderedFrame();
50 // Overrides ViEDecoderObserver.
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_bps) OVERRIDE;
56 virtual void DecoderTiming(int decode_ms,
61 int min_playout_delay_ms,
62 int render_delay_ms) OVERRIDE {}
63 virtual void RequestNewKeyFrame(const int video_channel) OVERRIDE {}
65 // Overrides RtcpStatisticsBallback.
66 virtual void StatisticsUpdated(const webrtc::RtcpStatistics& statistics,
67 uint32_t ssrc) OVERRIDE;
69 // Overrides StreamDataCountersCallback.
70 virtual void DataCountersUpdated(const webrtc::StreamDataCounters& counters,
71 uint32_t ssrc) OVERRIDE;
74 std::string GetCName() const;
78 ViECodec* const codec_;
79 ViERTP_RTCP* const rtp_rtcp_;
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_);
87 } // namespace internal
89 #endif // WEBRTC_VIDEO_RECEIVE_STATISTICS_PROXY_H_