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 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 // Disable both high-QP limits and framedropping. Both are handled by libvpx | 601 // Disable both high-QP limits and framedropping. Both are handled by libvpx |
602 // internally. | 602 // internally. |
603 const int kLowQpThreshold = 18; | 603 const int kLowQpThreshold = 23; |
stefan-webrtc
2016/04/15 09:21:08
Please clarify in the code why this was chosen to
| |
604 const int kDisabledBadQpThreshold = 64; | 604 const int kDisabledBadQpThreshold = 128; |
605 // TODO(glaznev/sprang): consider passing codec initial bitrate to quality | 605 // TODO(glaznev/sprang): consider passing codec initial bitrate to quality |
606 // scaler to avoid starting with HD for low initial bitrates. | 606 // scaler to avoid starting with HD for low initial bitrates. |
607 quality_scaler_.Init(kLowQpThreshold, kDisabledBadQpThreshold, false, 0, 0, 0, | 607 quality_scaler_.Init(kLowQpThreshold, kDisabledBadQpThreshold, false, 0, 0, 0, |
608 codec_.maxFramerate); | 608 codec_.maxFramerate); |
609 | 609 |
610 // Only apply scaling to improve for single-layer streams. The scaling metrics | 610 // Only apply scaling to improve for single-layer streams. The scaling metrics |
611 // use frame drops as a signal and is only applicable when we drop frames. | 611 // use frame drops as a signal and is only applicable when we drop frames. |
612 quality_scaler_enabled_ = encoders_.size() == 1 && | 612 quality_scaler_enabled_ = encoders_.size() == 1 && |
613 configurations_[0].rc_dropframe_thresh > 0 && | 613 configurations_[0].rc_dropframe_thresh > 0 && |
614 codec_.codecSpecific.VP8.automaticResizeOn; | 614 codec_.codecSpecific.VP8.automaticResizeOn; |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1046 encoded_images_[encoder_idx].qp_ = qp_128; | 1046 encoded_images_[encoder_idx].qp_ = qp_128; |
1047 encoded_complete_callback_->Encoded(encoded_images_[encoder_idx], | 1047 encoded_complete_callback_->Encoded(encoded_images_[encoder_idx], |
1048 &codec_specific, &frag_info); | 1048 &codec_specific, &frag_info); |
1049 } else if (codec_.mode == kScreensharing) { | 1049 } else if (codec_.mode == kScreensharing) { |
1050 result = WEBRTC_VIDEO_CODEC_TARGET_BITRATE_OVERSHOOT; | 1050 result = WEBRTC_VIDEO_CODEC_TARGET_BITRATE_OVERSHOOT; |
1051 } | 1051 } |
1052 } | 1052 } |
1053 } | 1053 } |
1054 if (encoders_.size() == 1 && send_stream_[0]) { | 1054 if (encoders_.size() == 1 && send_stream_[0]) { |
1055 if (encoded_images_[0]._length > 0) { | 1055 if (encoded_images_[0]._length > 0) { |
1056 int qp; | 1056 int qp_128; |
1057 vpx_codec_control(&encoders_[0], VP8E_GET_LAST_QUANTIZER_64, &qp); | 1057 vpx_codec_control(&encoders_[0], VP8E_GET_LAST_QUANTIZER, &qp_128); |
1058 quality_scaler_.ReportQP(qp); | 1058 quality_scaler_.ReportQP(qp_128); |
1059 } else { | 1059 } else { |
1060 quality_scaler_.ReportDroppedFrame(); | 1060 quality_scaler_.ReportDroppedFrame(); |
1061 } | 1061 } |
1062 } | 1062 } |
1063 return result; | 1063 return result; |
1064 } | 1064 } |
1065 | 1065 |
1066 int VP8EncoderImpl::SetChannelParameters(uint32_t packetLoss, int64_t rtt) { | 1066 int VP8EncoderImpl::SetChannelParameters(uint32_t packetLoss, int64_t rtt) { |
1067 rps_.SetRtt(rtt); | 1067 rps_.SetRtt(rtt); |
1068 return WEBRTC_VIDEO_CODEC_OK; | 1068 return WEBRTC_VIDEO_CODEC_OK; |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1409 return -1; | 1409 return -1; |
1410 } | 1410 } |
1411 if (vpx_codec_control(copy->decoder_, VP8_SET_REFERENCE, ref_frame_) != | 1411 if (vpx_codec_control(copy->decoder_, VP8_SET_REFERENCE, ref_frame_) != |
1412 VPX_CODEC_OK) { | 1412 VPX_CODEC_OK) { |
1413 return -1; | 1413 return -1; |
1414 } | 1414 } |
1415 return 0; | 1415 return 0; |
1416 } | 1416 } |
1417 | 1417 |
1418 } // namespace webrtc | 1418 } // namespace webrtc |
OLD | NEW |