2014-02-07 12:06:29 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef WEBRTC_VIDEO_RECEIVE_STATISTICS_PROXY_H_
|
|
|
|
|
#define WEBRTC_VIDEO_RECEIVE_STATISTICS_PROXY_H_
|
|
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
2015-05-01 13:00:41 +02:00
|
|
|
#include "webrtc/base/criticalsection.h"
|
2015-07-22 06:52:00 -07:00
|
|
|
#include "webrtc/base/ratetracker.h"
|
2014-09-24 06:05:00 +00:00
|
|
|
#include "webrtc/base/thread_annotations.h"
|
2014-02-07 12:06:29 +00:00
|
|
|
#include "webrtc/common_types.h"
|
|
|
|
|
#include "webrtc/frame_callback.h"
|
|
|
|
|
#include "webrtc/modules/remote_bitrate_estimator/rate_statistics.h"
|
2014-12-19 15:45:03 +00:00
|
|
|
#include "webrtc/modules/video_coding/main/interface/video_coding_defines.h"
|
2015-04-27 10:09:49 +02:00
|
|
|
#include "webrtc/video_engine/report_block_stats.h"
|
2015-05-12 16:51:11 +02:00
|
|
|
#include "webrtc/video_engine/vie_channel.h"
|
2014-02-07 12:06:29 +00:00
|
|
|
#include "webrtc/video_receive_stream.h"
|
|
|
|
|
#include "webrtc/video_renderer.h"
|
|
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
|
|
|
|
class Clock;
|
|
|
|
|
class ViECodec;
|
|
|
|
|
class ViEDecoderObserver;
|
|
|
|
|
|
|
|
|
|
class ReceiveStatisticsProxy : public ViEDecoderObserver,
|
2014-12-19 15:45:03 +00:00
|
|
|
public VCMReceiveStatisticsCallback,
|
2014-02-07 12:06:29 +00:00
|
|
|
public RtcpStatisticsCallback,
|
2015-02-19 12:47:00 +00:00
|
|
|
public RtcpPacketTypeCounterObserver,
|
2014-12-19 15:45:03 +00:00
|
|
|
public StreamDataCountersCallback {
|
2014-02-07 12:06:29 +00:00
|
|
|
public:
|
2014-12-19 15:45:03 +00:00
|
|
|
ReceiveStatisticsProxy(uint32_t ssrc, Clock* clock);
|
2014-02-07 12:06:29 +00:00
|
|
|
virtual ~ReceiveStatisticsProxy();
|
|
|
|
|
|
|
|
|
|
VideoReceiveStream::Stats GetStats() const;
|
|
|
|
|
|
|
|
|
|
void OnDecodedFrame();
|
2015-07-22 06:52:00 -07:00
|
|
|
void OnRenderedFrame(int width, int height);
|
2014-02-07 12:06:29 +00:00
|
|
|
|
2015-07-22 06:52:00 -07:00
|
|
|
// Overrides VCMReceiveStatisticsCallback.
|
2015-03-04 12:58:35 +00:00
|
|
|
void OnReceiveRatesUpdated(uint32_t bitRate, uint32_t frameRate) override;
|
|
|
|
|
void OnFrameCountsUpdated(const FrameCounts& frame_counts) override;
|
|
|
|
|
void OnDiscardedPacketsUpdated(int discarded_packets) override;
|
2014-12-19 15:45:03 +00:00
|
|
|
|
2014-02-07 12:06:29 +00:00
|
|
|
// Overrides ViEDecoderObserver.
|
2015-03-04 12:58:35 +00:00
|
|
|
void IncomingCodecChanged(const int video_channel,
|
|
|
|
|
const VideoCodec& video_codec) override {}
|
|
|
|
|
void IncomingRate(const int video_channel,
|
|
|
|
|
const unsigned int framerate,
|
|
|
|
|
const unsigned int bitrate_bps) override;
|
|
|
|
|
void 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) override;
|
2014-02-07 12:06:29 +00:00
|
|
|
|
2014-12-18 13:50:16 +00:00
|
|
|
// Overrides RtcpStatisticsCallback.
|
2015-03-04 12:58:35 +00:00
|
|
|
void StatisticsUpdated(const webrtc::RtcpStatistics& statistics,
|
|
|
|
|
uint32_t ssrc) override;
|
|
|
|
|
void CNameChanged(const char* cname, uint32_t ssrc) override;
|
2014-02-07 12:06:29 +00:00
|
|
|
|
2015-07-22 06:52:00 -07:00
|
|
|
// Overrides RtcpPacketTypeCounterObserver.
|
2015-03-04 12:58:35 +00:00
|
|
|
void RtcpPacketTypesCounterUpdated(
|
2015-02-19 12:47:00 +00:00
|
|
|
uint32_t ssrc,
|
2015-03-04 12:58:35 +00:00
|
|
|
const RtcpPacketTypeCounter& packet_counter) override;
|
2014-02-07 12:06:29 +00:00
|
|
|
// Overrides StreamDataCountersCallback.
|
2015-03-04 12:58:35 +00:00
|
|
|
void DataCountersUpdated(const webrtc::StreamDataCounters& counters,
|
|
|
|
|
uint32_t ssrc) override;
|
2014-02-07 12:06:29 +00:00
|
|
|
|
2014-12-18 13:50:16 +00:00
|
|
|
private:
|
2015-07-22 06:52:00 -07:00
|
|
|
struct SampleCounter {
|
|
|
|
|
SampleCounter() : sum(0), num_samples(0) {}
|
|
|
|
|
void Add(int sample);
|
|
|
|
|
int Avg(int min_required_samples) const;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
int sum;
|
|
|
|
|
int num_samples;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void UpdateHistograms() EXCLUSIVE_LOCKS_REQUIRED(crit_);
|
|
|
|
|
|
2014-04-28 13:00:21 +00:00
|
|
|
Clock* const clock_;
|
|
|
|
|
|
2015-05-01 13:00:41 +02:00
|
|
|
mutable rtc::CriticalSection crit_;
|
2014-04-28 13:00:21 +00:00
|
|
|
VideoReceiveStream::Stats stats_ GUARDED_BY(crit_);
|
|
|
|
|
RateStatistics decode_fps_estimator_ GUARDED_BY(crit_);
|
|
|
|
|
RateStatistics renders_fps_estimator_ GUARDED_BY(crit_);
|
2015-07-22 06:52:00 -07:00
|
|
|
rtc::RateTracker render_fps_tracker_total_ GUARDED_BY(crit_);
|
|
|
|
|
SampleCounter render_width_counter_ GUARDED_BY(crit_);
|
|
|
|
|
SampleCounter render_height_counter_ GUARDED_BY(crit_);
|
2015-04-27 10:09:49 +02:00
|
|
|
ReportBlockStats report_block_stats_ GUARDED_BY(crit_);
|
2014-02-07 12:06:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
#endif // WEBRTC_VIDEO_RECEIVE_STATISTICS_PROXY_H_
|