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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
270 return WEBRTC_VIDEO_CODEC_OK; | 270 return WEBRTC_VIDEO_CODEC_OK; |
271 } | 271 } |
272 | 272 |
273 int32_t H264EncoderImpl::Encode(const VideoFrame& input_frame, | 273 int32_t H264EncoderImpl::Encode(const VideoFrame& input_frame, |
274 const CodecSpecificInfo* codec_specific_info, | 274 const CodecSpecificInfo* codec_specific_info, |
275 const std::vector<FrameType>* frame_types) { | 275 const std::vector<FrameType>* frame_types) { |
276 if (!IsInitialized()) { | 276 if (!IsInitialized()) { |
277 ReportError(); | 277 ReportError(); |
278 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; | 278 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; |
279 } | 279 } |
280 if (input_frame.IsZeroSize()) { | |
stefan-webrtc
2016/09/05 14:45:25
Should we DCHECK that we have a video_frame_buffer
| |
281 ReportError(); | |
282 return WEBRTC_VIDEO_CODEC_ERR_PARAMETER; | |
283 } | |
284 if (!encoded_image_callback_) { | 280 if (!encoded_image_callback_) { |
285 LOG(LS_WARNING) << "InitEncode() has been called, but a callback function " | 281 LOG(LS_WARNING) << "InitEncode() has been called, but a callback function " |
286 << "has not been set with RegisterEncodeCompleteCallback()"; | 282 << "has not been set with RegisterEncodeCompleteCallback()"; |
287 ReportError(); | 283 ReportError(); |
288 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; | 284 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; |
289 } | 285 } |
290 | 286 |
291 quality_scaler_.OnEncodeFrame(input_frame.width(), input_frame.height()); | 287 quality_scaler_.OnEncodeFrame(input_frame.width(), input_frame.height()); |
292 rtc::scoped_refptr<const VideoFrameBuffer> frame_buffer = | 288 rtc::scoped_refptr<const VideoFrameBuffer> frame_buffer = |
293 quality_scaler_.GetScaledBuffer(input_frame.video_frame_buffer()); | 289 quality_scaler_.GetScaledBuffer(input_frame.video_frame_buffer()); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
470 | 466 |
471 int32_t H264EncoderImpl::SetPeriodicKeyFrames(bool enable) { | 467 int32_t H264EncoderImpl::SetPeriodicKeyFrames(bool enable) { |
472 return WEBRTC_VIDEO_CODEC_OK; | 468 return WEBRTC_VIDEO_CODEC_OK; |
473 } | 469 } |
474 | 470 |
475 void H264EncoderImpl::OnDroppedFrame() { | 471 void H264EncoderImpl::OnDroppedFrame() { |
476 quality_scaler_.ReportDroppedFrame(); | 472 quality_scaler_.ReportDroppedFrame(); |
477 } | 473 } |
478 | 474 |
479 } // namespace webrtc | 475 } // namespace webrtc |
OLD | NEW |