Add stats of incoming frame delays for debugging bandwidth estimation.
BUG=crbug/338380 R=stefan@webrtc.org Review URL: https://webrtc-codereview.appspot.com/8119004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5519 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
82387e4608
commit
1f64f06784
@ -37,6 +37,27 @@ class RemoteBitrateObserver {
|
||||
virtual ~RemoteBitrateObserver() {}
|
||||
};
|
||||
|
||||
struct ReceiveBandwidthEstimatorStats {
|
||||
ReceiveBandwidthEstimatorStats() : total_propagation_time_delta_ms(0) {}
|
||||
|
||||
// The "propagation_time_delta" of a frame is defined as (d_arrival - d_sent),
|
||||
// where d_arrival is the delta of the arrival times of the frame and the
|
||||
// previous frame, d_sent is the delta of the sent times of the frame and
|
||||
// the previous frame. The sent time is calculated from the RTP timestamp.
|
||||
|
||||
// |total_propagation_time_delta_ms| is the sum of the propagation_time_deltas
|
||||
// of all received frames, except that it's is adjusted to 0 when it becomes
|
||||
// negative.
|
||||
int64_t total_propagation_time_delta_ms;
|
||||
// The propagation_time_deltas for the frames arrived in the last
|
||||
// kProcessIntervalMs using the clock passed to
|
||||
// RemoteBitrateEstimatorFactory::Create.
|
||||
std::vector<int64_t> recent_propagation_time_delta_ms;
|
||||
// The arrival times for the frames arrived in the last kProcessIntervalMs
|
||||
// using the clock passed to RemoteBitrateEstimatorFactory::Create.
|
||||
std::vector<int64_t> recent_arrival_time_ms;
|
||||
};
|
||||
|
||||
class RemoteBitrateEstimator : public CallStatsObserver, public Module {
|
||||
public:
|
||||
virtual ~RemoteBitrateEstimator() {}
|
||||
@ -58,6 +79,9 @@ class RemoteBitrateEstimator : public CallStatsObserver, public Module {
|
||||
virtual bool LatestEstimate(std::vector<unsigned int>* ssrcs,
|
||||
unsigned int* bitrate_bps) const = 0;
|
||||
|
||||
// Returns true if the statistics are available.
|
||||
virtual bool GetStats(ReceiveBandwidthEstimatorStats* output) const = 0;
|
||||
|
||||
protected:
|
||||
static const int kProcessIntervalMs = 1000;
|
||||
static const int kStreamTimeOutMs = 2000;
|
||||
|
@ -55,6 +55,9 @@ class RemoteBitrateEstimatorSingleStream : public RemoteBitrateEstimator {
|
||||
virtual bool LatestEstimate(std::vector<unsigned int>* ssrcs,
|
||||
unsigned int* bitrate_bps) const OVERRIDE;
|
||||
|
||||
virtual bool GetStats(
|
||||
ReceiveBandwidthEstimatorStats* output) const OVERRIDE;
|
||||
|
||||
private:
|
||||
typedef std::map<unsigned int, OveruseDetector> SsrcOveruseDetectorMap;
|
||||
|
||||
@ -210,6 +213,12 @@ bool RemoteBitrateEstimatorSingleStream::LatestEstimate(
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RemoteBitrateEstimatorSingleStream::GetStats(
|
||||
ReceiveBandwidthEstimatorStats* output) const {
|
||||
// Not implemented.
|
||||
return false;
|
||||
}
|
||||
|
||||
void RemoteBitrateEstimatorSingleStream::GetSsrcs(
|
||||
std::vector<unsigned int>* ssrcs) const {
|
||||
assert(ssrcs);
|
||||
|
@ -27,6 +27,7 @@
|
||||
namespace webrtc {
|
||||
|
||||
class VideoEngine;
|
||||
struct ReceiveBandwidthEstimatorStats;
|
||||
|
||||
// This enumerator sets the RTCP mode.
|
||||
enum ViERTCPMode {
|
||||
@ -389,6 +390,13 @@ class WEBRTC_DLLEXPORT ViERTP_RTCP {
|
||||
const int video_channel,
|
||||
unsigned int* estimated_bandwidth) const = 0;
|
||||
|
||||
// This function gets the receive-side bandwidth esitmator statistics.
|
||||
// TODO(jiayl): remove the default impl when libjingle's FakeWebRtcVideoEngine
|
||||
// is updated.
|
||||
virtual int GetReceiveBandwidthEstimatorStats(
|
||||
const int video_channel,
|
||||
ReceiveBandwidthEstimatorStats* output) const { return -1; }
|
||||
|
||||
// This function enables capturing of RTP packets to a binary file on a
|
||||
// specific channel and for a given direction. The file can later be
|
||||
// replayed using e.g. RTP Tools rtpplay since the binary file format is
|
||||
|
@ -1457,6 +1457,11 @@ void ViEChannel::GetEstimatedReceiveBandwidth(
|
||||
vie_receiver_.EstimatedReceiveBandwidth(estimated_bandwidth);
|
||||
}
|
||||
|
||||
void ViEChannel::GetReceiveBandwidthEstimatorStats(
|
||||
ReceiveBandwidthEstimatorStats* output) const {
|
||||
vie_receiver_.GetReceiveBandwidthEstimatorStats(output);
|
||||
}
|
||||
|
||||
int32_t ViEChannel::StartRTPDump(const char file_nameUTF8[1024],
|
||||
RTPDirections direction) {
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",
|
||||
|
@ -209,6 +209,8 @@ class ViEChannel
|
||||
uint32_t* nackBitrateSent) const;
|
||||
bool GetSendSideDelay(int* avg_send_delay, int* max_send_delay) const;
|
||||
void GetEstimatedReceiveBandwidth(uint32_t* estimated_bandwidth) const;
|
||||
void GetReceiveBandwidthEstimatorStats(
|
||||
ReceiveBandwidthEstimatorStats* output) const;
|
||||
|
||||
// Called on any new send bitrate estimate.
|
||||
void RegisterSendBitrateObserver(BitrateStatisticsObserver* observer);
|
||||
|
@ -85,6 +85,11 @@ class WrappingBitrateEstimator : public RemoteBitrateEstimator {
|
||||
return rbe_->LatestEstimate(ssrcs, bitrate_bps);
|
||||
}
|
||||
|
||||
virtual bool GetStats(ReceiveBandwidthEstimatorStats* output) const {
|
||||
CriticalSectionScoped cs(crit_sect_.get());
|
||||
return rbe_->GetStats(output);
|
||||
}
|
||||
|
||||
private:
|
||||
// Instantiate RBE for Time Offset or Absolute Send Time extensions.
|
||||
void PickEstimator(const RTPHeader& header) {
|
||||
|
@ -458,6 +458,11 @@ void ViEReceiver::EstimatedReceiveBandwidth(
|
||||
}
|
||||
}
|
||||
|
||||
void ViEReceiver::GetReceiveBandwidthEstimatorStats(
|
||||
ReceiveBandwidthEstimatorStats* output) const {
|
||||
remote_bitrate_estimator_->GetStats(output);
|
||||
}
|
||||
|
||||
ReceiveStatistics* ViEReceiver::GetReceiveStatistics() const {
|
||||
return rtp_receive_statistics_.get();
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ class RTPPayloadRegistry;
|
||||
class RtpReceiver;
|
||||
class RtpRtcp;
|
||||
class VideoCodingModule;
|
||||
struct ReceiveBandwidthEstimatorStats;
|
||||
|
||||
class ViEReceiver : public RtpData {
|
||||
public:
|
||||
@ -85,6 +86,9 @@ class ViEReceiver : public RtpData {
|
||||
|
||||
void EstimatedReceiveBandwidth(unsigned int* available_bandwidth) const;
|
||||
|
||||
void GetReceiveBandwidthEstimatorStats(
|
||||
ReceiveBandwidthEstimatorStats* output) const;
|
||||
|
||||
ReceiveStatistics* GetReceiveStatistics() const;
|
||||
|
||||
private:
|
||||
|
@ -1003,6 +1003,26 @@ int ViERTP_RTCPImpl::GetEstimatedReceiveBandwidth(
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ViERTP_RTCPImpl::GetReceiveBandwidthEstimatorStats(
|
||||
const int video_channel,
|
||||
ReceiveBandwidthEstimatorStats* output) const {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"%s(channel: %d)", __FUNCTION__, video_channel);
|
||||
ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
|
||||
ViEChannel* vie_channel = cs.Channel(video_channel);
|
||||
if (!vie_channel) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"%s: Could not get channel %d", __FUNCTION__,
|
||||
video_channel);
|
||||
shared_data_->SetLastError(kViERtpRtcpInvalidChannelId);
|
||||
return -1;
|
||||
}
|
||||
vie_channel->GetReceiveBandwidthEstimatorStats(output);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ViERTP_RTCPImpl::StartRTPDump(const int video_channel,
|
||||
const char file_nameUTF8[1024],
|
||||
RTPDirections direction) {
|
||||
|
@ -110,6 +110,8 @@ class ViERTP_RTCPImpl
|
||||
virtual int GetEstimatedReceiveBandwidth(
|
||||
const int video_channel,
|
||||
unsigned int* estimated_bandwidth) const;
|
||||
virtual int GetReceiveBandwidthEstimatorStats(
|
||||
const int video_channel, ReceiveBandwidthEstimatorStats* output) const;
|
||||
virtual int StartRTPDump(const int video_channel,
|
||||
const char file_nameUTF8[1024],
|
||||
RTPDirections direction);
|
||||
|
Loading…
x
Reference in New Issue
Block a user