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; |
309 } else { | 312 } else { |
310 config_->kf_mode = VPX_KF_DISABLED; | 313 config_->kf_mode = VPX_KF_DISABLED; |
311 } | 314 } |
312 config_->rc_resize_allowed = inst->codecSpecific.VP9.automaticResizeOn ? | 315 config_->rc_resize_allowed = inst->codecSpecific.VP9.automaticResizeOn ? |
313 1 : 0; | 316 1 : 0; |
314 // Determine number of threads based on the image size and #cores. | 317 // Determine number of threads based on the image size and #cores. |
315 config_->g_threads = NumberOfThreads(config_->g_w, | 318 config_->g_threads = NumberOfThreads(config_->g_w, |
316 config_->g_h, | 319 config_->g_h, |
317 number_of_cores); | 320 number_of_cores); |
318 | 321 |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 | 540 |
538 return WEBRTC_VIDEO_CODEC_OK; | 541 return WEBRTC_VIDEO_CODEC_OK; |
539 } | 542 } |
540 | 543 |
541 void VP9EncoderImpl::PopulateCodecSpecific(CodecSpecificInfo* codec_specific, | 544 void VP9EncoderImpl::PopulateCodecSpecific(CodecSpecificInfo* codec_specific, |
542 const vpx_codec_cx_pkt& pkt, | 545 const vpx_codec_cx_pkt& pkt, |
543 uint32_t timestamp) { | 546 uint32_t timestamp) { |
544 assert(codec_specific != NULL); | 547 assert(codec_specific != NULL); |
545 codec_specific->codecType = kVideoCodecVP9; | 548 codec_specific->codecType = kVideoCodecVP9; |
546 CodecSpecificInfoVP9 *vp9_info = &(codec_specific->codecSpecific.VP9); | 549 CodecSpecificInfoVP9 *vp9_info = &(codec_specific->codecSpecific.VP9); |
547 // TODO(asapersson): Set correct values. | 550 // TODO(asapersson): Set correct value. |
548 vp9_info->inter_pic_predicted = | 551 vp9_info->inter_pic_predicted = |
549 (pkt.data.frame.flags & VPX_FRAME_IS_KEY) ? false : true; | 552 (pkt.data.frame.flags & VPX_FRAME_IS_KEY) ? false : true; |
550 vp9_info->flexible_mode = codec_.codecSpecific.VP9.flexibleMode; | 553 vp9_info->flexible_mode = codec_.codecSpecific.VP9.flexibleMode; |
551 vp9_info->ss_data_available = ((pkt.data.frame.flags & VPX_FRAME_IS_KEY) && | 554 vp9_info->ss_data_available = ((pkt.data.frame.flags & VPX_FRAME_IS_KEY) && |
552 !codec_.codecSpecific.VP9.flexibleMode) | 555 !codec_.codecSpecific.VP9.flexibleMode) |
553 ? true | 556 ? true |
554 : false; | 557 : false; |
555 | 558 |
556 vpx_svc_layer_id_t layer_id = {0}; | 559 vpx_svc_layer_id_t layer_id = {0}; |
557 vpx_codec_control(encoder_, VP9E_GET_SVC_LAYER_ID, &layer_id); | 560 vpx_codec_control(encoder_, VP9E_GET_SVC_LAYER_ID, &layer_id); |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
966 decoder_ = NULL; | 969 decoder_ = NULL; |
967 } | 970 } |
968 // Releases buffers from the pool. Any buffers not in use are deleted. Buffers | 971 // Releases buffers from the pool. Any buffers not in use are deleted. Buffers |
969 // still referenced externally are deleted once fully released, not returning | 972 // still referenced externally are deleted once fully released, not returning |
970 // to the pool. | 973 // to the pool. |
971 frame_buffer_pool_.ClearPool(); | 974 frame_buffer_pool_.ClearPool(); |
972 inited_ = false; | 975 inited_ = false; |
973 return WEBRTC_VIDEO_CODEC_OK; | 976 return WEBRTC_VIDEO_CODEC_OK; |
974 } | 977 } |
975 } // namespace webrtc | 978 } // namespace webrtc |
OLD | NEW |