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