Hookup VideoSendStreamImpl::OnVideoLayersAllocationUpdate to RtpVideoSender.
Bug: webrtc:12000
Change-Id: Ieddbad8e6f4e7456441153d432f4dfb32e16d255
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/188627
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Per Kjellander <perkj@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32439}
diff --git a/call/BUILD.gn b/call/BUILD.gn
index c975135..15e3b48 100644
--- a/call/BUILD.gn
+++ b/call/BUILD.gn
@@ -160,6 +160,7 @@
"../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 6614806..fd71248 100644
--- a/call/rtp_video_sender.cc
+++ b/call/rtp_video_sender.cc
@@ -592,6 +592,18 @@
}
}
}
+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 2e2d198..49fd3cc 100644
--- a/call/rtp_video_sender.h
+++ b/call/rtp_video_sender.h
@@ -138,7 +138,8 @@
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 bb72eb5..632c9e8 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 @@
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 4673811..665fe09 100644
--- a/video/video_send_stream_impl.cc
+++ b/video/video_send_stream_impl.cc
@@ -483,7 +483,7 @@
});
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 68813ca..795b181 100644
--- a/video/video_send_stream_impl_unittest.cc
+++ b/video/video_send_stream_impl_unittest.cc
@@ -80,6 +80,10 @@
OnBitrateAllocationUpdated,
(const VideoBitrateAllocation&),
(override));
+ MOCK_METHOD(void,
+ OnVideoLayersAllocationUpdated,
+ (const VideoLayersAllocation&),
+ (override));
MOCK_METHOD(EncodedImageCallback::Result,
OnEncodedImage,
(const EncodedImage&, const CodecSpecificInfo*),