OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 290 matching lines...) Loading... |
301 return WEBRTC_VIDEO_CODEC_OK; | 301 return WEBRTC_VIDEO_CODEC_OK; |
302 } | 302 } |
303 | 303 |
304 int32_t H264EncoderImpl::Encode(const VideoFrame& input_frame, | 304 int32_t H264EncoderImpl::Encode(const VideoFrame& input_frame, |
305 const CodecSpecificInfo* codec_specific_info, | 305 const CodecSpecificInfo* codec_specific_info, |
306 const std::vector<FrameType>* frame_types) { | 306 const std::vector<FrameType>* frame_types) { |
307 if (!IsInitialized()) { | 307 if (!IsInitialized()) { |
308 ReportError(); | 308 ReportError(); |
309 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; | 309 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; |
310 } | 310 } |
| 311 if (input_frame.IsZeroSize()) { |
| 312 ReportError(); |
| 313 return WEBRTC_VIDEO_CODEC_ERR_PARAMETER; |
| 314 } |
311 if (!encoded_image_callback_) { | 315 if (!encoded_image_callback_) { |
312 LOG(LS_WARNING) << "InitEncode() has been called, but a callback function " | 316 LOG(LS_WARNING) << "InitEncode() has been called, but a callback function " |
313 << "has not been set with RegisterEncodeCompleteCallback()"; | 317 << "has not been set with RegisterEncodeCompleteCallback()"; |
314 ReportError(); | 318 ReportError(); |
315 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; | 319 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; |
316 } | 320 } |
317 | 321 |
318 bool force_key_frame = false; | 322 bool force_key_frame = false; |
319 if (frame_types != nullptr) { | 323 if (frame_types != nullptr) { |
320 // We only support a single stream. | 324 // We only support a single stream. |
(...skipping 192 matching lines...) Loading... |
513 | 517 |
514 int32_t H264EncoderImpl::SetPeriodicKeyFrames(bool enable) { | 518 int32_t H264EncoderImpl::SetPeriodicKeyFrames(bool enable) { |
515 return WEBRTC_VIDEO_CODEC_OK; | 519 return WEBRTC_VIDEO_CODEC_OK; |
516 } | 520 } |
517 | 521 |
518 VideoEncoder::ScalingSettings H264EncoderImpl::GetScalingSettings() const { | 522 VideoEncoder::ScalingSettings H264EncoderImpl::GetScalingSettings() const { |
519 return VideoEncoder::ScalingSettings(true); | 523 return VideoEncoder::ScalingSettings(true); |
520 } | 524 } |
521 | 525 |
522 } // namespace webrtc | 526 } // namespace webrtc |
OLD | NEW |