Adds CallEncoder to ChannelSend.
Since it's a common pattern it makes sense to explicitly provide the
interface rather than reimplementing it every time it's used.
Bug: webrtc:9883
Change-Id: I4dca84bd7c8616fcbcbaba511718671a3668e743
Reviewed-on: https://webrtc-review.googlesource.com/c/122300
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Oskar Sundbom <ossu@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26664}
diff --git a/audio/audio_send_stream_unittest.cc b/audio/audio_send_stream_unittest.cc
index 0f5edd7..70f6c72 100644
--- a/audio/audio_send_stream_unittest.cc
+++ b/audio/audio_send_stream_unittest.cc
@@ -222,14 +222,13 @@
}
}
- void SetupMockForModifyEncoder() {
+ void SetupMockForCallEncoder() {
// Let ModifyEncoder to invoke mock audio encoder.
- EXPECT_CALL(*channel_send_, ModifyEncoder(_))
+ EXPECT_CALL(*channel_send_, CallEncoder(_))
.WillRepeatedly(
- [this](rtc::FunctionView<void(std::unique_ptr<AudioEncoder>*)>
- modifier) {
+ [this](rtc::FunctionView<void(AudioEncoder*)> modifier) {
if (this->audio_encoder_)
- modifier(&this->audio_encoder_);
+ modifier(this->audio_encoder_.get());
});
}
@@ -426,7 +425,7 @@
auto stream_config = helper.config();
stream_config.audio_network_adaptor_config = kAnaReconfigString;
- helper.SetupMockForModifyEncoder();
+ helper.SetupMockForCallEncoder();
send_stream->Reconfigure(stream_config);
}
@@ -521,8 +520,8 @@
.Times(1);
}
- // ModifyEncoder will be called to re-set overhead.
- EXPECT_CALL(*helper.channel_send(), ModifyEncoder(testing::_)).Times(1);
+ // CallEncoder will be called to re-set overhead.
+ EXPECT_CALL(*helper.channel_send(), CallEncoder(testing::_)).Times(1);
send_stream->Reconfigure(new_config);
}
@@ -532,8 +531,8 @@
auto send_stream = helper.CreateAudioSendStream();
auto new_config = helper.config();
- // ModifyEncoder will be called on overhead change.
- EXPECT_CALL(*helper.channel_send(), ModifyEncoder(testing::_)).Times(1);
+ // CallEncoder will be called on overhead change.
+ EXPECT_CALL(*helper.channel_send(), CallEncoder(testing::_)).Times(1);
const size_t transport_overhead_per_packet_bytes = 333;
send_stream->SetTransportOverhead(transport_overhead_per_packet_bytes);
@@ -547,8 +546,8 @@
auto send_stream = helper.CreateAudioSendStream();
auto new_config = helper.config();
- // ModifyEncoder will be called on overhead change.
- EXPECT_CALL(*helper.channel_send(), ModifyEncoder(testing::_)).Times(1);
+ // CallEncoder will be called on overhead change.
+ EXPECT_CALL(*helper.channel_send(), CallEncoder(testing::_)).Times(1);
const size_t audio_overhead_per_packet_bytes = 555;
send_stream->OnOverheadChanged(audio_overhead_per_packet_bytes);
@@ -561,8 +560,8 @@
auto send_stream = helper.CreateAudioSendStream();
auto new_config = helper.config();
- // ModifyEncoder will be called when each of overhead changes.
- EXPECT_CALL(*helper.channel_send(), ModifyEncoder(testing::_)).Times(2);
+ // CallEncoder will be called when each of overhead changes.
+ EXPECT_CALL(*helper.channel_send(), CallEncoder(testing::_)).Times(2);
const size_t transport_overhead_per_packet_bytes = 333;
send_stream->SetTransportOverhead(transport_overhead_per_packet_bytes);