| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 config_->rc_undershoot_pct = 50; | 299 config_->rc_undershoot_pct = 50; |
| 300 config_->rc_overshoot_pct = 50; | 300 config_->rc_overshoot_pct = 50; |
| 301 config_->rc_buf_initial_sz = 500; | 301 config_->rc_buf_initial_sz = 500; |
| 302 config_->rc_buf_optimal_sz = 600; | 302 config_->rc_buf_optimal_sz = 600; |
| 303 config_->rc_buf_sz = 1000; | 303 config_->rc_buf_sz = 1000; |
| 304 // Set the maximum target size of any key-frame. | 304 // Set the maximum target size of any key-frame. |
| 305 rc_max_intra_target_ = MaxIntraTarget(config_->rc_buf_optimal_sz); | 305 rc_max_intra_target_ = MaxIntraTarget(config_->rc_buf_optimal_sz); |
| 306 if (inst->codecSpecific.VP9.keyFrameInterval > 0) { | 306 if (inst->codecSpecific.VP9.keyFrameInterval > 0) { |
| 307 config_->kf_mode = VPX_KF_AUTO; | 307 config_->kf_mode = VPX_KF_AUTO; |
| 308 config_->kf_max_dist = inst->codecSpecific.VP9.keyFrameInterval; | 308 config_->kf_max_dist = inst->codecSpecific.VP9.keyFrameInterval; |
| 309 // Needs to be set (in svc mode) to get correct periodic key frame interval | |
| 310 // (will have no effect in non-svc). | |
| 311 config_->kf_min_dist = config_->kf_max_dist; | |
| 312 } else { | 309 } else { |
| 313 config_->kf_mode = VPX_KF_DISABLED; | 310 config_->kf_mode = VPX_KF_DISABLED; |
| 314 } | 311 } |
| 315 config_->rc_resize_allowed = inst->codecSpecific.VP9.automaticResizeOn ? | 312 config_->rc_resize_allowed = inst->codecSpecific.VP9.automaticResizeOn ? |
| 316 1 : 0; | 313 1 : 0; |
| 317 // Determine number of threads based on the image size and #cores. | 314 // Determine number of threads based on the image size and #cores. |
| 318 config_->g_threads = NumberOfThreads(config_->g_w, | 315 config_->g_threads = NumberOfThreads(config_->g_w, |
| 319 config_->g_h, | 316 config_->g_h, |
| 320 number_of_cores); | 317 number_of_cores); |
| 321 | 318 |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 | 537 |
| 541 return WEBRTC_VIDEO_CODEC_OK; | 538 return WEBRTC_VIDEO_CODEC_OK; |
| 542 } | 539 } |
| 543 | 540 |
| 544 void VP9EncoderImpl::PopulateCodecSpecific(CodecSpecificInfo* codec_specific, | 541 void VP9EncoderImpl::PopulateCodecSpecific(CodecSpecificInfo* codec_specific, |
| 545 const vpx_codec_cx_pkt& pkt, | 542 const vpx_codec_cx_pkt& pkt, |
| 546 uint32_t timestamp) { | 543 uint32_t timestamp) { |
| 547 assert(codec_specific != NULL); | 544 assert(codec_specific != NULL); |
| 548 codec_specific->codecType = kVideoCodecVP9; | 545 codec_specific->codecType = kVideoCodecVP9; |
| 549 CodecSpecificInfoVP9 *vp9_info = &(codec_specific->codecSpecific.VP9); | 546 CodecSpecificInfoVP9 *vp9_info = &(codec_specific->codecSpecific.VP9); |
| 550 // TODO(asapersson): Set correct value. | 547 // TODO(asapersson): Set correct values. |
| 551 vp9_info->inter_pic_predicted = | 548 vp9_info->inter_pic_predicted = |
| 552 (pkt.data.frame.flags & VPX_FRAME_IS_KEY) ? false : true; | 549 (pkt.data.frame.flags & VPX_FRAME_IS_KEY) ? false : true; |
| 553 vp9_info->flexible_mode = codec_.codecSpecific.VP9.flexibleMode; | 550 vp9_info->flexible_mode = codec_.codecSpecific.VP9.flexibleMode; |
| 554 vp9_info->ss_data_available = ((pkt.data.frame.flags & VPX_FRAME_IS_KEY) && | 551 vp9_info->ss_data_available = ((pkt.data.frame.flags & VPX_FRAME_IS_KEY) && |
| 555 !codec_.codecSpecific.VP9.flexibleMode) | 552 !codec_.codecSpecific.VP9.flexibleMode) |
| 556 ? true | 553 ? true |
| 557 : false; | 554 : false; |
| 558 | 555 |
| 559 vpx_svc_layer_id_t layer_id = {0}; | 556 vpx_svc_layer_id_t layer_id = {0}; |
| 560 vpx_codec_control(encoder_, VP9E_GET_SVC_LAYER_ID, &layer_id); | 557 vpx_codec_control(encoder_, VP9E_GET_SVC_LAYER_ID, &layer_id); |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 969 decoder_ = NULL; | 966 decoder_ = NULL; |
| 970 } | 967 } |
| 971 // Releases buffers from the pool. Any buffers not in use are deleted. Buffers | 968 // Releases buffers from the pool. Any buffers not in use are deleted. Buffers |
| 972 // still referenced externally are deleted once fully released, not returning | 969 // still referenced externally are deleted once fully released, not returning |
| 973 // to the pool. | 970 // to the pool. |
| 974 frame_buffer_pool_.ClearPool(); | 971 frame_buffer_pool_.ClearPool(); |
| 975 inited_ = false; | 972 inited_ = false; |
| 976 return WEBRTC_VIDEO_CODEC_OK; | 973 return WEBRTC_VIDEO_CODEC_OK; |
| 977 } | 974 } |
| 978 } // namespace webrtc | 975 } // namespace webrtc |
| OLD | NEW |