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...) Expand 10 before | Expand all | Expand 10 after 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 } | |
315 if (!encoded_image_callback_) { | 311 if (!encoded_image_callback_) { |
316 LOG(LS_WARNING) << "InitEncode() has been called, but a callback function " | 312 LOG(LS_WARNING) << "InitEncode() has been called, but a callback function " |
317 << "has not been set with RegisterEncodeCompleteCallback()"; | 313 << "has not been set with RegisterEncodeCompleteCallback()"; |
318 ReportError(); | 314 ReportError(); |
319 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; | 315 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; |
320 } | 316 } |
321 | 317 |
322 bool force_key_frame = false; | 318 bool force_key_frame = false; |
323 if (frame_types != nullptr) { | 319 if (frame_types != nullptr) { |
324 // We only support a single stream. | 320 // We only support a single stream. |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 | 513 |
518 int32_t H264EncoderImpl::SetPeriodicKeyFrames(bool enable) { | 514 int32_t H264EncoderImpl::SetPeriodicKeyFrames(bool enable) { |
519 return WEBRTC_VIDEO_CODEC_OK; | 515 return WEBRTC_VIDEO_CODEC_OK; |
520 } | 516 } |
521 | 517 |
522 VideoEncoder::ScalingSettings H264EncoderImpl::GetScalingSettings() const { | 518 VideoEncoder::ScalingSettings H264EncoderImpl::GetScalingSettings() const { |
523 return VideoEncoder::ScalingSettings(true); | 519 return VideoEncoder::ScalingSettings(true); |
524 } | 520 } |
525 | 521 |
526 } // namespace webrtc | 522 } // namespace webrtc |
OLD | NEW |