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_ = codecType_ == kVideoCodecVP8 ? codec_settings->VP8.automaticResizeOn | |
AlexG
2016/06/30 12:53:43
nit: easier to read:
if (codecType_ == kVideoCodec
| |
388 : codecType_ != kVideoCodecVP9; | |
386 | 389 |
387 ALOGD << "InitEncode request: " << init_width << " x " << init_height; | 390 ALOGD << "InitEncode request: " << init_width << " x " << init_height; |
388 ALOGD << "Encoder automatic resize " << (scale_ ? "enabled" : "disabled"); | 391 ALOGD << "Encoder automatic resize " << (scale_ ? "enabled" : "disabled"); |
389 | 392 |
390 if (scale_) { | 393 if (scale_) { |
391 if (codecType_ == kVideoCodecVP8) { | 394 if (codecType_ == kVideoCodecVP8) { |
392 quality_scaler_.Init( | 395 quality_scaler_.Init( |
393 QualityScaler::kLowVp8QpThreshold, QualityScaler::kBadVp8QpThreshold, | 396 QualityScaler::kLowVp8QpThreshold, QualityScaler::kBadVp8QpThreshold, |
394 codec_settings->startBitrate, codec_settings->width, | 397 codec_settings->startBitrate, codec_settings->width, |
395 codec_settings->height, codec_settings->maxFramerate); | 398 codec_settings->height, codec_settings->maxFramerate); |
(...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1290 return supported_codecs_; | 1293 return supported_codecs_; |
1291 } | 1294 } |
1292 | 1295 |
1293 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder( | 1296 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder( |
1294 webrtc::VideoEncoder* encoder) { | 1297 webrtc::VideoEncoder* encoder) { |
1295 ALOGD << "Destroy video encoder."; | 1298 ALOGD << "Destroy video encoder."; |
1296 delete encoder; | 1299 delete encoder; |
1297 } | 1300 } |
1298 | 1301 |
1299 } // namespace webrtc_jni | 1302 } // namespace webrtc_jni |
OLD | NEW |