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}
This commit is contained in:
Harald Alvestrand 2023-06-05 14:19:40 +00:00 committed by WebRTC LUCI CQ
parent be316dab88
commit 77c6230ef5
3 changed files with 63 additions and 5 deletions

View File

@ -98,6 +98,28 @@ class VoiceEngineInterface : public RtpHeaderExtensionQueryInterface {
// 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(

View File

@ -433,6 +433,28 @@ rtc::scoped_refptr<webrtc::AudioState> WebRtcVoiceEngine::GetAudioState()
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 @@ VoiceMediaChannel* WebRtcVoiceEngine::CreateMediaChannel(
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));

View File

@ -105,8 +105,22 @@ class WebRtcVoiceEngine final : public VoiceEngineInterface {
// 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,