| OLD | NEW |
| 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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 return WEBRTC_VIDEO_CODEC_ERR_PARAMETER; | 375 return WEBRTC_VIDEO_CODEC_ERR_PARAMETER; |
| 376 } | 376 } |
| 377 // Factory should guard against other codecs being used with us. | 377 // Factory should guard against other codecs being used with us. |
| 378 RTC_CHECK(codec_settings->codecType == codecType_) | 378 RTC_CHECK(codec_settings->codecType == codecType_) |
| 379 << "Unsupported codec " << codec_settings->codecType << " for " | 379 << "Unsupported codec " << codec_settings->codecType << " for " |
| 380 << codecType_; | 380 << codecType_; |
| 381 | 381 |
| 382 codec_mode_ = codec_settings->mode; | 382 codec_mode_ = codec_settings->mode; |
| 383 int init_width = codec_settings->width; | 383 int init_width = codec_settings->width; |
| 384 int init_height = codec_settings->height; | 384 int init_height = codec_settings->height; |
| 385 scale_ = codecType_ != kVideoCodecVP9; | 385 // Scaling is disabled for VP9, but optionally enabled for VP8. |
| 386 // TODO(pbos): Extract automaticResizeOn out of VP8 settings. |
| 387 scale_ = false; |
| 388 if (codecType_ == kVideoCodecVP8) { |
| 389 scale_ = codec_settings->codecSpecific.VP8.automaticResizeOn; |
| 390 } else if (codecType_ != kVideoCodecVP9) { |
| 391 scale_ = true; |
| 392 } |
| 386 | 393 |
| 387 ALOGD << "InitEncode request: " << init_width << " x " << init_height; | 394 ALOGD << "InitEncode request: " << init_width << " x " << init_height; |
| 388 ALOGD << "Encoder automatic resize " << (scale_ ? "enabled" : "disabled"); | 395 ALOGD << "Encoder automatic resize " << (scale_ ? "enabled" : "disabled"); |
| 389 | 396 |
| 390 if (scale_) { | 397 if (scale_) { |
| 391 if (codecType_ == kVideoCodecVP8) { | 398 if (codecType_ == kVideoCodecVP8) { |
| 392 quality_scaler_.Init( | 399 quality_scaler_.Init( |
| 393 QualityScaler::kLowVp8QpThreshold, QualityScaler::kBadVp8QpThreshold, | 400 QualityScaler::kLowVp8QpThreshold, QualityScaler::kBadVp8QpThreshold, |
| 394 codec_settings->startBitrate, codec_settings->width, | 401 codec_settings->startBitrate, codec_settings->width, |
| 395 codec_settings->height, codec_settings->maxFramerate); | 402 codec_settings->height, codec_settings->maxFramerate); |
| (...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1290 return supported_codecs_; | 1297 return supported_codecs_; |
| 1291 } | 1298 } |
| 1292 | 1299 |
| 1293 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder( | 1300 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder( |
| 1294 webrtc::VideoEncoder* encoder) { | 1301 webrtc::VideoEncoder* encoder) { |
| 1295 ALOGD << "Destroy video encoder."; | 1302 ALOGD << "Destroy video encoder."; |
| 1296 delete encoder; | 1303 delete encoder; |
| 1297 } | 1304 } |
| 1298 | 1305 |
| 1299 } // namespace webrtc_jni | 1306 } // namespace webrtc_jni |
| OLD | NEW |