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}
This commit is contained in:
Harald Alvestrand 2023-06-05 10:29:32 +00:00 committed by WebRTC LUCI CQ
parent 2f0c0787b9
commit b0ef5e4bcd
3 changed files with 59 additions and 5 deletions

View File

@ -163,6 +163,27 @@ class VideoEngineInterface : public RtpHeaderExtensionQueryInterface {
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(

View File

@ -825,6 +825,27 @@ WebRtcVideoEngine::~WebRtcVideoEngine() {
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 @@ VideoMediaChannel* WebRtcVideoEngine::CreateMediaChannel(
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));

View File

@ -104,6 +104,19 @@ class WebRtcVideoEngine : public VideoEngineInterface {
~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,