Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(506)

Side by Side Diff: webrtc/api/android/jni/androidmediaencoder_jni.cc

Issue 2309743002: Move the QP scaling thresholds to the relevant encoders (Closed)
Patch Set: rebase Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2015 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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 scale_ = codec_settings->codecSpecific.VP8.automaticResizeOn; 389 scale_ = codec_settings->codecSpecific.VP8.automaticResizeOn;
390 } else if (codecType_ != kVideoCodecVP9) { 390 } else if (codecType_ != kVideoCodecVP9) {
391 scale_ = true; 391 scale_ = true;
392 } 392 }
393 393
394 ALOGD << "InitEncode request: " << init_width << " x " << init_height; 394 ALOGD << "InitEncode request: " << init_width << " x " << init_height;
395 ALOGD << "Encoder automatic resize " << (scale_ ? "enabled" : "disabled"); 395 ALOGD << "Encoder automatic resize " << (scale_ ? "enabled" : "disabled");
396 396
397 if (scale_) { 397 if (scale_) {
398 if (codecType_ == kVideoCodecVP8) { 398 if (codecType_ == kVideoCodecVP8) {
399 quality_scaler_.Init( 399 quality_scaler_.Init(codecType_, codec_settings->startBitrate,
400 QualityScaler::kLowVp8QpThreshold, QualityScaler::kBadVp8QpThreshold, 400 codec_settings->width, codec_settings->height,
401 codec_settings->startBitrate, codec_settings->width, 401 codec_settings->maxFramerate);
402 codec_settings->height, codec_settings->maxFramerate);
403 } else if (codecType_ == kVideoCodecH264) { 402 } else if (codecType_ == kVideoCodecH264) {
404 quality_scaler_.Init(QualityScaler::kLowH264QpThreshold, 403 quality_scaler_.Init(codecType_, codec_settings->startBitrate,
405 QualityScaler::kBadH264QpThreshold, 404 codec_settings->width, codec_settings->height,
406 codec_settings->startBitrate, codec_settings->width,
407 codec_settings->height,
408 codec_settings->maxFramerate); 405 codec_settings->maxFramerate);
409 } else { 406 } else {
410 // When adding codec support to additional hardware codecs, also configure 407 // When adding codec support to additional hardware codecs, also configure
411 // their QP thresholds for scaling. 408 // their QP thresholds for scaling.
412 RTC_NOTREACHED() << "Unsupported codec without configured QP thresholds."; 409 RTC_NOTREACHED() << "Unsupported codec without configured QP thresholds.";
413 scale_ = false; 410 scale_ = false;
414 } 411 }
415 QualityScaler::Resolution res = quality_scaler_.GetScaledResolution(); 412 QualityScaler::Resolution res = quality_scaler_.GetScaledResolution();
416 init_width = res.width; 413 init_width = res.width;
417 init_height = res.height; 414 init_height = res.height;
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after
1297 return supported_codecs_; 1294 return supported_codecs_;
1298 } 1295 }
1299 1296
1300 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder( 1297 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder(
1301 webrtc::VideoEncoder* encoder) { 1298 webrtc::VideoEncoder* encoder) {
1302 ALOGD << "Destroy video encoder."; 1299 ALOGD << "Destroy video encoder.";
1303 delete encoder; 1300 delete encoder;
1304 } 1301 }
1305 1302
1306 } // namespace webrtc_jni 1303 } // namespace webrtc_jni
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698