Revert "Allow AudioSendStream to reconfig AudioNetworkAdaptor"

This reverts commit 4a88120e9568e48ba6e9b12045d56d745da2f34a.

Reason for revert: Found a mistake.

Original change's description:
> Allow AudioSendStream to reconfig AudioNetworkAdaptor
> 
> Bug: b/63898232, b/64053465
> Change-Id: I3485c35c0b74c0e2d654f8d70de0238a617a0ddc
> Reviewed-on: https://chromium-review.googlesource.com/584707
> Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
> Reviewed-by: Michael T <tschumim@webrtc.org>
> Commit-Queue: Minyue Li <minyue@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#19150}

TBR=minyue@webrtc.org,solenberg@webrtc.org,tschumim@webrtc.org

Change-Id: I7f6fdefac91bb119f528f117cb6ab6569202ee9a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: b/63898232, b/64053465
Reviewed-on: https://chromium-review.googlesource.com/586268
Reviewed-by: Minyue Li <minyue@webrtc.org>
Commit-Queue: Minyue Li <minyue@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#19151}
This commit is contained in:
Minyue Li 2017-07-26 10:01:41 +00:00 committed by Commit Bot
parent 4a88120e95
commit 7df370b69c
2 changed files with 9 additions and 42 deletions

View File

@ -487,9 +487,7 @@ bool AudioSendStream::SetupSendCodec(AudioSendStream* stream,
bool AudioSendStream::ReconfigureSendCodec(AudioSendStream* stream,
const Config& new_config) {
const auto& old_config = stream->config_;
if (new_config.send_codec_spec == old_config.send_codec_spec &&
new_config.audio_network_adaptor_config ==
old_config.audio_network_adaptor_config) {
if (new_config.send_codec_spec == old_config.send_codec_spec) {
return true;
}

View File

@ -43,7 +43,6 @@ using testing::Eq;
using testing::Ne;
using testing::Invoke;
using testing::Return;
using testing::StrEq;
const int kChannelId = 1;
const uint32_t kSsrc = 1234;
@ -142,8 +141,7 @@ struct ConfigHelper {
&packet_router_)),
fake_transport_(&packet_router_, send_side_cc_.get()),
bitrate_allocator_(&limit_observer_),
worker_queue_("ConfigHelper_worker_queue"),
audio_encoder_(nullptr) {
worker_queue_("ConfigHelper_worker_queue") {
using testing::Invoke;
EXPECT_CALL(voice_engine_,
@ -208,6 +206,7 @@ struct ConfigHelper {
}
void SetupDefaultChannelProxy(bool audio_bwe_enabled) {
using testing::StrEq;
channel_proxy_ = new testing::StrictMock<MockVoEChannelProxy>();
EXPECT_CALL(*channel_proxy_, GetRtpRtcp(_, _))
.WillRepeatedly(Invoke(
@ -251,25 +250,10 @@ struct ConfigHelper {
void SetupMockForSetupSendCodec(bool expect_set_encoder_call) {
if (expect_set_encoder_call) {
EXPECT_CALL(*channel_proxy_, SetEncoderForMock(_, _))
.WillOnce(Invoke(
[this](int payload_type, std::unique_ptr<AudioEncoder>* encoder) {
this->audio_encoder_ = std::move(*encoder);
return true;
}));
.WillOnce(Return(true));
}
}
void SetupMockForModifyEncoder() {
// Let ModifyEncoder to invoke mock audio encoder.
EXPECT_CALL(*channel_proxy_, ModifyEncoder(_))
.WillRepeatedly(Invoke(
[this](rtc::FunctionView<void(std::unique_ptr<AudioEncoder>*)>
modifier) {
if (this->audio_encoder_)
modifier(&this->audio_encoder_);
}));
}
RtcpRttStats* rtcp_rtt_stats() { return &rtcp_rtt_stats_; }
void SetupMockForSendTelephoneEvent() {
@ -345,7 +329,6 @@ struct ConfigHelper {
// |worker_queue| is defined last to ensure all pending tasks are cancelled
// and deleted before any other members.
rtc::TaskQueue worker_queue_;
std::unique_ptr<AudioEncoder> audio_encoder_;
};
} // namespace
@ -475,27 +458,19 @@ TEST(AudioSendStreamTest, GetStatsTypingNoiseDetected) {
EXPECT_FALSE(send_stream.GetStats().typing_noise_detected);
}
TEST(AudioSendStreamTest, SendCodecAppliesAudioNetworkAdaptor) {
TEST(AudioSendStreamTest, SendCodecAppliesNetworkAdaptor) {
ConfigHelper helper(false, true);
auto stream_config = helper.config();
stream_config.send_codec_spec =
rtc::Optional<AudioSendStream::Config::SendCodecSpec>({0, kOpusFormat});
const std::string kAnaConfigString = "abcde";
const std::string kAnaReconfigString = "12345";
stream_config.audio_network_adaptor_config =
rtc::Optional<std::string>(kAnaConfigString);
rtc::Optional<std::string>("abced");
EXPECT_CALL(helper.mock_encoder_factory(), MakeAudioEncoderMock(_, _, _))
.WillOnce(Invoke([&kAnaConfigString, &kAnaReconfigString](
int payload_type, const SdpAudioFormat& format,
std::unique_ptr<AudioEncoder>* return_value) {
.WillOnce(Invoke([](int payload_type, const SdpAudioFormat& format,
std::unique_ptr<AudioEncoder>* return_value) {
auto mock_encoder = SetupAudioEncoderMock(payload_type, format);
EXPECT_CALL(*mock_encoder,
EnableAudioNetworkAdaptor(StrEq(kAnaConfigString), _))
.WillOnce(Return(true));
EXPECT_CALL(*mock_encoder,
EnableAudioNetworkAdaptor(StrEq(kAnaReconfigString), _))
EXPECT_CALL(*mock_encoder.get(), EnableAudioNetworkAdaptor(_, _))
.WillOnce(Return(true));
*return_value = std::move(mock_encoder);
}));
@ -504,12 +479,6 @@ TEST(AudioSendStreamTest, SendCodecAppliesAudioNetworkAdaptor) {
stream_config, helper.audio_state(), helper.worker_queue(),
helper.transport(), helper.bitrate_allocator(), helper.event_log(),
helper.rtcp_rtt_stats(), rtc::Optional<RtpState>());
stream_config.audio_network_adaptor_config =
rtc::Optional<std::string>(kAnaReconfigString);
helper.SetupMockForModifyEncoder();
send_stream.Reconfigure(stream_config);
}
// VAD is applied when codec is mono and the CNG frequency matches the codec