Add API for transmission smotthening.
BUG=818
TEST=Only API tests added now.
Review URL: https://webrtc-codereview.appspot.com/787009
git-svn-id: http://webrtc.googlecode.com/svn/trunk@2756 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/src/video_engine/include/vie_rtp_rtcp.h b/src/video_engine/include/vie_rtp_rtcp.h
index 15eef35..f19171d 100644
--- a/src/video_engine/include/vie_rtp_rtcp.h
+++ b/src/video_engine/include/vie_rtp_rtcp.h
@@ -219,6 +219,14 @@
bool enable,
int id) = 0;
+ // Enables transmission smoothening, i.e. packets belonging to the same frame
+ // will be sent over a longer period of time instead of sending them
+ // back-to-back.
+ // NOTE: This is still experimental functionality.
+ // TODO(mflodman) Remove this note when BUG=818 is closed.
+ virtual int SetTransmissionSmoothingStatus(int video_channel,
+ bool enable) = 0;
+
// This function returns our locally created statistics of the received RTP
// stream.
virtual int GetReceivedRTCPStatistics(
diff --git a/src/video_engine/test/auto_test/source/vie_autotest_rtp_rtcp.cc b/src/video_engine/test/auto_test/source/vie_autotest_rtp_rtcp.cc
index 98e9507..0054830 100644
--- a/src/video_engine/test/auto_test/source/vie_autotest_rtp_rtcp.cc
+++ b/src/video_engine/test/auto_test/source/vie_autotest_rtp_rtcp.cc
@@ -648,7 +648,18 @@
EXPECT_EQ(0, ViE.rtp_rtcp->SetReceiveTimestampOffsetStatus(
tbChannel.videoChannel, false, 3));
-
+ // Transmission smoothening.
+ const int invalid_channel_id = 17;
+ EXPECT_EQ(-1, ViE.rtp_rtcp->SetTransmissionSmoothingStatus(
+ invalid_channel_id, true));
+ EXPECT_EQ(0, ViE.rtp_rtcp->SetTransmissionSmoothingStatus(
+ tbChannel.videoChannel, true));
+ EXPECT_EQ(0, ViE.rtp_rtcp->SetTransmissionSmoothingStatus(
+ tbChannel.videoChannel, true));
+ EXPECT_EQ(0, ViE.rtp_rtcp->SetTransmissionSmoothingStatus(
+ tbChannel.videoChannel, false));
+ EXPECT_EQ(0, ViE.rtp_rtcp->SetTransmissionSmoothingStatus(
+ tbChannel.videoChannel, false));
//***************************************************************
// Testing finished. Tear down Video Engine
diff --git a/src/video_engine/vie_channel.cc b/src/video_engine/vie_channel.cc
index 98ac6b1..1a259e4 100644
--- a/src/video_engine/vie_channel.cc
+++ b/src/video_engine/vie_channel.cc
@@ -230,6 +230,7 @@
rtp_rtcp_->SetSendingStatus(false);
}
NACKMethod nack_method = rtp_rtcp_->NACK();
+ bool transmission_smoothening = rtp_rtcp_->TransmissionSmoothingStatus();
CriticalSectionScoped cs(rtp_rtcp_cs_.get());
@@ -290,6 +291,7 @@
if (mtu_ != 0) {
rtp_rtcp->SetMaxTransferUnit(mtu_);
}
+ rtp_rtcp->SetTransmissionSmoothingStatus(transmission_smoothening);
if (restart_rtp) {
rtp_rtcp->SetSendingStatus(true);
}
@@ -685,6 +687,7 @@
}
int ViEChannel::SetSendTimestampOffsetStatus(bool enable, int id) {
+ CriticalSectionScoped cs(rtp_rtcp_cs_.get());
int error = 0;
if (enable) {
// Enable the extension, but disable possible old id to avoid errors.
@@ -724,6 +727,15 @@
}
}
+void ViEChannel::SetTransmissionSmoothingStatus(bool enable) {
+ CriticalSectionScoped cs(rtp_rtcp_cs_.get());
+ rtp_rtcp_->SetTransmissionSmoothingStatus(enable);
+ for (std::list<RtpRtcp*>::iterator it = simulcast_rtp_rtcp_.begin();
+ it != simulcast_rtp_rtcp_.end(); ++it) {
+ (*it)->SetTransmissionSmoothingStatus(enable);
+ }
+}
+
WebRtc_Word32 ViEChannel::EnableTMMBR(const bool enable) {
WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_),
"%s: %d", __FUNCTION__, enable);
diff --git a/src/video_engine/vie_channel.h b/src/video_engine/vie_channel.h
index f9c7b8d..bdf03fd 100644
--- a/src/video_engine/vie_channel.h
+++ b/src/video_engine/vie_channel.h
@@ -109,6 +109,7 @@
bool EnableRemb(bool enable);
int SetSendTimestampOffsetStatus(bool enable, int id);
int SetReceiveTimestampOffsetStatus(bool enable, int id);
+ void SetTransmissionSmoothingStatus(bool enable);
WebRtc_Word32 EnableTMMBR(const bool enable);
WebRtc_Word32 EnableKeyFrameRequestCallback(const bool enable);
diff --git a/src/video_engine/vie_rtp_rtcp_impl.cc b/src/video_engine/vie_rtp_rtcp_impl.cc
index b4b4746..8a444df 100644
--- a/src/video_engine/vie_rtp_rtcp_impl.cc
+++ b/src/video_engine/vie_rtp_rtcp_impl.cc
@@ -660,6 +660,25 @@
return 0;
}
+int ViERTP_RTCPImpl::SetTransmissionSmoothingStatus(int video_channel,
+ bool enable) {
+ WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
+ ViEId(shared_data_->instance_id(), video_channel),
+ "%s(channel: %d, enble: %d)", __FUNCTION__, video_channel,
+ enable);
+ 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: Channel %d doesn't exist", __FUNCTION__, video_channel);
+ shared_data_->SetLastError(kViERtpRtcpInvalidChannelId);
+ return -1;
+ }
+ vie_channel->SetTransmissionSmoothingStatus(enable);
+ return 0;
+}
+
int ViERTP_RTCPImpl::GetReceivedRTCPStatistics(const int video_channel,
uint16_t& fraction_lost,
unsigned int& cumulative_lost,
diff --git a/src/video_engine/vie_rtp_rtcp_impl.h b/src/video_engine/vie_rtp_rtcp_impl.h
index 7c1614b..35db129 100644
--- a/src/video_engine/vie_rtp_rtcp_impl.h
+++ b/src/video_engine/vie_rtp_rtcp_impl.h
@@ -74,6 +74,7 @@
virtual int SetReceiveTimestampOffsetStatus(int video_channel,
bool enable,
int id);
+ virtual int SetTransmissionSmoothingStatus(int video_channel, bool enable);
virtual int GetReceivedRTCPStatistics(const int video_channel,
uint16_t& fraction_lost,
unsigned int& cumulative_lost,