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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
309 config_->rc_undershoot_pct = 50; | 309 config_->rc_undershoot_pct = 50; |
310 config_->rc_overshoot_pct = 50; | 310 config_->rc_overshoot_pct = 50; |
311 config_->rc_buf_initial_sz = 500; | 311 config_->rc_buf_initial_sz = 500; |
312 config_->rc_buf_optimal_sz = 600; | 312 config_->rc_buf_optimal_sz = 600; |
313 config_->rc_buf_sz = 1000; | 313 config_->rc_buf_sz = 1000; |
314 // Set the maximum target size of any key-frame. | 314 // Set the maximum target size of any key-frame. |
315 rc_max_intra_target_ = MaxIntraTarget(config_->rc_buf_optimal_sz); | 315 rc_max_intra_target_ = MaxIntraTarget(config_->rc_buf_optimal_sz); |
316 if (inst->codecSpecific.VP9.keyFrameInterval > 0) { | 316 if (inst->codecSpecific.VP9.keyFrameInterval > 0) { |
317 config_->kf_mode = VPX_KF_AUTO; | 317 config_->kf_mode = VPX_KF_AUTO; |
318 config_->kf_max_dist = inst->codecSpecific.VP9.keyFrameInterval; | 318 config_->kf_max_dist = inst->codecSpecific.VP9.keyFrameInterval; |
319 // Needs to be set (in svc mode) to get correct periodic key frame interval | |
320 // (will have no effect in non-svc). | |
321 config_->kf_min_dist = config_->kf_max_dist; | |
319 } else { | 322 } else { |
320 config_->kf_mode = VPX_KF_DISABLED; | 323 config_->kf_mode = VPX_KF_DISABLED; |
321 } | 324 } |
322 config_->rc_resize_allowed = inst->codecSpecific.VP9.automaticResizeOn ? | 325 config_->rc_resize_allowed = inst->codecSpecific.VP9.automaticResizeOn ? |
323 1 : 0; | 326 1 : 0; |
324 // Determine number of threads based on the image size and #cores. | 327 // Determine number of threads based on the image size and #cores. |
325 config_->g_threads = NumberOfThreads(config_->g_w, | 328 config_->g_threads = NumberOfThreads(config_->g_w, |
326 config_->g_h, | 329 config_->g_h, |
327 number_of_cores); | 330 number_of_cores); |
328 | 331 |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
549 } | 552 } |
550 | 553 |
551 void VP9EncoderImpl::PopulateCodecSpecific(CodecSpecificInfo* codec_specific, | 554 void VP9EncoderImpl::PopulateCodecSpecific(CodecSpecificInfo* codec_specific, |
552 const vpx_codec_cx_pkt& pkt, | 555 const vpx_codec_cx_pkt& pkt, |
553 uint32_t timestamp) { | 556 uint32_t timestamp) { |
554 assert(codec_specific != NULL); | 557 assert(codec_specific != NULL); |
555 codec_specific->codecType = kVideoCodecVP9; | 558 codec_specific->codecType = kVideoCodecVP9; |
556 CodecSpecificInfoVP9 *vp9_info = &(codec_specific->codecSpecific.VP9); | 559 CodecSpecificInfoVP9 *vp9_info = &(codec_specific->codecSpecific.VP9); |
557 // TODO(asapersson): Set correct values. | 560 // TODO(asapersson): Set correct values. |
558 vp9_info->inter_pic_predicted = | 561 vp9_info->inter_pic_predicted = |
559 (pkt.data.frame.flags & VPX_FRAME_IS_KEY) ? false : true; | 562 (pkt.data.frame.flags & VPX_FRAME_IS_KEY) ? false : true; |
stefan-webrtc
2015/12/01 14:15:49
Update comment as discussed.
åsapersson
2015/12/02 07:46:09
Done.
| |
560 vp9_info->flexible_mode = codec_.codecSpecific.VP9.flexibleMode; | 563 vp9_info->flexible_mode = codec_.codecSpecific.VP9.flexibleMode; |
561 vp9_info->ss_data_available = ((pkt.data.frame.flags & VPX_FRAME_IS_KEY) && | 564 vp9_info->ss_data_available = ((pkt.data.frame.flags & VPX_FRAME_IS_KEY) && |
562 !codec_.codecSpecific.VP9.flexibleMode) | 565 !codec_.codecSpecific.VP9.flexibleMode) |
563 ? true | 566 ? true |
564 : false; | 567 : false; |
565 | 568 |
566 vpx_svc_layer_id_t layer_id = {0}; | 569 vpx_svc_layer_id_t layer_id = {0}; |
567 vpx_codec_control(encoder_, VP9E_GET_SVC_LAYER_ID, &layer_id); | 570 vpx_codec_control(encoder_, VP9E_GET_SVC_LAYER_ID, &layer_id); |
568 | 571 |
569 assert(num_temporal_layers_ > 0); | 572 assert(num_temporal_layers_ > 0); |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
978 decoder_ = NULL; | 981 decoder_ = NULL; |
979 } | 982 } |
980 // Releases buffers from the pool. Any buffers not in use are deleted. Buffers | 983 // Releases buffers from the pool. Any buffers not in use are deleted. Buffers |
981 // still referenced externally are deleted once fully released, not returning | 984 // still referenced externally are deleted once fully released, not returning |
982 // to the pool. | 985 // to the pool. |
983 frame_buffer_pool_.ClearPool(); | 986 frame_buffer_pool_.ClearPool(); |
984 inited_ = false; | 987 inited_ = false; |
985 return WEBRTC_VIDEO_CODEC_OK; | 988 return WEBRTC_VIDEO_CODEC_OK; |
986 } | 989 } |
987 } // namespace webrtc | 990 } // namespace webrtc |
OLD | NEW |