Adds APIs for reporting pacer queuing delay.

BUG=2775
R=stefan@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/8959005

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5621 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
jiayl@webrtc.org
2014-02-27 22:32:40 +00:00
parent 56e4a05053
commit 9fd8d87ff5
7 changed files with 36 additions and 1 deletions

View File

@ -49,6 +49,7 @@ class PacedSender : public Module {
bool retransmission) = 0;
// Called when it's a good time to send a padding data.
virtual int TimeToSendPadding(int bytes) = 0;
protected:
virtual ~Callback() {}
};

View File

@ -421,7 +421,8 @@ TEST_F(PacedSenderTest, Pause) {
EXPECT_EQ(0, send_bucket_->TimeUntilNextProcess());
EXPECT_EQ(0, send_bucket_->Process());
EXPECT_CALL(callback_, TimeToSendPacket(_, _, second_capture_time_ms, false))
EXPECT_CALL(
callback_, TimeToSendPacket(_, _, second_capture_time_ms, false))
.Times(1)
.WillRepeatedly(Return(true));
EXPECT_EQ(5, send_bucket_->TimeUntilNextProcess());

View File

@ -405,6 +405,13 @@ class WEBRTC_DLLEXPORT ViERTP_RTCP {
const int video_channel,
ReceiveBandwidthEstimatorStats* output) const { return -1; }
// This function gets the PacedSender queuing delay for the last sent frame.
// TODO(jiayl): remove the default impl when libjingle is updated.
virtual int GetPacerQueuingDelayMs(
const int video_channel, int* delay_ms) 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

View File

@ -734,6 +734,10 @@ int32_t ViEEncoder::SendCodecStatistics(
return 0;
}
int32_t ViEEncoder::PacerQueuingDelayMs() const {
return paced_sender_->QueueInMs();
}
int32_t ViEEncoder::EstimatedSendBandwidth(
uint32_t* available_bandwidth) const {
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s",

View File

@ -109,6 +109,7 @@ class ViEEncoder
int32_t SendCodecStatistics(uint32_t* num_key_frames,
uint32_t* num_delta_frames);
int PacerQueuingDelayMs() const;
int32_t EstimatedSendBandwidth(
uint32_t* available_bandwidth) const;

View File

@ -1040,6 +1040,25 @@ int ViERTP_RTCPImpl::GetReceiveBandwidthEstimatorStats(
return 0;
}
int ViERTP_RTCPImpl::GetPacerQueuingDelayMs(
const int video_channel, int* delay_ms) const {
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
ViEId(shared_data_->instance_id(), video_channel),
"%s(channel: %d)", __FUNCTION__, video_channel);
ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
ViEEncoder* vie_encoder = cs.Encoder(video_channel);
if (!vie_encoder) {
WEBRTC_TRACE(kTraceError, kTraceVideo,
ViEId(shared_data_->instance_id(), video_channel),
"%s: Could not get encoder for channel %d", __FUNCTION__,
video_channel);
shared_data_->SetLastError(kViERtpRtcpInvalidChannelId);
return -1;
}
*delay_ms = vie_encoder->PacerQueuingDelayMs();
return 0;
}
int ViERTP_RTCPImpl::StartRTPDump(const int video_channel,
const char file_nameUTF8[1024],
RTPDirections direction) {

View File

@ -116,6 +116,8 @@ class ViERTP_RTCPImpl
unsigned int* estimated_bandwidth) const;
virtual int GetReceiveBandwidthEstimatorStats(
const int video_channel, ReceiveBandwidthEstimatorStats* output) const;
virtual int GetPacerQueuingDelayMs(const int video_channel,
int* delay_ms) const;
virtual int StartRTPDump(const int video_channel,
const char file_nameUTF8[1024],
RTPDirections direction);