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 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 inst->simulcastStream[stream_idx].height, kVp832ByteAlign); | 591 inst->simulcastStream[stream_idx].height, kVp832ByteAlign); |
592 SetStreamState(stream_bitrates[stream_idx] > 0, stream_idx); | 592 SetStreamState(stream_bitrates[stream_idx] > 0, stream_idx); |
593 configurations_[i].rc_target_bitrate = stream_bitrates[stream_idx]; | 593 configurations_[i].rc_target_bitrate = stream_bitrates[stream_idx]; |
594 temporal_layers_[stream_idx]->ConfigureBitrates( | 594 temporal_layers_[stream_idx]->ConfigureBitrates( |
595 stream_bitrates[stream_idx], inst->maxBitrate, inst->maxFramerate, | 595 stream_bitrates[stream_idx], inst->maxBitrate, inst->maxFramerate, |
596 &configurations_[i]); | 596 &configurations_[i]); |
597 } | 597 } |
598 } | 598 } |
599 | 599 |
600 rps_.Init(); | 600 rps_.Init(); |
601 // QP thresholds are chosen to be high enough to be hit in practice when | 601 quality_scaler_.Init(QualityScaler::kLowVp8QpThreshold, |
602 // quality is good, but also low enough to not cause a flip-flop behavior | 602 QualityScaler::kBadVp8QpThreshold, codec_.startBitrate, |
603 // (e.g. going up in resolution shouldn't give so bad quality that we should | 603 codec_.width, codec_.height, codec_.maxFramerate); |
604 // go back down). | |
605 const int kLowQpThreshold = 29; | |
606 const int kBadQpThreshold = 100; | |
607 quality_scaler_.Init(kLowQpThreshold, kBadQpThreshold, | |
608 codec_.startBitrate, codec_.width, codec_.height, | |
609 codec_.maxFramerate); | |
610 | 604 |
611 // Only apply scaling to improve for single-layer streams. The scaling metrics | 605 // Only apply scaling to improve for single-layer streams. The scaling metrics |
612 // use frame drops as a signal and is only applicable when we drop frames. | 606 // use frame drops as a signal and is only applicable when we drop frames. |
613 quality_scaler_enabled_ = encoders_.size() == 1 && | 607 quality_scaler_enabled_ = encoders_.size() == 1 && |
614 configurations_[0].rc_dropframe_thresh > 0 && | 608 configurations_[0].rc_dropframe_thresh > 0 && |
615 codec_.codecSpecific.VP8.automaticResizeOn; | 609 codec_.codecSpecific.VP8.automaticResizeOn; |
616 | 610 |
617 return InitAndSetControlSettings(); | 611 return InitAndSetControlSettings(); |
618 } | 612 } |
619 | 613 |
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1411 return -1; | 1405 return -1; |
1412 } | 1406 } |
1413 if (vpx_codec_control(copy->decoder_, VP8_SET_REFERENCE, ref_frame_) != | 1407 if (vpx_codec_control(copy->decoder_, VP8_SET_REFERENCE, ref_frame_) != |
1414 VPX_CODEC_OK) { | 1408 VPX_CODEC_OK) { |
1415 return -1; | 1409 return -1; |
1416 } | 1410 } |
1417 return 0; | 1411 return 0; |
1418 } | 1412 } |
1419 | 1413 |
1420 } // namespace webrtc | 1414 } // namespace webrtc |
OLD | NEW |