OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 // affects webrtc:5683. | 291 // affects webrtc:5683. |
292 if ((dst_width == src_width && dst_height == src_height) || | 292 if ((dst_width == src_width && dst_height == src_height) || |
293 input_image.IsZeroSize() || | 293 input_image.IsZeroSize() || |
294 input_image.video_frame_buffer()->native_handle()) { | 294 input_image.video_frame_buffer()->native_handle()) { |
295 int ret = streaminfos_[stream_idx].encoder->Encode( | 295 int ret = streaminfos_[stream_idx].encoder->Encode( |
296 input_image, codec_specific_info, &stream_frame_types); | 296 input_image, codec_specific_info, &stream_frame_types); |
297 if (ret != WEBRTC_VIDEO_CODEC_OK) { | 297 if (ret != WEBRTC_VIDEO_CODEC_OK) { |
298 return ret; | 298 return ret; |
299 } | 299 } |
300 } else { | 300 } else { |
| 301 VideoFrame dst_frame; |
| 302 // Making sure that destination frame is of sufficient size. |
301 // Aligning stride values based on width. | 303 // Aligning stride values based on width. |
302 rtc::scoped_refptr<I420Buffer> dst_buffer = | 304 dst_frame.CreateEmptyFrame(dst_width, dst_height, dst_width, |
303 I420Buffer::Create(dst_width, dst_height, dst_width, | 305 (dst_width + 1) / 2, (dst_width + 1) / 2); |
304 (dst_width + 1) / 2, (dst_width + 1) / 2); | |
305 libyuv::I420Scale(input_image.video_frame_buffer()->DataY(), | 306 libyuv::I420Scale(input_image.video_frame_buffer()->DataY(), |
306 input_image.video_frame_buffer()->StrideY(), | 307 input_image.video_frame_buffer()->StrideY(), |
307 input_image.video_frame_buffer()->DataU(), | 308 input_image.video_frame_buffer()->DataU(), |
308 input_image.video_frame_buffer()->StrideU(), | 309 input_image.video_frame_buffer()->StrideU(), |
309 input_image.video_frame_buffer()->DataV(), | 310 input_image.video_frame_buffer()->DataV(), |
310 input_image.video_frame_buffer()->StrideV(), | 311 input_image.video_frame_buffer()->StrideV(), |
311 src_width, src_height, | 312 src_width, src_height, |
312 dst_buffer->MutableDataY(), dst_buffer->StrideY(), | 313 dst_frame.video_frame_buffer()->MutableDataY(), |
313 dst_buffer->MutableDataU(), dst_buffer->StrideU(), | 314 dst_frame.video_frame_buffer()->StrideY(), |
314 dst_buffer->MutableDataV(), dst_buffer->StrideV(), | 315 dst_frame.video_frame_buffer()->MutableDataU(), |
| 316 dst_frame.video_frame_buffer()->StrideU(), |
| 317 dst_frame.video_frame_buffer()->MutableDataV(), |
| 318 dst_frame.video_frame_buffer()->StrideV(), |
315 dst_width, dst_height, | 319 dst_width, dst_height, |
316 libyuv::kFilterBilinear); | 320 libyuv::kFilterBilinear); |
317 | 321 dst_frame.set_timestamp(input_image.timestamp()); |
| 322 dst_frame.set_render_time_ms(input_image.render_time_ms()); |
318 int ret = streaminfos_[stream_idx].encoder->Encode( | 323 int ret = streaminfos_[stream_idx].encoder->Encode( |
319 VideoFrame(dst_buffer, input_image.timestamp(), | 324 dst_frame, codec_specific_info, &stream_frame_types); |
320 input_image.render_time_ms(), webrtc::kVideoRotation_0), | |
321 codec_specific_info, &stream_frame_types); | |
322 if (ret != WEBRTC_VIDEO_CODEC_OK) { | 325 if (ret != WEBRTC_VIDEO_CODEC_OK) { |
323 return ret; | 326 return ret; |
324 } | 327 } |
325 } | 328 } |
326 } | 329 } |
327 | 330 |
328 return WEBRTC_VIDEO_CODEC_OK; | 331 return WEBRTC_VIDEO_CODEC_OK; |
329 } | 332 } |
330 | 333 |
331 int SimulcastEncoderAdapter::RegisterEncodeCompleteCallback( | 334 int SimulcastEncoderAdapter::RegisterEncodeCompleteCallback( |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 return false; | 472 return false; |
470 } | 473 } |
471 return true; | 474 return true; |
472 } | 475 } |
473 | 476 |
474 const char* SimulcastEncoderAdapter::ImplementationName() const { | 477 const char* SimulcastEncoderAdapter::ImplementationName() const { |
475 return implementation_name_.c_str(); | 478 return implementation_name_.c_str(); |
476 } | 479 } |
477 | 480 |
478 } // namespace webrtc | 481 } // namespace webrtc |
OLD | NEW |