Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(619)

Unified Diff: webrtc/video/payload_router.cc

Issue 2541303003: Wire up BitrateAllocation to be sent as RTCP TargetBitrate (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/video/payload_router.h ('k') | webrtc/video/payload_router_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/video/payload_router.cc
diff --git a/webrtc/video/payload_router.cc b/webrtc/video/payload_router.cc
index 33d8f76e86055a3b3e1ad484d1d3b87e4b7e4a99..6c8e36f72f448919ff8bde5411f603f891821f6f 100644
--- a/webrtc/video/payload_router.cc
+++ b/webrtc/video/payload_router.cc
@@ -101,7 +101,7 @@ size_t PayloadRouter::DefaultMaxPayloadLength() {
return IP_PACKET_SIZE - kIpUdpSrtpLength;
}
-void PayloadRouter::set_active(bool active) {
+void PayloadRouter::SetActive(bool active) {
rtc::CritScope lock(&crit_);
if (active_ == active)
return;
@@ -113,7 +113,7 @@ void PayloadRouter::set_active(bool active) {
}
}
-bool PayloadRouter::active() {
+bool PayloadRouter::IsActive() {
rtc::CritScope lock(&crit_);
return active_ && !rtp_modules_.empty();
}
@@ -158,4 +158,24 @@ size_t PayloadRouter::MaxPayloadLength() const {
return min_payload_length;
}
+void PayloadRouter::OnBitrateAllocationUpdated(
+ const BitrateAllocation& bitrate) {
+ rtc::CritScope lock(&crit_);
+ if (IsActive()) {
+ if (rtp_modules_.size() == 1) {
+ // If spatial scalability is enabled, it is covered by a single stream.
+ rtp_modules_[0]->SetVideoBitrateAllocation(bitrate);
+ } else {
+ // Simulcast is in use, split the BitrateAllocation into one struct per
+ // rtp stream, moving over the temporal layer allocation.
+ for (size_t si = 0; si < rtp_modules_.size(); ++si) {
+ BitrateAllocation layer_bitrate;
+ for (int tl = 0; tl < kMaxTemporalStreams; ++tl)
+ layer_bitrate.SetBitrate(0, tl, bitrate.GetBitrate(si, tl));
+ rtp_modules_[si]->SetVideoBitrateAllocation(layer_bitrate);
+ }
+ }
+ }
+}
+
} // namespace webrtc
« no previous file with comments | « webrtc/video/payload_router.h ('k') | webrtc/video/payload_router_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698