Add functions to ViE API to enable/disable the absolute send time header extension.
BUG= R=mflodman@webrtc.org Review URL: https://webrtc-codereview.appspot.com/1487004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@4065 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -242,6 +242,16 @@ class WEBRTC_DLLEXPORT ViERTP_RTCP {
|
|||||||
bool enable,
|
bool enable,
|
||||||
int id) = 0;
|
int id) = 0;
|
||||||
|
|
||||||
|
// Enables RTP absolute send time header extension. This call must be done
|
||||||
|
// before ViECodec::SetSendCodec is called.
|
||||||
|
virtual int SetSendAbsoluteSendTimeStatus(int video_channel,
|
||||||
|
bool enable,
|
||||||
|
int id) = 0;
|
||||||
|
|
||||||
|
virtual int SetReceiveAbsoluteSendTimeStatus(int video_channel,
|
||||||
|
bool enable,
|
||||||
|
int id) = 0;
|
||||||
|
|
||||||
// Enables transmission smoothening, i.e. packets belonging to the same frame
|
// Enables transmission smoothening, i.e. packets belonging to the same frame
|
||||||
// will be sent over a longer period of time instead of sending them
|
// will be sent over a longer period of time instead of sending them
|
||||||
// back-to-back.
|
// back-to-back.
|
||||||
|
|||||||
@@ -718,7 +718,7 @@ void ViEAutoTest::ViERtpRtcpAPITest()
|
|||||||
EXPECT_EQ(0, ViE.rtp_rtcp->SetNACKStatus(tbChannel.videoChannel, true));
|
EXPECT_EQ(0, ViE.rtp_rtcp->SetNACKStatus(tbChannel.videoChannel, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Timsetamp offset extension.
|
// Timestamp offset extension.
|
||||||
// Valid range is 1 to 14 inclusive.
|
// Valid range is 1 to 14 inclusive.
|
||||||
EXPECT_EQ(-1, ViE.rtp_rtcp->SetSendTimestampOffsetStatus(
|
EXPECT_EQ(-1, ViE.rtp_rtcp->SetSendTimestampOffsetStatus(
|
||||||
tbChannel.videoChannel, true, 0));
|
tbChannel.videoChannel, true, 0));
|
||||||
@@ -754,6 +754,42 @@ void ViEAutoTest::ViERtpRtcpAPITest()
|
|||||||
EXPECT_EQ(0, ViE.rtp_rtcp->SetReceiveTimestampOffsetStatus(
|
EXPECT_EQ(0, ViE.rtp_rtcp->SetReceiveTimestampOffsetStatus(
|
||||||
tbChannel.videoChannel, false, 3));
|
tbChannel.videoChannel, false, 3));
|
||||||
|
|
||||||
|
// Absolute send time extension.
|
||||||
|
// Valid range is 1 to 14 inclusive.
|
||||||
|
EXPECT_EQ(-1, ViE.rtp_rtcp->SetSendAbsoluteSendTimeStatus(
|
||||||
|
tbChannel.videoChannel, true, 0));
|
||||||
|
EXPECT_EQ(-1, ViE.rtp_rtcp->SetSendAbsoluteSendTimeStatus(
|
||||||
|
tbChannel.videoChannel, true, 15));
|
||||||
|
EXPECT_EQ(0, ViE.rtp_rtcp->SetSendAbsoluteSendTimeStatus(
|
||||||
|
tbChannel.videoChannel, true, 3));
|
||||||
|
EXPECT_EQ(0, ViE.rtp_rtcp->SetSendAbsoluteSendTimeStatus(
|
||||||
|
tbChannel.videoChannel, true, 3));
|
||||||
|
EXPECT_EQ(0, ViE.rtp_rtcp->SetSendAbsoluteSendTimeStatus(
|
||||||
|
tbChannel.videoChannel, false, 3));
|
||||||
|
EXPECT_EQ(0, ViE.rtp_rtcp->SetSendAbsoluteSendTimeStatus(
|
||||||
|
tbChannel.videoChannel, true, 3));
|
||||||
|
EXPECT_EQ(0, ViE.rtp_rtcp->SetSendAbsoluteSendTimeStatus(
|
||||||
|
tbChannel.videoChannel, false, 3));
|
||||||
|
EXPECT_EQ(0, ViE.rtp_rtcp->SetSendAbsoluteSendTimeStatus(
|
||||||
|
tbChannel.videoChannel, false, 3));
|
||||||
|
|
||||||
|
EXPECT_EQ(-1, ViE.rtp_rtcp->SetReceiveAbsoluteSendTimeStatus(
|
||||||
|
tbChannel.videoChannel, true, 0));
|
||||||
|
EXPECT_EQ(-1, ViE.rtp_rtcp->SetReceiveAbsoluteSendTimeStatus(
|
||||||
|
tbChannel.videoChannel, true, 15));
|
||||||
|
EXPECT_EQ(0, ViE.rtp_rtcp->SetReceiveAbsoluteSendTimeStatus(
|
||||||
|
tbChannel.videoChannel, true, 3));
|
||||||
|
EXPECT_EQ(0, ViE.rtp_rtcp->SetReceiveAbsoluteSendTimeStatus(
|
||||||
|
tbChannel.videoChannel, true, 3));
|
||||||
|
EXPECT_EQ(0, ViE.rtp_rtcp->SetReceiveAbsoluteSendTimeStatus(
|
||||||
|
tbChannel.videoChannel, false, 3));
|
||||||
|
EXPECT_EQ(0, ViE.rtp_rtcp->SetReceiveAbsoluteSendTimeStatus(
|
||||||
|
tbChannel.videoChannel, true, 3));
|
||||||
|
EXPECT_EQ(0, ViE.rtp_rtcp->SetReceiveAbsoluteSendTimeStatus(
|
||||||
|
tbChannel.videoChannel, false, 3));
|
||||||
|
EXPECT_EQ(0, ViE.rtp_rtcp->SetReceiveAbsoluteSendTimeStatus(
|
||||||
|
tbChannel.videoChannel, false, 3));
|
||||||
|
|
||||||
// Transmission smoothening.
|
// Transmission smoothening.
|
||||||
const int invalid_channel_id = 17;
|
const int invalid_channel_id = 17;
|
||||||
EXPECT_EQ(-1, ViE.rtp_rtcp->SetTransmissionSmoothingStatus(
|
EXPECT_EQ(-1, ViE.rtp_rtcp->SetTransmissionSmoothingStatus(
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ ViEChannel::ViEChannel(int32_t channel_id,
|
|||||||
bandwidth_observer_(bandwidth_observer),
|
bandwidth_observer_(bandwidth_observer),
|
||||||
rtp_packet_timeout_(false),
|
rtp_packet_timeout_(false),
|
||||||
send_timestamp_extension_id_(kInvalidRtpExtensionId),
|
send_timestamp_extension_id_(kInvalidRtpExtensionId),
|
||||||
|
absolute_send_time_extension_id_(kInvalidRtpExtensionId),
|
||||||
using_packet_spread_(false),
|
using_packet_spread_(false),
|
||||||
external_transport_(NULL),
|
external_transport_(NULL),
|
||||||
decoder_reset_(true),
|
decoder_reset_(true),
|
||||||
@@ -370,6 +371,21 @@ int32_t ViEChannel::SetSendCodec(const VideoCodec& video_codec,
|
|||||||
rtp_rtcp->DeregisterSendRtpHeaderExtension(
|
rtp_rtcp->DeregisterSendRtpHeaderExtension(
|
||||||
kRtpExtensionTransmissionTimeOffset);
|
kRtpExtensionTransmissionTimeOffset);
|
||||||
}
|
}
|
||||||
|
if (absolute_send_time_extension_id_ != kInvalidRtpExtensionId) {
|
||||||
|
// Deregister in case the extension was previously enabled.
|
||||||
|
rtp_rtcp->DeregisterSendRtpHeaderExtension(
|
||||||
|
kRtpExtensionAbsoluteSendTime);
|
||||||
|
if (rtp_rtcp->RegisterSendRtpHeaderExtension(
|
||||||
|
kRtpExtensionAbsoluteSendTime,
|
||||||
|
absolute_send_time_extension_id_) != 0) {
|
||||||
|
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),
|
||||||
|
"%s: could not register absolute send time extension",
|
||||||
|
__FUNCTION__);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
rtp_rtcp->DeregisterSendRtpHeaderExtension(
|
||||||
|
kRtpExtensionAbsoluteSendTime);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// |RegisterSimulcastRtpRtcpModules| resets all old weak pointers and old
|
// |RegisterSimulcastRtpRtcpModules| resets all old weak pointers and old
|
||||||
// modules can be deleted after this step.
|
// modules can be deleted after this step.
|
||||||
@@ -865,6 +881,47 @@ int ViEChannel::SetReceiveTimestampOffsetStatus(bool enable, int id) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ViEChannel::SetSendAbsoluteSendTimeStatus(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.
|
||||||
|
absolute_send_time_extension_id_ = id;
|
||||||
|
rtp_rtcp_->DeregisterSendRtpHeaderExtension(
|
||||||
|
kRtpExtensionAbsoluteSendTime);
|
||||||
|
error = rtp_rtcp_->RegisterSendRtpHeaderExtension(
|
||||||
|
kRtpExtensionAbsoluteSendTime, id);
|
||||||
|
for (std::list<RtpRtcp*>::iterator it = simulcast_rtp_rtcp_.begin();
|
||||||
|
it != simulcast_rtp_rtcp_.end(); it++) {
|
||||||
|
(*it)->DeregisterSendRtpHeaderExtension(
|
||||||
|
kRtpExtensionAbsoluteSendTime);
|
||||||
|
error |= (*it)->RegisterSendRtpHeaderExtension(
|
||||||
|
kRtpExtensionAbsoluteSendTime, id);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Disable the extension.
|
||||||
|
absolute_send_time_extension_id_ = kInvalidRtpExtensionId;
|
||||||
|
rtp_rtcp_->DeregisterSendRtpHeaderExtension(
|
||||||
|
kRtpExtensionAbsoluteSendTime);
|
||||||
|
for (std::list<RtpRtcp*>::iterator it = simulcast_rtp_rtcp_.begin();
|
||||||
|
it != simulcast_rtp_rtcp_.end(); it++) {
|
||||||
|
(*it)->DeregisterSendRtpHeaderExtension(
|
||||||
|
kRtpExtensionAbsoluteSendTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ViEChannel::SetReceiveAbsoluteSendTimeStatus(bool enable, int id) {
|
||||||
|
if (enable) {
|
||||||
|
return rtp_rtcp_->RegisterReceiveRtpHeaderExtension(
|
||||||
|
kRtpExtensionAbsoluteSendTime, id);
|
||||||
|
} else {
|
||||||
|
return rtp_rtcp_->DeregisterReceiveRtpHeaderExtension(
|
||||||
|
kRtpExtensionAbsoluteSendTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ViEChannel::SetTransmissionSmoothingStatus(bool enable) {
|
void ViEChannel::SetTransmissionSmoothingStatus(bool enable) {
|
||||||
assert(paced_sender_ && "No paced sender registered.");
|
assert(paced_sender_ && "No paced sender registered.");
|
||||||
paced_sender_->SetStatus(enable);
|
paced_sender_->SetStatus(enable);
|
||||||
|
|||||||
@@ -123,6 +123,8 @@ class ViEChannel
|
|||||||
bool EnableRemb(bool enable);
|
bool EnableRemb(bool enable);
|
||||||
int SetSendTimestampOffsetStatus(bool enable, int id);
|
int SetSendTimestampOffsetStatus(bool enable, int id);
|
||||||
int SetReceiveTimestampOffsetStatus(bool enable, int id);
|
int SetReceiveTimestampOffsetStatus(bool enable, int id);
|
||||||
|
int SetSendAbsoluteSendTimeStatus(bool enable, int id);
|
||||||
|
int SetReceiveAbsoluteSendTimeStatus(bool enable, int id);
|
||||||
void SetTransmissionSmoothingStatus(bool enable);
|
void SetTransmissionSmoothingStatus(bool enable);
|
||||||
int32_t EnableTMMBR(const bool enable);
|
int32_t EnableTMMBR(const bool enable);
|
||||||
int32_t EnableKeyFrameRequestCallback(const bool enable);
|
int32_t EnableKeyFrameRequestCallback(const bool enable);
|
||||||
@@ -382,6 +384,7 @@ class ViEChannel
|
|||||||
scoped_ptr<RtcpBandwidthObserver> bandwidth_observer_;
|
scoped_ptr<RtcpBandwidthObserver> bandwidth_observer_;
|
||||||
bool rtp_packet_timeout_;
|
bool rtp_packet_timeout_;
|
||||||
int send_timestamp_extension_id_;
|
int send_timestamp_extension_id_;
|
||||||
|
int absolute_send_time_extension_id_;
|
||||||
bool using_packet_spread_;
|
bool using_packet_spread_;
|
||||||
|
|
||||||
Transport* external_transport_;
|
Transport* external_transport_;
|
||||||
|
|||||||
@@ -194,13 +194,6 @@ bool ViEEncoder::Init() {
|
|||||||
"%s RegisterSendPayload failure", __FUNCTION__);
|
"%s RegisterSendPayload failure", __FUNCTION__);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (default_rtp_rtcp_->RegisterSendRtpHeaderExtension(
|
|
||||||
kRtpExtensionTransmissionTimeOffset, 1) != 0) {
|
|
||||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo,
|
|
||||||
ViEId(engine_id_, channel_id_),
|
|
||||||
"%s RegisterSendRtpHeaderExtension failure", __FUNCTION__);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
VideoCodec video_codec;
|
VideoCodec video_codec;
|
||||||
if (vcm_.Codec(webrtc::kVideoCodecI420, &video_codec) == VCM_OK) {
|
if (vcm_.Codec(webrtc::kVideoCodecI420, &video_codec) == VCM_OK) {
|
||||||
|
|||||||
@@ -765,6 +765,53 @@ int ViERTP_RTCPImpl::SetReceiveTimestampOffsetStatus(int video_channel,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ViERTP_RTCPImpl::SetSendAbsoluteSendTimeStatus(int video_channel,
|
||||||
|
bool enable,
|
||||||
|
int id) {
|
||||||
|
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
|
||||||
|
ViEId(shared_data_->instance_id(), video_channel),
|
||||||
|
"ViERTP_RTCPImpl::SetSendAbsoluteSendTimeStatus(%d, %d, %d)",
|
||||||
|
video_channel, enable, id);
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
if (vie_channel->SetSendAbsoluteSendTimeStatus(enable, id) != 0) {
|
||||||
|
shared_data_->SetLastError(kViERtpRtcpUnknownError);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ViERTP_RTCPImpl::SetReceiveAbsoluteSendTimeStatus(int video_channel,
|
||||||
|
bool enable,
|
||||||
|
int id) {
|
||||||
|
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
|
||||||
|
ViEId(shared_data_->instance_id(), video_channel),
|
||||||
|
"ViERTP_RTCPImpl::SetReceiveAbsoluteSendTimeStatus(%d, %d, %d)",
|
||||||
|
video_channel, enable, id);
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
if (vie_channel->SetReceiveAbsoluteSendTimeStatus(enable, id) != 0) {
|
||||||
|
shared_data_->SetLastError(kViERtpRtcpUnknownError);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int ViERTP_RTCPImpl::SetTransmissionSmoothingStatus(int video_channel,
|
int ViERTP_RTCPImpl::SetTransmissionSmoothingStatus(int video_channel,
|
||||||
bool enable) {
|
bool enable) {
|
||||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
|
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
|
||||||
|
|||||||
@@ -82,6 +82,12 @@ class ViERTP_RTCPImpl
|
|||||||
virtual int SetReceiveTimestampOffsetStatus(int video_channel,
|
virtual int SetReceiveTimestampOffsetStatus(int video_channel,
|
||||||
bool enable,
|
bool enable,
|
||||||
int id);
|
int id);
|
||||||
|
virtual int SetSendAbsoluteSendTimeStatus(int video_channel,
|
||||||
|
bool enable,
|
||||||
|
int id);
|
||||||
|
virtual int SetReceiveAbsoluteSendTimeStatus(int video_channel,
|
||||||
|
bool enable,
|
||||||
|
int id);
|
||||||
virtual int SetTransmissionSmoothingStatus(int video_channel, bool enable);
|
virtual int SetTransmissionSmoothingStatus(int video_channel, bool enable);
|
||||||
virtual int GetReceivedRTCPStatistics(const int video_channel,
|
virtual int GetReceivedRTCPStatistics(const int video_channel,
|
||||||
uint16_t& fraction_lost,
|
uint16_t& fraction_lost,
|
||||||
|
|||||||
Reference in New Issue
Block a user