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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 return WEBRTC_VIDEO_CODEC_OK; | 287 return WEBRTC_VIDEO_CODEC_OK; |
288 } | 288 } |
289 | 289 |
290 int32_t H264EncoderImpl::Encode(const VideoFrame& input_frame, | 290 int32_t H264EncoderImpl::Encode(const VideoFrame& input_frame, |
291 const CodecSpecificInfo* codec_specific_info, | 291 const CodecSpecificInfo* codec_specific_info, |
292 const std::vector<FrameType>* frame_types) { | 292 const std::vector<FrameType>* frame_types) { |
293 if (!IsInitialized()) { | 293 if (!IsInitialized()) { |
294 ReportError(); | 294 ReportError(); |
295 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; | 295 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; |
296 } | 296 } |
297 if (input_frame.IsZeroSize()) { | |
298 ReportError(); | |
299 return WEBRTC_VIDEO_CODEC_ERR_PARAMETER; | |
300 } | |
301 if (!encoded_image_callback_) { | 297 if (!encoded_image_callback_) { |
302 LOG(LS_WARNING) << "InitEncode() has been called, but a callback function " | 298 LOG(LS_WARNING) << "InitEncode() has been called, but a callback function " |
303 << "has not been set with RegisterEncodeCompleteCallback()"; | 299 << "has not been set with RegisterEncodeCompleteCallback()"; |
304 ReportError(); | 300 ReportError(); |
305 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; | 301 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; |
306 } | 302 } |
307 | 303 |
308 bool force_key_frame = false; | 304 bool force_key_frame = false; |
309 if (frame_types != nullptr) { | 305 if (frame_types != nullptr) { |
310 // We only support a single stream. | 306 // We only support a single stream. |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 | 471 |
476 int32_t H264EncoderImpl::SetPeriodicKeyFrames(bool enable) { | 472 int32_t H264EncoderImpl::SetPeriodicKeyFrames(bool enable) { |
477 return WEBRTC_VIDEO_CODEC_OK; | 473 return WEBRTC_VIDEO_CODEC_OK; |
478 } | 474 } |
479 | 475 |
480 VideoEncoder::ScalingSettings H264EncoderImpl::GetScalingSettings() const { | 476 VideoEncoder::ScalingSettings H264EncoderImpl::GetScalingSettings() const { |
481 return VideoEncoder::ScalingSettings(true); | 477 return VideoEncoder::ScalingSettings(true); |
482 } | 478 } |
483 | 479 |
484 } // namespace webrtc | 480 } // namespace webrtc |
OLD | NEW |