From af704183574c9b6540bd7dee27ba779950509f31 Mon Sep 17 00:00:00 2001 From: Per Kjellander Date: Fri, 16 Oct 2020 10:30:40 +0200 Subject: [PATCH] Hookup VideoSendStreamImpl::OnVideoLayersAllocationUpdate to RtpVideoSender. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: webrtc:12000 Change-Id: Ieddbad8e6f4e7456441153d432f4dfb32e16d255 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/188627 Reviewed-by: Erik Språng Commit-Queue: Per Kjellander Cr-Commit-Position: refs/heads/master@{#32439} --- call/BUILD.gn | 1 + call/rtp_video_sender.cc | 12 ++++++++++++ call/rtp_video_sender.h | 3 ++- call/rtp_video_sender_interface.h | 3 +++ video/video_send_stream_impl.cc | 2 +- video/video_send_stream_impl_unittest.cc | 4 ++++ 6 files changed, 23 insertions(+), 2 deletions(-) diff --git a/call/BUILD.gn b/call/BUILD.gn index c9751358e8..15e3b481ad 100644 --- a/call/BUILD.gn +++ b/call/BUILD.gn @@ -160,6 +160,7 @@ rtc_library("rtp_sender") { "../api/units:time_delta", "../api/units:timestamp", "../api/video:video_frame", + "../api/video:video_layers_allocation", "../api/video:video_rtp_headers", "../api/video_codecs:video_codecs_api", "../logging:rtc_event_bwe", diff --git a/call/rtp_video_sender.cc b/call/rtp_video_sender.cc index 66148061f3..fd712480c9 100644 --- a/call/rtp_video_sender.cc +++ b/call/rtp_video_sender.cc @@ -592,6 +592,18 @@ void RtpVideoSender::OnBitrateAllocationUpdated( } } } +void RtpVideoSender::OnVideoLayersAllocationUpdated( + const VideoLayersAllocation& allocation) { + MutexLock lock(&mutex_); + if (IsActiveLocked()) { + for (size_t i = 0; i < rtp_streams_.size(); ++i) { + VideoLayersAllocation stream_allocation = allocation; + stream_allocation.rtp_stream_index = i; + rtp_streams_[i].sender_video->SetVideoLayersAllocation( + std::move(stream_allocation)); + } + } +} bool RtpVideoSender::NackEnabled() const { const bool nack_enabled = rtp_config_.nack.rtp_history_ms > 0; diff --git a/call/rtp_video_sender.h b/call/rtp_video_sender.h index 2e2d1981de..49fd3cc0d2 100644 --- a/call/rtp_video_sender.h +++ b/call/rtp_video_sender.h @@ -138,7 +138,8 @@ class RtpVideoSender : public RtpVideoSenderInterface, void OnBitrateAllocationUpdated(const VideoBitrateAllocation& bitrate) RTC_LOCKS_EXCLUDED(mutex_) override; - + void OnVideoLayersAllocationUpdated( + const VideoLayersAllocation& layers) override; void OnTransportOverheadChanged(size_t transport_overhead_bytes_per_packet) RTC_LOCKS_EXCLUDED(mutex_) override; void OnBitrateUpdated(BitrateAllocationUpdate update, int framerate) diff --git a/call/rtp_video_sender_interface.h b/call/rtp_video_sender_interface.h index bb72eb5996..632c9e835a 100644 --- a/call/rtp_video_sender_interface.h +++ b/call/rtp_video_sender_interface.h @@ -18,6 +18,7 @@ #include "api/array_view.h" #include "api/call/bitrate_allocation.h" #include "api/fec_controller_override.h" +#include "api/video/video_layers_allocation.h" #include "call/rtp_config.h" #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h" #include "modules/rtp_rtcp/source/rtp_sequence_number_map.h" @@ -50,6 +51,8 @@ class RtpVideoSenderInterface : public EncodedImageCallback, virtual void OnBitrateAllocationUpdated( const VideoBitrateAllocation& bitrate) = 0; + virtual void OnVideoLayersAllocationUpdated( + const VideoLayersAllocation& allocation) = 0; virtual void OnBitrateUpdated(BitrateAllocationUpdate update, int framerate) = 0; virtual void OnTransportOverheadChanged( diff --git a/video/video_send_stream_impl.cc b/video/video_send_stream_impl.cc index 4673811e1b..665fe09169 100644 --- a/video/video_send_stream_impl.cc +++ b/video/video_send_stream_impl.cc @@ -483,7 +483,7 @@ void VideoSendStreamImpl::OnVideoLayersAllocationUpdated( }); return; } - // TODO(bugs.webrtc.org/12000): Implement + rtp_video_sender_->OnVideoLayersAllocationUpdated(allocation); } void VideoSendStreamImpl::SignalEncoderActive() { diff --git a/video/video_send_stream_impl_unittest.cc b/video/video_send_stream_impl_unittest.cc index 68813ca21b..795b181d63 100644 --- a/video/video_send_stream_impl_unittest.cc +++ b/video/video_send_stream_impl_unittest.cc @@ -80,6 +80,10 @@ class MockRtpVideoSender : public RtpVideoSenderInterface { OnBitrateAllocationUpdated, (const VideoBitrateAllocation&), (override)); + MOCK_METHOD(void, + OnVideoLayersAllocationUpdated, + (const VideoLayersAllocation&), + (override)); MOCK_METHOD(EncodedImageCallback::Result, OnEncodedImage, (const EncodedImage&, const CodecSpecificInfo*),