OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 } | 653 } |
654 | 654 |
655 int VP8EncoderImpl::Encode(const VideoFrame& frame, | 655 int VP8EncoderImpl::Encode(const VideoFrame& frame, |
656 const CodecSpecificInfo* codec_specific_info, | 656 const CodecSpecificInfo* codec_specific_info, |
657 const std::vector<FrameType>* frame_types) { | 657 const std::vector<FrameType>* frame_types) { |
658 RTC_DCHECK_EQ(frame.width(), codec_.width); | 658 RTC_DCHECK_EQ(frame.width(), codec_.width); |
659 RTC_DCHECK_EQ(frame.height(), codec_.height); | 659 RTC_DCHECK_EQ(frame.height(), codec_.height); |
660 | 660 |
661 if (!inited_) | 661 if (!inited_) |
662 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; | 662 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; |
663 if (frame.IsZeroSize()) | |
664 return WEBRTC_VIDEO_CODEC_ERR_PARAMETER; | |
665 if (encoded_complete_callback_ == NULL) | 663 if (encoded_complete_callback_ == NULL) |
666 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; | 664 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; |
667 | 665 |
668 rtc::scoped_refptr<VideoFrameBuffer> input_image = frame.video_frame_buffer(); | 666 rtc::scoped_refptr<VideoFrameBuffer> input_image = frame.video_frame_buffer(); |
669 // Since we are extracting raw pointers from |input_image| to | 667 // Since we are extracting raw pointers from |input_image| to |
670 // |raw_images_[0]|, the resolution of these frames must match. Note that | 668 // |raw_images_[0]|, the resolution of these frames must match. Note that |
671 // |input_image| might be scaled from |frame|. In that case, the resolution of | 669 // |input_image| might be scaled from |frame|. In that case, the resolution of |
672 // |raw_images_[0]| should have been updated in UpdateCodecFrameSize. | 670 // |raw_images_[0]| should have been updated in UpdateCodecFrameSize. |
673 RTC_DCHECK_EQ(input_image->width(), raw_images_[0].d_w); | 671 RTC_DCHECK_EQ(input_image->width(), raw_images_[0].d_w); |
674 RTC_DCHECK_EQ(input_image->height(), raw_images_[0].d_h); | 672 RTC_DCHECK_EQ(input_image->height(), raw_images_[0].d_h); |
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1279 return -1; | 1277 return -1; |
1280 } | 1278 } |
1281 if (vpx_codec_control(copy->decoder_, VP8_SET_REFERENCE, ref_frame_) != | 1279 if (vpx_codec_control(copy->decoder_, VP8_SET_REFERENCE, ref_frame_) != |
1282 VPX_CODEC_OK) { | 1280 VPX_CODEC_OK) { |
1283 return -1; | 1281 return -1; |
1284 } | 1282 } |
1285 return 0; | 1283 return 0; |
1286 } | 1284 } |
1287 | 1285 |
1288 } // namespace webrtc | 1286 } // namespace webrtc |
OLD | NEW |