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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 if ((dst_width == src_width && dst_height == src_height) || | 294 if ((dst_width == src_width && dst_height == src_height) || |
295 input_image.IsZeroSize()) { | 295 input_image.IsZeroSize()) { |
296 streaminfos_[stream_idx].encoder->Encode(input_image, codec_specific_info, | 296 streaminfos_[stream_idx].encoder->Encode(input_image, codec_specific_info, |
297 &stream_frame_types); | 297 &stream_frame_types); |
298 } else { | 298 } else { |
299 VideoFrame dst_frame; | 299 VideoFrame dst_frame; |
300 // Making sure that destination frame is of sufficient size. | 300 // Making sure that destination frame is of sufficient size. |
301 // Aligning stride values based on width. | 301 // Aligning stride values based on width. |
302 dst_frame.CreateEmptyFrame(dst_width, dst_height, dst_width, | 302 dst_frame.CreateEmptyFrame(dst_width, dst_height, dst_width, |
303 (dst_width + 1) / 2, (dst_width + 1) / 2); | 303 (dst_width + 1) / 2, (dst_width + 1) / 2); |
304 libyuv::I420Scale(input_image.video_frame_buffer()->DataY(), | 304 libyuv::I420Scale( |
305 input_image.video_frame_buffer()->StrideY(), | 305 input_image.buffer(kYPlane), input_image.stride(kYPlane), |
306 input_image.video_frame_buffer()->DataU(), | 306 input_image.buffer(kUPlane), input_image.stride(kUPlane), |
307 input_image.video_frame_buffer()->StrideU(), | 307 input_image.buffer(kVPlane), input_image.stride(kVPlane), src_width, |
308 input_image.video_frame_buffer()->DataV(), | 308 src_height, dst_frame.buffer(kYPlane), dst_frame.stride(kYPlane), |
309 input_image.video_frame_buffer()->StrideV(), | 309 dst_frame.buffer(kUPlane), dst_frame.stride(kUPlane), |
310 src_width, src_height, | 310 dst_frame.buffer(kVPlane), dst_frame.stride(kVPlane), dst_width, |
311 dst_frame.video_frame_buffer()->MutableDataY(), | 311 dst_height, libyuv::kFilterBilinear); |
312 dst_frame.video_frame_buffer()->StrideY(), | |
313 dst_frame.video_frame_buffer()->MutableDataU(), | |
314 dst_frame.video_frame_buffer()->StrideU(), | |
315 dst_frame.video_frame_buffer()->MutableDataV(), | |
316 dst_frame.video_frame_buffer()->StrideV(), | |
317 dst_width, dst_height, | |
318 libyuv::kFilterBilinear); | |
319 dst_frame.set_timestamp(input_image.timestamp()); | 312 dst_frame.set_timestamp(input_image.timestamp()); |
320 dst_frame.set_render_time_ms(input_image.render_time_ms()); | 313 dst_frame.set_render_time_ms(input_image.render_time_ms()); |
321 streaminfos_[stream_idx].encoder->Encode(dst_frame, codec_specific_info, | 314 streaminfos_[stream_idx].encoder->Encode(dst_frame, codec_specific_info, |
322 &stream_frame_types); | 315 &stream_frame_types); |
323 } | 316 } |
324 } | 317 } |
325 | 318 |
326 return WEBRTC_VIDEO_CODEC_OK; | 319 return WEBRTC_VIDEO_CODEC_OK; |
327 } | 320 } |
328 | 321 |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 if (streaminfos_.size() != 1) | 501 if (streaminfos_.size() != 1) |
509 return false; | 502 return false; |
510 return streaminfos_[0].encoder->SupportsNativeHandle(); | 503 return streaminfos_[0].encoder->SupportsNativeHandle(); |
511 } | 504 } |
512 | 505 |
513 const char* SimulcastEncoderAdapter::ImplementationName() const { | 506 const char* SimulcastEncoderAdapter::ImplementationName() const { |
514 return implementation_name_.c_str(); | 507 return implementation_name_.c_str(); |
515 } | 508 } |
516 | 509 |
517 } // namespace webrtc | 510 } // namespace webrtc |
OLD | NEW |