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 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 // Don't go below 3 times the per frame bandwidth. | 732 // Don't go below 3 times the per frame bandwidth. |
733 const uint32_t minIntraTh = 300; | 733 const uint32_t minIntraTh = 300; |
734 return (targetPct < minIntraTh) ? minIntraTh : targetPct; | 734 return (targetPct < minIntraTh) ? minIntraTh : targetPct; |
735 } | 735 } |
736 | 736 |
737 int VP8EncoderImpl::Encode(const VideoFrame& frame, | 737 int VP8EncoderImpl::Encode(const VideoFrame& frame, |
738 const CodecSpecificInfo* codec_specific_info, | 738 const CodecSpecificInfo* codec_specific_info, |
739 const std::vector<FrameType>* frame_types) { | 739 const std::vector<FrameType>* frame_types) { |
740 if (!inited_) | 740 if (!inited_) |
741 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; | 741 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; |
742 if (frame.IsZeroSize()) | |
743 return WEBRTC_VIDEO_CODEC_ERR_PARAMETER; | |
744 if (encoded_complete_callback_ == NULL) | 742 if (encoded_complete_callback_ == NULL) |
745 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; | 743 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; |
746 | 744 |
747 rtc::scoped_refptr<VideoFrameBuffer> input_image = frame.video_frame_buffer(); | 745 rtc::scoped_refptr<VideoFrameBuffer> input_image = frame.video_frame_buffer(); |
748 | 746 |
749 if (quality_scaler_enabled_) { | 747 if (quality_scaler_enabled_) { |
750 quality_scaler_.OnEncodeFrame(frame.width(), frame.height()); | 748 quality_scaler_.OnEncodeFrame(frame.width(), frame.height()); |
751 input_image = quality_scaler_.GetScaledBuffer(input_image); | 749 input_image = quality_scaler_.GetScaledBuffer(input_image); |
752 | 750 |
753 if (input_image->width() != codec_.width || | 751 if (input_image->width() != codec_.width || |
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1404 return -1; | 1402 return -1; |
1405 } | 1403 } |
1406 if (vpx_codec_control(copy->decoder_, VP8_SET_REFERENCE, ref_frame_) != | 1404 if (vpx_codec_control(copy->decoder_, VP8_SET_REFERENCE, ref_frame_) != |
1407 VPX_CODEC_OK) { | 1405 VPX_CODEC_OK) { |
1408 return -1; | 1406 return -1; |
1409 } | 1407 } |
1410 return 0; | 1408 return 0; |
1411 } | 1409 } |
1412 | 1410 |
1413 } // namespace webrtc | 1411 } // namespace webrtc |
OLD | NEW |