diff --git a/media/base/media_engine.h b/media/base/media_engine.h index d3ef1f4bb8..dc8579a517 100644 --- a/media/base/media_engine.h +++ b/media/base/media_engine.h @@ -163,6 +163,27 @@ class VideoEngineInterface : public RtpHeaderExtensionQueryInterface { VideoEngineInterface(const VideoEngineInterface&) = delete; VideoEngineInterface& operator=(const VideoEngineInterface&) = delete; + virtual std::unique_ptr 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 + 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 3a229f8078..825b2aaa50 100644 --- a/media/engine/webrtc_video_engine.cc +++ b/media/engine/webrtc_video_engine.cc @@ -825,6 +825,27 @@ WebRtcVideoEngine::~WebRtcVideoEngine() { RTC_DLOG(LS_INFO) << "WebRtcVideoEngine::~WebRtcVideoEngine"; } +std::unique_ptr +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( + call, config, options, crypto_options, encoder_factory_.get(), + decoder_factory_.get(), video_bitrate_allocator_factory); +} +std::unique_ptr +WebRtcVideoEngine::CreateReceiveChannel( + webrtc::Call* call, + const MediaConfig& config, + const VideoOptions& options, + const webrtc::CryptoOptions& crypto_options) { + return std::make_unique( + 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 send_channel; std::unique_ptr receive_channel; if (role == MediaChannel::Role::kSend || role == MediaChannel::Role::kBoth) { - send_channel = std::make_unique( - 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( - 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 3c486b4971..3e22604cf9 100644 --- a/media/engine/webrtc_video_engine.h +++ b/media/engine/webrtc_video_engine.h @@ -104,6 +104,19 @@ class WebRtcVideoEngine : public VideoEngineInterface { ~WebRtcVideoEngine() override; + std::unique_ptr 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 CreateReceiveChannel( + webrtc::Call* call, + const MediaConfig& config, + const VideoOptions& options, + const webrtc::CryptoOptions& crypto_options) override; + VideoMediaChannel* CreateMediaChannel( MediaChannel::Role role, webrtc::Call* call,