| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 total_max_bitrate_bps += streams[s].target_bitrate_bps; | 164 total_max_bitrate_bps += streams[s].target_bitrate_bps; |
| 165 } | 165 } |
| 166 total_max_bitrate_bps += streams.back().max_bitrate_bps; | 166 total_max_bitrate_bps += streams.back().max_bitrate_bps; |
| 167 return total_max_bitrate_bps; | 167 return total_max_bitrate_bps; |
| 168 } | 168 } |
| 169 | 169 |
| 170 std::vector<webrtc::VideoStream> GetSimulcastConfig( | 170 std::vector<webrtc::VideoStream> GetSimulcastConfig( |
| 171 size_t max_streams, | 171 size_t max_streams, |
| 172 int width, | 172 int width, |
| 173 int height, | 173 int height, |
| 174 int max_bitrate_bps, | 174 rtc::Optional<int> max_bitrate_bps, |
| 175 int max_qp, | 175 int max_qp, |
| 176 int max_framerate) { | 176 int max_framerate) { |
| 177 size_t simulcast_layers = FindSimulcastMaxLayers(width, height); | 177 size_t simulcast_layers = FindSimulcastMaxLayers(width, height); |
| 178 if (simulcast_layers > max_streams) { | 178 if (simulcast_layers > max_streams) { |
| 179 // If the number of SSRCs in the group differs from our target | 179 // If the number of SSRCs in the group differs from our target |
| 180 // number of simulcast streams for current resolution, switch down | 180 // number of simulcast streams for current resolution, switch down |
| 181 // to a resolution that matches our number of SSRCs. | 181 // to a resolution that matches our number of SSRCs. |
| 182 if (!SlotSimulcastMaxResolution(max_streams, &width, &height)) { | 182 if (!SlotSimulcastMaxResolution(max_streams, &width, &height)) { |
| 183 return std::vector<webrtc::VideoStream>(); | 183 return std::vector<webrtc::VideoStream>(); |
| 184 } | 184 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 209 streams[s].max_qp = max_qp; | 209 streams[s].max_qp = max_qp; |
| 210 streams[s].max_framerate = max_framerate; | 210 streams[s].max_framerate = max_framerate; |
| 211 width /= 2; | 211 width /= 2; |
| 212 height /= 2; | 212 height /= 2; |
| 213 if (s == 0) { | 213 if (s == 0) { |
| 214 break; | 214 break; |
| 215 } | 215 } |
| 216 } | 216 } |
| 217 | 217 |
| 218 // Spend additional bits to boost the max stream. | 218 // Spend additional bits to boost the max stream. |
| 219 int bitrate_left_bps = max_bitrate_bps - GetTotalMaxBitrateBps(streams); | 219 if (max_bitrate_bps) { |
| 220 if (bitrate_left_bps > 0) { | 220 int bitrate_left_bps = *max_bitrate_bps - GetTotalMaxBitrateBps(streams); |
| 221 streams.back().max_bitrate_bps += bitrate_left_bps; | 221 if (bitrate_left_bps > 0) { |
| 222 streams.back().max_bitrate_bps += bitrate_left_bps; |
| 223 } |
| 222 } | 224 } |
| 223 | 225 |
| 224 return streams; | 226 return streams; |
| 225 } | 227 } |
| 226 | 228 |
| 227 static const int kScreenshareMinBitrateKbps = 50; | 229 static const int kScreenshareMinBitrateKbps = 50; |
| 228 static const int kScreenshareMaxBitrateKbps = 6000; | 230 static const int kScreenshareMaxBitrateKbps = 6000; |
| 229 static const int kScreenshareDefaultTl0BitrateKbps = 200; | 231 static const int kScreenshareDefaultTl0BitrateKbps = 200; |
| 230 static const int kScreenshareDefaultTl1BitrateKbps = 1000; | 232 static const int kScreenshareDefaultTl1BitrateKbps = 1000; |
| 231 | 233 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 return false; | 269 return false; |
| 268 } | 270 } |
| 269 | 271 |
| 270 config->tl0_bitrate_kbps = tl0_bitrate; | 272 config->tl0_bitrate_kbps = tl0_bitrate; |
| 271 config->tl1_bitrate_kbps = tl1_bitrate; | 273 config->tl1_bitrate_kbps = tl1_bitrate; |
| 272 | 274 |
| 273 return true; | 275 return true; |
| 274 } | 276 } |
| 275 | 277 |
| 276 } // namespace cricket | 278 } // namespace cricket |
| OLD | NEW |