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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 uint32_t new_framerate) { | 356 uint32_t new_framerate) { |
357 if (!Initialized()) { | 357 if (!Initialized()) { |
358 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; | 358 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; |
359 } | 359 } |
360 if (new_framerate < 1) { | 360 if (new_framerate < 1) { |
361 return WEBRTC_VIDEO_CODEC_ERR_PARAMETER; | 361 return WEBRTC_VIDEO_CODEC_ERR_PARAMETER; |
362 } | 362 } |
363 if (codec_.maxBitrate > 0 && new_bitrate_kbit > codec_.maxBitrate) { | 363 if (codec_.maxBitrate > 0 && new_bitrate_kbit > codec_.maxBitrate) { |
364 new_bitrate_kbit = codec_.maxBitrate; | 364 new_bitrate_kbit = codec_.maxBitrate; |
365 } | 365 } |
366 if (new_bitrate_kbit < codec_.minBitrate) { | 366 if (new_bitrate_kbit > 0) { |
367 new_bitrate_kbit = codec_.minBitrate; | 367 // Make sure the bitrate fits the configured min bitrates. 0 is a special |
368 } | 368 // value that means paused, though, so leave it alone. |
369 if (codec_.numberOfSimulcastStreams > 0 && | 369 if (new_bitrate_kbit < codec_.minBitrate) { |
370 new_bitrate_kbit < codec_.simulcastStream[0].minBitrate) { | 370 new_bitrate_kbit = codec_.minBitrate; |
371 new_bitrate_kbit = codec_.simulcastStream[0].minBitrate; | 371 } |
| 372 if (codec_.numberOfSimulcastStreams > 0 && |
| 373 new_bitrate_kbit < codec_.simulcastStream[0].minBitrate) { |
| 374 new_bitrate_kbit = codec_.simulcastStream[0].minBitrate; |
| 375 } |
372 } | 376 } |
373 codec_.maxFramerate = new_framerate; | 377 codec_.maxFramerate = new_framerate; |
374 | 378 |
375 bool send_stream = true; | 379 bool send_stream = true; |
376 uint32_t stream_bitrate = 0; | 380 uint32_t stream_bitrate = 0; |
377 for (size_t stream_idx = 0; stream_idx < streaminfos_.size(); ++stream_idx) { | 381 for (size_t stream_idx = 0; stream_idx < streaminfos_.size(); ++stream_idx) { |
378 stream_bitrate = GetStreamBitrate(stream_idx, streaminfos_.size(), | 382 stream_bitrate = GetStreamBitrate(stream_idx, streaminfos_.size(), |
379 new_bitrate_kbit, &send_stream); | 383 new_bitrate_kbit, &send_stream); |
380 // Need a key frame if we have not sent this stream before. | 384 // Need a key frame if we have not sent this stream before. |
381 if (send_stream && !streaminfos_[stream_idx].send_stream) { | 385 if (send_stream && !streaminfos_[stream_idx].send_stream) { |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 return false; | 525 return false; |
522 } | 526 } |
523 return true; | 527 return true; |
524 } | 528 } |
525 | 529 |
526 const char* SimulcastEncoderAdapter::ImplementationName() const { | 530 const char* SimulcastEncoderAdapter::ImplementationName() const { |
527 return implementation_name_.c_str(); | 531 return implementation_name_.c_str(); |
528 } | 532 } |
529 | 533 |
530 } // namespace webrtc | 534 } // namespace webrtc |
OLD | NEW |