OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 codec.startBitrate = | 427 codec.startBitrate = |
428 std::max(encoder_start_bitrate_bps_ / 1000, codec.minBitrate); | 428 std::max(encoder_start_bitrate_bps_ / 1000, codec.minBitrate); |
429 codec.startBitrate = std::min(codec.startBitrate, codec.maxBitrate); | 429 codec.startBitrate = std::min(codec.startBitrate, codec.maxBitrate); |
430 codec.expect_encode_from_texture = last_frame_info_->is_texture; | 430 codec.expect_encode_from_texture = last_frame_info_->is_texture; |
431 | 431 |
432 bool success = video_sender_.RegisterSendCodec( | 432 bool success = video_sender_.RegisterSendCodec( |
433 &codec, number_of_cores_, | 433 &codec, number_of_cores_, |
434 static_cast<uint32_t>(max_data_payload_length_)) == VCM_OK; | 434 static_cast<uint32_t>(max_data_payload_length_)) == VCM_OK; |
435 if (!success) { | 435 if (!success) { |
436 LOG(LS_ERROR) << "Failed to configure encoder."; | 436 LOG(LS_ERROR) << "Failed to configure encoder."; |
437 RTC_DCHECK(success); | 437 rate_allocator_.reset(); |
438 } | 438 } |
439 | 439 |
440 video_sender_.UpdateChannelParemeters(rate_allocator_.get(), | 440 video_sender_.UpdateChannelParemeters(rate_allocator_.get(), |
441 bitrate_observer_); | 441 bitrate_observer_); |
442 | 442 |
443 int framerate = stats_proxy_->GetSendFrameRate(); | 443 int framerate = stats_proxy_->GetSendFrameRate(); |
444 if (framerate == 0) | 444 if (framerate == 0) |
445 framerate = codec.maxFramerate; | 445 framerate = codec.maxFramerate; |
446 stats_proxy_->OnEncoderReconfigured( | 446 stats_proxy_->OnEncoderReconfigured( |
447 encoder_config_, rate_allocator_->GetPreferredBitrateBps(framerate)); | 447 encoder_config_, rate_allocator_.get() |
| 448 ? rate_allocator_->GetPreferredBitrateBps(framerate) |
| 449 : codec.maxBitrate); |
448 | 450 |
449 pending_encoder_reconfiguration_ = false; | 451 pending_encoder_reconfiguration_ = false; |
450 | 452 |
451 sink_->OnEncoderConfigurationChanged( | 453 sink_->OnEncoderConfigurationChanged( |
452 std::move(streams), encoder_config_.min_transmit_bitrate_bps); | 454 std::move(streams), encoder_config_.min_transmit_bitrate_bps); |
453 | 455 |
454 ConfigureQualityScaler(); | 456 ConfigureQualityScaler(); |
455 } | 457 } |
456 | 458 |
457 void ViEEncoder::ConfigureQualityScaler() { | 459 void ViEEncoder::ConfigureQualityScaler() { |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
777 --scale_counter_[reason]; | 779 --scale_counter_[reason]; |
778 source_proxy_->RequestHigherResolutionThan(current_pixel_count); | 780 source_proxy_->RequestHigherResolutionThan(current_pixel_count); |
779 LOG(LS_INFO) << "Scaling up resolution."; | 781 LOG(LS_INFO) << "Scaling up resolution."; |
780 for (size_t i = 0; i < kScaleReasonSize; ++i) { | 782 for (size_t i = 0; i < kScaleReasonSize; ++i) { |
781 LOG(LS_INFO) << "Scaled " << scale_counter_[i] | 783 LOG(LS_INFO) << "Scaled " << scale_counter_[i] |
782 << " times for reason: " << (i ? "cpu" : "quality"); | 784 << " times for reason: " << (i ? "cpu" : "quality"); |
783 } | 785 } |
784 } | 786 } |
785 | 787 |
786 } // namespace webrtc | 788 } // namespace webrtc |
OLD | NEW |