OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 pending_encoder_settings_.reset(); | 581 pending_encoder_settings_.reset(); |
582 change_settings = true; | 582 change_settings = true; |
583 } else if (pending_state_change_) { | 583 } else if (pending_state_change_) { |
584 swap(pending_state_change, pending_state_change_); | 584 swap(pending_state_change, pending_state_change_); |
585 } | 585 } |
586 } | 586 } |
587 if (change_settings) { | 587 if (change_settings) { |
588 current_encoder_settings_->video_codec.startBitrate = std::max( | 588 current_encoder_settings_->video_codec.startBitrate = std::max( |
589 bitrate_allocator_->GetStartBitrate(this) / 1000, | 589 bitrate_allocator_->GetStartBitrate(this) / 1000, |
590 static_cast<int>(current_encoder_settings_->video_codec.minBitrate)); | 590 static_cast<int>(current_encoder_settings_->video_codec.minBitrate)); |
| 591 |
| 592 if (state_ == State::kStarted) { |
| 593 bitrate_allocator_->AddObserver( |
| 594 this, current_encoder_settings_->video_codec.minBitrate * 1000, |
| 595 current_encoder_settings_->video_codec.maxBitrate * 1000, |
| 596 CalulcateMaxPadBitrateBps(current_encoder_settings_->config, |
| 597 config_.suspend_below_min_bitrate), |
| 598 !config_.suspend_below_min_bitrate); |
| 599 } |
| 600 |
591 payload_router_.SetSendStreams(current_encoder_settings_->config.streams); | 601 payload_router_.SetSendStreams(current_encoder_settings_->config.streams); |
592 vie_encoder_.SetEncoder(current_encoder_settings_->video_codec, | 602 vie_encoder_.SetEncoder(current_encoder_settings_->video_codec, |
593 payload_router_.MaxPayloadLength()); | 603 payload_router_.MaxPayloadLength()); |
594 | 604 |
595 // Clear stats for disabled layers. | 605 // Clear stats for disabled layers. |
596 for (size_t i = current_encoder_settings_->config.streams.size(); | 606 for (size_t i = current_encoder_settings_->config.streams.size(); |
597 i < config_.rtp.ssrcs.size(); ++i) { | 607 i < config_.rtp.ssrcs.size(); ++i) { |
598 stats_proxy_.OnInactiveSsrc(config_.rtp.ssrcs[i]); | 608 stats_proxy_.OnInactiveSsrc(config_.rtp.ssrcs[i]); |
599 } | 609 } |
600 | 610 |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 &module_nack_rate); | 908 &module_nack_rate); |
899 *sent_video_rate_bps += module_video_rate; | 909 *sent_video_rate_bps += module_video_rate; |
900 *sent_nack_rate_bps += module_nack_rate; | 910 *sent_nack_rate_bps += module_nack_rate; |
901 *sent_fec_rate_bps += module_fec_rate; | 911 *sent_fec_rate_bps += module_fec_rate; |
902 } | 912 } |
903 return 0; | 913 return 0; |
904 } | 914 } |
905 | 915 |
906 } // namespace internal | 916 } // namespace internal |
907 } // namespace webrtc | 917 } // namespace webrtc |
OLD | NEW |