* Add webrtc::VoERTP_RTCP::SetReceiveAudioLevelIndicationStatus.

* Cast rtp header extension to int in log in rtp_utility.cc.

BUG=3237
TEST=try bots
R=stefan@webrtc.org, xians@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5975 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
wu@webrtc.org 2014-04-24 20:33:08 +00:00
parent 439a4c49f9
commit 93fd25c20c
6 changed files with 56 additions and 1 deletions

View File

@ -472,7 +472,8 @@ void RTPHeaderParser::ParseOneByteExtensionHeader(
RTPExtensionType type;
if (ptrExtensionMap->GetType(id, &type) != 0) {
// If we encounter an unknown extension, just skip over it.
LOG(LS_WARNING) << "Failed to find extension id: " << id;
LOG(LS_WARNING) << "Failed to find extension id: "
<< static_cast<int>(id);
} else {
switch (type) {
case kRtpExtensionTransmissionTimeOffset: {

View File

@ -3237,6 +3237,17 @@ int Channel::SetSendAudioLevelIndicationStatus(bool enable, unsigned char id) {
return SetSendRtpHeaderExtension(enable, kRtpExtensionAudioLevel, id);
}
int Channel::SetReceiveAudioLevelIndicationStatus(bool enable,
unsigned char id) {
rtp_header_parser_->DeregisterRtpHeaderExtension(
kRtpExtensionAudioLevel);
if (enable && !rtp_header_parser_->RegisterRtpHeaderExtension(
kRtpExtensionAudioLevel, id)) {
return -1;
}
return 0;
}
int Channel::SetSendAbsoluteSenderTimeStatus(bool enable, unsigned char id) {
return SetSendRtpHeaderExtension(enable, kRtpExtensionAbsoluteSendTime, id);
}

View File

@ -319,6 +319,7 @@ public:
int GetRemoteSSRC(unsigned int& ssrc);
int GetRemoteCSRCs(unsigned int arrCSRC[15]);
int SetSendAudioLevelIndicationStatus(bool enable, unsigned char id);
int SetReceiveAudioLevelIndicationStatus(bool enable, unsigned char id);
int SetSendAbsoluteSenderTimeStatus(bool enable, unsigned char id);
int SetReceiveAbsoluteSenderTimeStatus(bool enable, unsigned char id);
int SetRTCPStatus(bool enable);

View File

@ -157,6 +157,15 @@ public:
bool enable,
unsigned char id = 1) = 0;
// Sets the status of receiving rtp-audio-level-indication on a specific
// |channel|.
virtual int SetReceiveAudioLevelIndicationStatus(int channel,
bool enable,
unsigned char id = 1) {
// TODO(wu): Remove default implementation once talk is updated.
return 0;
}
// Sets the status of sending absolute sender time on a specific |channel|.
virtual int SetSendAbsoluteSenderTimeStatus(int channel,
bool enable,

View File

@ -246,6 +246,36 @@ int VoERTP_RTCPImpl::SetSendAudioLevelIndicationStatus(int channel,
return channelPtr->SetSendAudioLevelIndicationStatus(enable, id);
}
int VoERTP_RTCPImpl::SetReceiveAudioLevelIndicationStatus(int channel,
bool enable,
unsigned char id) {
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
"SetReceiveAudioLevelIndicationStatus(channel=%d, enable=%d, id=%u)",
channel, enable, id);
if (!_shared->statistics().Initialized()) {
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
if (enable &&
(id < kVoiceEngineMinRtpExtensionId ||
id > kVoiceEngineMaxRtpExtensionId)) {
// [RFC5285] The 4-bit id is the local identifier of this element in
// the range 1-14 inclusive.
_shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError,
"SetReceiveAbsoluteSenderTimeStatus() invalid id parameter");
return -1;
}
// Set state and id for the specified channel.
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channel_ptr = ch.channel();
if (channel_ptr == NULL) {
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
"SetReceiveAudioLevelIndicationStatus() failed to locate channel");
return -1;
}
return channel_ptr->SetReceiveAudioLevelIndicationStatus(enable, id);
}
int VoERTP_RTCPImpl::SetSendAbsoluteSenderTimeStatus(int channel,
bool enable,
unsigned char id) {

View File

@ -66,6 +66,9 @@ public:
virtual int SetSendAudioLevelIndicationStatus(int channel,
bool enable,
unsigned char id);
virtual int SetReceiveAudioLevelIndicationStatus(int channel,
bool enable,
unsigned char id);
// RTP Header Extension for Absolute Sender Time
virtual int SetSendAbsoluteSenderTimeStatus(int channel,