Use the VideoMediaChannelShim for all cases

This allows us to decouple implementation classes from the
MediaChannel class.

Bug: webrtc:13931
Change-Id: I22f166cac17c344f943a0382048e8086a193affa
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/307000
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40179}
This commit is contained in:
Harald Alvestrand 2023-05-30 10:13:17 +00:00 committed by WebRTC LUCI CQ
parent 428836d1ea
commit d8b88d8b94
2 changed files with 16 additions and 10 deletions

View File

@ -195,8 +195,11 @@ class VideoMediaShimChannel : public VideoMediaChannel {
void SetSendCodecChangedCallback(
absl::AnyInvocable<void()> callback) override {
// This callback is used internally by the shim, so should not be called by
// users.
RTC_CHECK_NOTREACHED();
// users for the "both" case.
if (send_impl_ && receive_impl_) {
RTC_CHECK_NOTREACHED();
}
send_impl()->SetSendCodecChangedCallback(std::move(callback));
}
// Implementation of Delayable

View File

@ -627,22 +627,25 @@ VideoMediaChannel* WebRtcVideoEngine::CreateMediaChannel(
const webrtc::CryptoOptions& crypto_options,
webrtc::VideoBitrateAllocatorFactory* video_bitrate_allocator_factory) {
RTC_LOG(LS_INFO) << "CreateMediaChannel. Options: " << options.ToString();
if (role == MediaChannel::Role::kBoth) {
auto send_channel = std::make_unique<WebRtcVideoChannel>(
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<WebRtcVideoChannel>(
MediaChannel::Role::kSend, call, config, options, crypto_options,
encoder_factory_.get(), decoder_factory_.get(),
video_bitrate_allocator_factory);
auto receive_channel = std::make_unique<WebRtcVideoChannel>(
}
if (role == MediaChannel::Role::kReceive ||
role == MediaChannel::Role::kBoth) {
receive_channel = std::make_unique<WebRtcVideoChannel>(
MediaChannel::Role::kReceive, call, config, options, crypto_options,
encoder_factory_.get(), decoder_factory_.get(),
video_bitrate_allocator_factory);
return new VideoMediaShimChannel(std::move(send_channel),
std::move(receive_channel));
}
return new WebRtcVideoChannel(role, call, config, options, crypto_options,
encoder_factory_.get(), decoder_factory_.get(),
video_bitrate_allocator_factory);
return new VideoMediaShimChannel(std::move(send_channel),
std::move(receive_channel));
}
std::vector<VideoCodec> WebRtcVideoEngine::send_codecs(bool include_rtx) const {
return GetPayloadTypesAndDefaultCodecs(encoder_factory_.get(),
/*is_decoder_factory=*/false,