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