Add create functions for voice media send and receive channels.
Bug: webrtc:13931
Change-Id: I1aa0cd1651a50bde1c8d1ceccc69b2a124c81294
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/307840
Reviewed-by: Tony Herre <herre@google.com>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40224}
diff --git a/media/base/media_engine.h b/media/base/media_engine.h
index dc8579a..0d10248 100644
--- a/media/base/media_engine.h
+++ b/media/base/media_engine.h
@@ -98,6 +98,28 @@
// TODO(solenberg): Remove once VoE API refactoring is done.
virtual rtc::scoped_refptr<webrtc::AudioState> GetAudioState() const = 0;
+ virtual std::unique_ptr<VoiceMediaSendChannelInterface> CreateSendChannel(
+ webrtc::Call* call,
+ const MediaConfig& config,
+ const AudioOptions& options,
+ const webrtc::CryptoOptions& crypto_options,
+ webrtc::AudioCodecPairId codec_pair_id) {
+ // TODO(hta): Make pure virtual when all downstream has updated
+ RTC_CHECK_NOTREACHED();
+ return nullptr;
+ }
+
+ virtual std::unique_ptr<VoiceMediaReceiveChannelInterface>
+ CreateReceiveChannel(webrtc::Call* call,
+ const MediaConfig& config,
+ const AudioOptions& options,
+ const webrtc::CryptoOptions& crypto_options,
+ webrtc::AudioCodecPairId codec_pair_id) {
+ // TODO(hta): Make pure virtual when all downstream has updated
+ RTC_CHECK_NOTREACHED();
+ return nullptr;
+ }
+
// MediaChannel creation
// Creates a voice media channel. Returns NULL on failure.
virtual VoiceMediaChannel* CreateMediaChannel(
diff --git a/media/engine/webrtc_voice_engine.cc b/media/engine/webrtc_voice_engine.cc
index c09e137..0dc4b7a 100644
--- a/media/engine/webrtc_voice_engine.cc
+++ b/media/engine/webrtc_voice_engine.cc
@@ -433,6 +433,28 @@
return audio_state_;
}
+std::unique_ptr<VoiceMediaSendChannelInterface>
+WebRtcVoiceEngine::CreateSendChannel(
+ webrtc::Call* call,
+ const MediaConfig& config,
+ const AudioOptions& options,
+ const webrtc::CryptoOptions& crypto_options,
+ webrtc::AudioCodecPairId codec_pair_id) {
+ return std::make_unique<WebRtcVoiceSendChannel>(
+ this, config, options, crypto_options, call, codec_pair_id);
+}
+
+std::unique_ptr<VoiceMediaReceiveChannelInterface>
+WebRtcVoiceEngine::CreateReceiveChannel(
+ webrtc::Call* call,
+ const MediaConfig& config,
+ const AudioOptions& options,
+ const webrtc::CryptoOptions& crypto_options,
+ webrtc::AudioCodecPairId codec_pair_id) {
+ return std::make_unique<WebRtcVoiceReceiveChannel>(
+ this, config, options, crypto_options, call, codec_pair_id);
+}
+
VoiceMediaChannel* WebRtcVoiceEngine::CreateMediaChannel(
MediaChannel::Role role,
webrtc::Call* call,
@@ -444,13 +466,13 @@
std::unique_ptr<VoiceMediaSendChannelInterface> send_channel;
std::unique_ptr<VoiceMediaReceiveChannelInterface> receive_channel;
if (role == MediaChannel::Role::kSend || role == MediaChannel::Role::kBoth) {
- send_channel = std::make_unique<WebRtcVoiceSendChannel>(
- this, config, options, crypto_options, call, codec_pair_id);
+ send_channel =
+ CreateSendChannel(call, config, options, crypto_options, codec_pair_id);
}
if (role == MediaChannel::Role::kReceive ||
role == MediaChannel::Role::kBoth) {
- receive_channel = std::make_unique<WebRtcVoiceReceiveChannel>(
- this, config, options, crypto_options, call, codec_pair_id);
+ receive_channel = CreateReceiveChannel(call, config, options,
+ crypto_options, codec_pair_id);
}
return new VoiceMediaShimChannel(std::move(send_channel),
std::move(receive_channel));
diff --git a/media/engine/webrtc_voice_engine.h b/media/engine/webrtc_voice_engine.h
index d7661a6..327beed 100644
--- a/media/engine/webrtc_voice_engine.h
+++ b/media/engine/webrtc_voice_engine.h
@@ -105,8 +105,22 @@
// Does initialization that needs to occur on the worker thread.
void Init() override;
-
rtc::scoped_refptr<webrtc::AudioState> GetAudioState() const override;
+
+ std::unique_ptr<VoiceMediaSendChannelInterface> CreateSendChannel(
+ webrtc::Call* call,
+ const MediaConfig& config,
+ const AudioOptions& options,
+ const webrtc::CryptoOptions& crypto_options,
+ webrtc::AudioCodecPairId codec_pair_id) override;
+
+ std::unique_ptr<VoiceMediaReceiveChannelInterface> CreateReceiveChannel(
+ webrtc::Call* call,
+ const MediaConfig& config,
+ const AudioOptions& options,
+ const webrtc::CryptoOptions& crypto_options,
+ webrtc::AudioCodecPairId codec_pair_id) override;
+
VoiceMediaChannel* CreateMediaChannel(
MediaChannel::Role role,
webrtc::Call* call,