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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 float scale_par = 0.5; | 421 float scale_par = 0.5; |
422 uint32_t target_pct = | 422 uint32_t target_pct = |
423 optimal_buffer_size * scale_par * codec_.maxFramerate / 10; | 423 optimal_buffer_size * scale_par * codec_.maxFramerate / 10; |
424 // Don't go below 3 times the per frame bandwidth. | 424 // Don't go below 3 times the per frame bandwidth. |
425 const uint32_t min_intra_size = 300; | 425 const uint32_t min_intra_size = 300; |
426 return (target_pct < min_intra_size) ? min_intra_size: target_pct; | 426 return (target_pct < min_intra_size) ? min_intra_size: target_pct; |
427 } | 427 } |
428 | 428 |
429 int VP9EncoderImpl::Encode(const VideoFrame& input_image, | 429 int VP9EncoderImpl::Encode(const VideoFrame& input_image, |
430 const CodecSpecificInfo* codec_specific_info, | 430 const CodecSpecificInfo* codec_specific_info, |
431 const std::vector<VideoFrameType>* frame_types) { | 431 const std::vector<FrameType>* frame_types) { |
432 if (!inited_) { | 432 if (!inited_) { |
433 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; | 433 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; |
434 } | 434 } |
435 if (input_image.IsZeroSize()) { | 435 if (input_image.IsZeroSize()) { |
436 return WEBRTC_VIDEO_CODEC_ERR_PARAMETER; | 436 return WEBRTC_VIDEO_CODEC_ERR_PARAMETER; |
437 } | 437 } |
438 if (encoded_complete_callback_ == NULL) { | 438 if (encoded_complete_callback_ == NULL) { |
439 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; | 439 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; |
440 } | 440 } |
441 VideoFrameType frame_type = kDeltaFrame; | 441 FrameType frame_type = kDeltaFrame; |
442 // We only support one stream at the moment. | 442 // We only support one stream at the moment. |
443 if (frame_types && frame_types->size() > 0) { | 443 if (frame_types && frame_types->size() > 0) { |
444 frame_type = (*frame_types)[0]; | 444 frame_type = (*frame_types)[0]; |
445 } | 445 } |
446 RTC_DCHECK_EQ(input_image.width(), static_cast<int>(raw_->d_w)); | 446 RTC_DCHECK_EQ(input_image.width(), static_cast<int>(raw_->d_w)); |
447 RTC_DCHECK_EQ(input_image.height(), static_cast<int>(raw_->d_h)); | 447 RTC_DCHECK_EQ(input_image.height(), static_cast<int>(raw_->d_h)); |
448 | 448 |
449 // Set input image for use in the callback. | 449 // Set input image for use in the callback. |
450 // This was necessary since you need some information from input_image. | 450 // This was necessary since you need some information from input_image. |
451 // You can save only the necessary information (such as timestamp) instead of | 451 // You can save only the necessary information (such as timestamp) instead of |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
781 decoder_ = NULL; | 781 decoder_ = NULL; |
782 } | 782 } |
783 // Releases buffers from the pool. Any buffers not in use are deleted. Buffers | 783 // Releases buffers from the pool. Any buffers not in use are deleted. Buffers |
784 // still referenced externally are deleted once fully released, not returning | 784 // still referenced externally are deleted once fully released, not returning |
785 // to the pool. | 785 // to the pool. |
786 frame_buffer_pool_.ClearPool(); | 786 frame_buffer_pool_.ClearPool(); |
787 inited_ = false; | 787 inited_ = false; |
788 return WEBRTC_VIDEO_CODEC_OK; | 788 return WEBRTC_VIDEO_CODEC_OK; |
789 } | 789 } |
790 } // namespace webrtc | 790 } // namespace webrtc |
OLD | NEW |