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 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 break; | 552 break; |
553 rtc::Optional<EncoderSettings> encoder_settings; | 553 rtc::Optional<EncoderSettings> encoder_settings; |
554 { | 554 { |
555 rtc::CritScope lock(&encoder_settings_crit_); | 555 rtc::CritScope lock(&encoder_settings_crit_); |
556 if (pending_encoder_settings_) { | 556 if (pending_encoder_settings_) { |
557 encoder_settings = pending_encoder_settings_; | 557 encoder_settings = pending_encoder_settings_; |
558 pending_encoder_settings_ = rtc::Optional<EncoderSettings>(); | 558 pending_encoder_settings_ = rtc::Optional<EncoderSettings>(); |
559 } | 559 } |
560 } | 560 } |
561 if (encoder_settings) { | 561 if (encoder_settings) { |
| 562 if (config_.suspend_below_min_bitrate) |
| 563 video_sender_->SuspendBelowMinBitrate(); |
| 564 |
562 encoder_settings->video_codec.startBitrate = | 565 encoder_settings->video_codec.startBitrate = |
563 bitrate_allocator_->AddObserver( | 566 bitrate_allocator_->AddObserver( |
564 this, encoder_settings->video_codec.minBitrate * 1000, | 567 this, encoder_settings->video_codec.minBitrate * 1000, |
565 encoder_settings->video_codec.maxBitrate * 1000) / | 568 encoder_settings->video_codec.maxBitrate * 1000, |
| 569 !config_.suspend_below_min_bitrate) / |
566 1000; | 570 1000; |
567 | 571 |
568 payload_router_.SetSendStreams(encoder_settings->streams); | 572 payload_router_.SetSendStreams(encoder_settings->streams); |
569 vie_encoder_.SetEncoder(encoder_settings->video_codec, | 573 vie_encoder_.SetEncoder(encoder_settings->video_codec, |
570 encoder_settings->min_transmit_bitrate_bps, | 574 encoder_settings->min_transmit_bitrate_bps, |
571 payload_router_.MaxPayloadLength(), this); | 575 payload_router_.MaxPayloadLength(), this); |
572 | 576 |
573 // Clear stats for disabled layers. | 577 // Clear stats for disabled layers. |
574 for (size_t i = encoder_settings->streams.size(); | 578 for (size_t i = encoder_settings->streams.size(); |
575 i < config_.rtp.ssrcs.size(); ++i) { | 579 i < config_.rtp.ssrcs.size(); ++i) { |
576 stats_proxy_.OnInactiveSsrc(config_.rtp.ssrcs[i]); | 580 stats_proxy_.OnInactiveSsrc(config_.rtp.ssrcs[i]); |
577 } | 581 } |
578 | 582 |
579 if (config_.suspend_below_min_bitrate) { | |
580 video_sender_->SuspendBelowMinBitrate(); | |
581 bitrate_allocator_->EnforceMinBitrate(false); | |
582 } | |
583 // We might've gotten new settings while configuring the encoder settings, | 583 // We might've gotten new settings while configuring the encoder settings, |
584 // restart from the top to see if that's the case before trying to encode | 584 // restart from the top to see if that's the case before trying to encode |
585 // a frame (which might correspond to the last frame size). | 585 // a frame (which might correspond to the last frame size). |
586 encoder_wakeup_event_.Set(); | 586 encoder_wakeup_event_.Set(); |
587 continue; | 587 continue; |
588 } | 588 } |
589 | 589 |
590 VideoFrame frame; | 590 VideoFrame frame; |
591 if (input_.GetVideoFrame(&frame)) { | 591 if (input_.GetVideoFrame(&frame)) { |
592 // TODO(perkj): |pre_encode_callback| is only used by tests. Tests should | 592 // TODO(perkj): |pre_encode_callback| is only used by tests. Tests should |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 &module_nack_rate); | 808 &module_nack_rate); |
809 *sent_video_rate_bps += module_video_rate; | 809 *sent_video_rate_bps += module_video_rate; |
810 *sent_nack_rate_bps += module_nack_rate; | 810 *sent_nack_rate_bps += module_nack_rate; |
811 *sent_fec_rate_bps += module_fec_rate; | 811 *sent_fec_rate_bps += module_fec_rate; |
812 } | 812 } |
813 return 0; | 813 return 0; |
814 } | 814 } |
815 | 815 |
816 } // namespace internal | 816 } // namespace internal |
817 } // namespace webrtc | 817 } // namespace webrtc |
OLD | NEW |