summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjiayl@webrtc.org <jiayl@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d>2014-02-27 22:32:40 +0000
committerjiayl@webrtc.org <jiayl@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d>2014-02-27 22:32:40 +0000
commit55a2a27d1a1aa9bf8401312a0b31250af4e3bd11 (patch)
tree10e31d44e5a34d6cba8c00928a089a414072e623
parenta1a60018a1f1ec863451ad0ed4eae58239882920 (diff)
downloadwebrtc-55a2a27d1a1aa9bf8401312a0b31250af4e3bd11.tar.gz
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/webrtc@5621 4adac7df-926f-26a2-2b94-8c16560cd09d
-rw-r--r--modules/pacing/include/paced_sender.h1
-rw-r--r--modules/pacing/paced_sender_unittest.cc3
-rw-r--r--video_engine/include/vie_rtp_rtcp.h7
-rw-r--r--video_engine/vie_encoder.cc4
-rw-r--r--video_engine/vie_encoder.h1
-rw-r--r--video_engine/vie_rtp_rtcp_impl.cc19
-rw-r--r--video_engine/vie_rtp_rtcp_impl.h2
7 files changed, 36 insertions, 1 deletions
diff --git a/modules/pacing/include/paced_sender.h b/modules/pacing/include/paced_sender.h
index 04546900..45c89b77 100644
--- a/modules/pacing/include/paced_sender.h
+++ b/modules/pacing/include/paced_sender.h
@@ -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() {}
};
diff --git a/modules/pacing/paced_sender_unittest.cc b/modules/pacing/paced_sender_unittest.cc
index f8dcdfc6..a99101db 100644
--- a/modules/pacing/paced_sender_unittest.cc
+++ b/modules/pacing/paced_sender_unittest.cc
@@ -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());
diff --git a/video_engine/include/vie_rtp_rtcp.h b/video_engine/include/vie_rtp_rtcp.h
index c76d2bb2..a358e480 100644
--- a/video_engine/include/vie_rtp_rtcp.h
+++ b/video_engine/include/vie_rtp_rtcp.h
@@ -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
diff --git a/video_engine/vie_encoder.cc b/video_engine/vie_encoder.cc
index 6be93506..dae1c1a5 100644
--- a/video_engine/vie_encoder.cc
+++ b/video_engine/vie_encoder.cc
@@ -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",
diff --git a/video_engine/vie_encoder.h b/video_engine/vie_encoder.h
index 24bd7202..d3271c31 100644
--- a/video_engine/vie_encoder.h
+++ b/video_engine/vie_encoder.h
@@ -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;
diff --git a/video_engine/vie_rtp_rtcp_impl.cc b/video_engine/vie_rtp_rtcp_impl.cc
index 627c5308..54afa93c 100644
--- a/video_engine/vie_rtp_rtcp_impl.cc
+++ b/video_engine/vie_rtp_rtcp_impl.cc
@@ -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) {
diff --git a/video_engine/vie_rtp_rtcp_impl.h b/video_engine/vie_rtp_rtcp_impl.h
index 0341d74c..227fa5e4 100644
--- a/video_engine/vie_rtp_rtcp_impl.h
+++ b/video_engine/vie_rtp_rtcp_impl.h
@@ -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);