Declare factory functions for video sender and receiver
Later CLs will switch to these functions, and eventually the
CreateMediaChannel will be deprecated and removed.
Bug: webrtc:13931
Change-Id: I4c5ab89659a47a501728cac217bb1a877fa50047
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/307800
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40221}
diff --git a/media/base/media_engine.h b/media/base/media_engine.h
index d3ef1f4..dc8579a 100644
--- a/media/base/media_engine.h
+++ b/media/base/media_engine.h
@@ -163,6 +163,27 @@
VideoEngineInterface(const VideoEngineInterface&) = delete;
VideoEngineInterface& operator=(const VideoEngineInterface&) = delete;
+ virtual std::unique_ptr<VideoMediaSendChannelInterface> CreateSendChannel(
+ webrtc::Call* call,
+ const MediaConfig& config,
+ const VideoOptions& options,
+ const webrtc::CryptoOptions& crypto_options,
+ webrtc::VideoBitrateAllocatorFactory* video_bitrate_allocator_factory) {
+ // Default implementation, delete when all is updated
+ RTC_CHECK_NOTREACHED();
+ return nullptr;
+ }
+
+ virtual std::unique_ptr<VideoMediaReceiveChannelInterface>
+ CreateReceiveChannel(webrtc::Call* call,
+ const MediaConfig& config,
+ const VideoOptions& options,
+ const webrtc::CryptoOptions& crypto_options) {
+ // Default implementation, delete when all is updated
+ RTC_CHECK_NOTREACHED();
+ return nullptr;
+ }
+
// Creates a video media channel.
// Returns NULL on failure.
virtual VideoMediaChannel* CreateMediaChannel(
diff --git a/media/engine/webrtc_video_engine.cc b/media/engine/webrtc_video_engine.cc
index 3a229f8..825b2aa 100644
--- a/media/engine/webrtc_video_engine.cc
+++ b/media/engine/webrtc_video_engine.cc
@@ -825,6 +825,27 @@
RTC_DLOG(LS_INFO) << "WebRtcVideoEngine::~WebRtcVideoEngine";
}
+std::unique_ptr<VideoMediaSendChannelInterface>
+WebRtcVideoEngine::CreateSendChannel(
+ webrtc::Call* call,
+ const MediaConfig& config,
+ const VideoOptions& options,
+ const webrtc::CryptoOptions& crypto_options,
+ webrtc::VideoBitrateAllocatorFactory* video_bitrate_allocator_factory) {
+ return std::make_unique<WebRtcVideoSendChannel>(
+ call, config, options, crypto_options, encoder_factory_.get(),
+ decoder_factory_.get(), video_bitrate_allocator_factory);
+}
+std::unique_ptr<VideoMediaReceiveChannelInterface>
+WebRtcVideoEngine::CreateReceiveChannel(
+ webrtc::Call* call,
+ const MediaConfig& config,
+ const VideoOptions& options,
+ const webrtc::CryptoOptions& crypto_options) {
+ return std::make_unique<WebRtcVideoReceiveChannel>(
+ call, config, options, crypto_options, decoder_factory_.get());
+}
+
VideoMediaChannel* WebRtcVideoEngine::CreateMediaChannel(
MediaChannel::Role role,
webrtc::Call* call,
@@ -836,14 +857,13 @@
std::unique_ptr<VideoMediaSendChannelInterface> send_channel;
std::unique_ptr<VideoMediaReceiveChannelInterface> receive_channel;
if (role == MediaChannel::Role::kSend || role == MediaChannel::Role::kBoth) {
- send_channel = std::make_unique<WebRtcVideoSendChannel>(
- call, config, options, crypto_options, encoder_factory_.get(),
- decoder_factory_.get(), video_bitrate_allocator_factory);
+ send_channel = CreateSendChannel(call, config, options, crypto_options,
+ video_bitrate_allocator_factory);
}
if (role == MediaChannel::Role::kReceive ||
role == MediaChannel::Role::kBoth) {
- receive_channel = std::make_unique<WebRtcVideoReceiveChannel>(
- call, config, options, crypto_options, decoder_factory_.get());
+ receive_channel =
+ CreateReceiveChannel(call, config, options, crypto_options);
}
return new VideoMediaShimChannel(std::move(send_channel),
std::move(receive_channel));
diff --git a/media/engine/webrtc_video_engine.h b/media/engine/webrtc_video_engine.h
index 3c486b4..3e22604 100644
--- a/media/engine/webrtc_video_engine.h
+++ b/media/engine/webrtc_video_engine.h
@@ -104,6 +104,19 @@
~WebRtcVideoEngine() override;
+ std::unique_ptr<VideoMediaSendChannelInterface> CreateSendChannel(
+ webrtc::Call* call,
+ const MediaConfig& config,
+ const VideoOptions& options,
+ const webrtc::CryptoOptions& crypto_options,
+ webrtc::VideoBitrateAllocatorFactory* video_bitrate_allocator_factory)
+ override;
+ std::unique_ptr<VideoMediaReceiveChannelInterface> CreateReceiveChannel(
+ webrtc::Call* call,
+ const MediaConfig& config,
+ const VideoOptions& options,
+ const webrtc::CryptoOptions& crypto_options) override;
+
VideoMediaChannel* CreateMediaChannel(
MediaChannel::Role role,
webrtc::Call* call,