diff --git a/webrtc/modules/rtp_rtcp/source/rtp_sender_audio.cc b/webrtc/modules/rtp_rtcp/source/rtp_sender_audio.cc index c3725c3456..b95b40a411 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_sender_audio.cc +++ b/webrtc/modules/rtp_rtcp/source/rtp_sender_audio.cc @@ -487,7 +487,7 @@ int32_t RTPSenderAudio::SetAudioLevelIndicationStatus(const bool enable, const uint8_t ID) { - if(ID < 1 || ID > 14) + if(enable && (ID < 1 || ID > 14)) { return -1; } diff --git a/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc index 28bfea5f3c..96d518a366 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc +++ b/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc @@ -547,6 +547,7 @@ TEST_F(RtpSenderAudioTest, BuildRTPPacketWithAudioLevelExtension) { VerifyRTPHeaderCommon(rtp_header2); EXPECT_EQ(length, rtp_header2.headerLength); // TODO(solenberg): Should verify that we didn't get audio level. + EXPECT_EQ(0, rtp_sender_->SetAudioLevelIndicationStatus(false, 0)); } TEST_F(RtpSenderAudioTest, SendAudio) { @@ -612,6 +613,7 @@ TEST_F(RtpSenderAudioTest, SendAudioWithAudioLevelExtension) { EXPECT_EQ(0, memcmp(extension, payload_data - sizeof(extension), sizeof(extension))); + EXPECT_EQ(0, rtp_sender_->SetAudioLevelIndicationStatus(false, 0)); } } // namespace webrtc diff --git a/webrtc/voice_engine/test/auto_test/voe_extended_test.cc b/webrtc/voice_engine/test/auto_test/voe_extended_test.cc index bb2838ec52..d0f4833112 100644 --- a/webrtc/voice_engine/test/auto_test/voe_extended_test.cc +++ b/webrtc/voice_engine/test/auto_test/voe_extended_test.cc @@ -4525,12 +4525,14 @@ int VoEExtendedTest::TestRTP_RTCP() { TEST_MUSTPASS(-1 != rtp_rtcp->SetRTPAudioLevelIndicationStatus(0, true, 15)); MARK(); TEST_ERROR(VE_INVALID_ARGUMENT); - TEST_MUSTPASS(-1 != rtp_rtcp->SetRTPAudioLevelIndicationStatus(0, false, 15)); - MARK(); TEST_MUSTPASS(-1 != rtp_rtcp->SetRTPAudioLevelIndicationStatus(1, true, 5)); MARK(); TEST_ERROR(VE_CHANNEL_NOT_VALID); + // test any id can be used on disabling. + TEST_MUSTPASS(0 != rtp_rtcp->SetRTPAudioLevelIndicationStatus(0, false, 0)); + MARK(); + // test complete valid input range [1,14] bool audioLevelEnabled(false); unsigned char ID(0); diff --git a/webrtc/voice_engine/voe_rtp_rtcp_impl.cc b/webrtc/voice_engine/voe_rtp_rtcp_impl.cc index 102e09e3cb..b49ea41c82 100644 --- a/webrtc/voice_engine/voe_rtp_rtcp_impl.cc +++ b/webrtc/voice_engine/voe_rtp_rtcp_impl.cc @@ -224,8 +224,8 @@ int VoERTP_RTCPImpl::SetRTPAudioLevelIndicationStatus(int channel, _shared->SetLastError(VE_NOT_INITED, kTraceError); return -1; } - if (ID < kVoiceEngineMinRtpExtensionId || - ID > kVoiceEngineMaxRtpExtensionId) + if (enable && (ID < kVoiceEngineMinRtpExtensionId || + ID > kVoiceEngineMaxRtpExtensionId)) { // [RFC5285] The 4-bit ID is the local identifier of this element in // the range 1-14 inclusive.