Index: webrtc/media/engine/simulcast.cc |
diff --git a/webrtc/media/engine/simulcast.cc b/webrtc/media/engine/simulcast.cc |
index cbcf245efdde2ff2be6522518d6fa792b0bb09dc..71f312b2545d6013f9db2c64a9183d30bdfd3505 100644 |
--- a/webrtc/media/engine/simulcast.cc |
+++ b/webrtc/media/engine/simulcast.cc |
@@ -171,7 +171,7 @@ std::vector<webrtc::VideoStream> GetSimulcastConfig( |
size_t max_streams, |
int width, |
int height, |
- int max_bitrate_bps, |
+ rtc::Optional<int> max_bitrate_bps, |
int max_qp, |
int max_framerate) { |
size_t simulcast_layers = FindSimulcastMaxLayers(width, height); |
@@ -216,9 +216,11 @@ std::vector<webrtc::VideoStream> GetSimulcastConfig( |
} |
// Spend additional bits to boost the max stream. |
- int bitrate_left_bps = max_bitrate_bps - GetTotalMaxBitrateBps(streams); |
- if (bitrate_left_bps > 0) { |
- streams.back().max_bitrate_bps += bitrate_left_bps; |
+ if (max_bitrate_bps) { |
+ int bitrate_left_bps = *max_bitrate_bps - GetTotalMaxBitrateBps(streams); |
+ if (bitrate_left_bps > 0) { |
+ streams.back().max_bitrate_bps += bitrate_left_bps; |
+ } |
} |
return streams; |