diff --git a/webrtc/modules/rtp_rtcp/source/rtp_utility.cc b/webrtc/modules/rtp_rtcp/source/rtp_utility.cc index 3f998454cd..c1f3c64274 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_utility.cc +++ b/webrtc/modules/rtp_rtcp/source/rtp_utility.cc @@ -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(id); } else { switch (type) { case kRtpExtensionTransmissionTimeOffset: { diff --git a/webrtc/voice_engine/channel.cc b/webrtc/voice_engine/channel.cc index fb73c13973..5f6de0e3be 100644 --- a/webrtc/voice_engine/channel.cc +++ b/webrtc/voice_engine/channel.cc @@ -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); } diff --git a/webrtc/voice_engine/channel.h b/webrtc/voice_engine/channel.h index 8f47b48c63..8166f1c275 100644 --- a/webrtc/voice_engine/channel.h +++ b/webrtc/voice_engine/channel.h @@ -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); diff --git a/webrtc/voice_engine/include/voe_rtp_rtcp.h b/webrtc/voice_engine/include/voe_rtp_rtcp.h index 0dd649ec97..448cfc6ada 100644 --- a/webrtc/voice_engine/include/voe_rtp_rtcp.h +++ b/webrtc/voice_engine/include/voe_rtp_rtcp.h @@ -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, diff --git a/webrtc/voice_engine/voe_rtp_rtcp_impl.cc b/webrtc/voice_engine/voe_rtp_rtcp_impl.cc index e20695af1b..e25a933b86 100644 --- a/webrtc/voice_engine/voe_rtp_rtcp_impl.cc +++ b/webrtc/voice_engine/voe_rtp_rtcp_impl.cc @@ -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) { diff --git a/webrtc/voice_engine/voe_rtp_rtcp_impl.h b/webrtc/voice_engine/voe_rtp_rtcp_impl.h index f902b662cd..b89c0dcf52 100644 --- a/webrtc/voice_engine/voe_rtp_rtcp_impl.h +++ b/webrtc/voice_engine/voe_rtp_rtcp_impl.h @@ -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,