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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 const uint32_t min_intra_size = 300; | 479 const uint32_t min_intra_size = 300; |
480 return (target_pct < min_intra_size) ? min_intra_size : target_pct; | 480 return (target_pct < min_intra_size) ? min_intra_size : target_pct; |
481 } | 481 } |
482 | 482 |
483 int VP9EncoderImpl::Encode(const VideoFrame& input_image, | 483 int VP9EncoderImpl::Encode(const VideoFrame& input_image, |
484 const CodecSpecificInfo* codec_specific_info, | 484 const CodecSpecificInfo* codec_specific_info, |
485 const std::vector<FrameType>* frame_types) { | 485 const std::vector<FrameType>* frame_types) { |
486 if (!inited_) { | 486 if (!inited_) { |
487 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; | 487 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; |
488 } | 488 } |
| 489 if (input_image.IsZeroSize()) { |
| 490 return WEBRTC_VIDEO_CODEC_ERR_PARAMETER; |
| 491 } |
489 if (encoded_complete_callback_ == NULL) { | 492 if (encoded_complete_callback_ == NULL) { |
490 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; | 493 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; |
491 } | 494 } |
492 FrameType frame_type = kVideoFrameDelta; | 495 FrameType frame_type = kVideoFrameDelta; |
493 // We only support one stream at the moment. | 496 // We only support one stream at the moment. |
494 if (frame_types && frame_types->size() > 0) { | 497 if (frame_types && frame_types->size() > 0) { |
495 frame_type = (*frame_types)[0]; | 498 frame_type = (*frame_types)[0]; |
496 } | 499 } |
497 RTC_DCHECK_EQ(input_image.width(), raw_->d_w); | 500 RTC_DCHECK_EQ(input_image.width(), raw_->d_w); |
498 RTC_DCHECK_EQ(input_image.height(), raw_->d_h); | 501 RTC_DCHECK_EQ(input_image.height(), raw_->d_h); |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 frame_buffer_pool_.ClearPool(); | 999 frame_buffer_pool_.ClearPool(); |
997 inited_ = false; | 1000 inited_ = false; |
998 return WEBRTC_VIDEO_CODEC_OK; | 1001 return WEBRTC_VIDEO_CODEC_OK; |
999 } | 1002 } |
1000 | 1003 |
1001 const char* VP9DecoderImpl::ImplementationName() const { | 1004 const char* VP9DecoderImpl::ImplementationName() const { |
1002 return "libvpx"; | 1005 return "libvpx"; |
1003 } | 1006 } |
1004 | 1007 |
1005 } // namespace webrtc | 1008 } // namespace webrtc |
OLD | NEW |