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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 // affects webrtc:5683. | 298 // affects webrtc:5683. |
299 if ((dst_width == src_width && dst_height == src_height) || | 299 if ((dst_width == src_width && dst_height == src_height) || |
300 input_image.IsZeroSize() || | 300 input_image.IsZeroSize() || |
301 input_image.video_frame_buffer()->native_handle()) { | 301 input_image.video_frame_buffer()->native_handle()) { |
302 int ret = streaminfos_[stream_idx].encoder->Encode( | 302 int ret = streaminfos_[stream_idx].encoder->Encode( |
303 input_image, codec_specific_info, &stream_frame_types); | 303 input_image, codec_specific_info, &stream_frame_types); |
304 if (ret != WEBRTC_VIDEO_CODEC_OK) { | 304 if (ret != WEBRTC_VIDEO_CODEC_OK) { |
305 return ret; | 305 return ret; |
306 } | 306 } |
307 } else { | 307 } else { |
308 VideoFrame dst_frame; | |
309 // Making sure that destination frame is of sufficient size. | |
310 // Aligning stride values based on width. | 308 // Aligning stride values based on width. |
311 dst_frame.CreateEmptyFrame(dst_width, dst_height, dst_width, | 309 rtc::scoped_refptr<I420Buffer> dst_buffer = |
312 (dst_width + 1) / 2, (dst_width + 1) / 2); | 310 I420Buffer::Create(dst_width, dst_height, dst_width, |
| 311 (dst_width + 1) / 2, (dst_width + 1) / 2); |
313 libyuv::I420Scale(input_image.video_frame_buffer()->DataY(), | 312 libyuv::I420Scale(input_image.video_frame_buffer()->DataY(), |
314 input_image.video_frame_buffer()->StrideY(), | 313 input_image.video_frame_buffer()->StrideY(), |
315 input_image.video_frame_buffer()->DataU(), | 314 input_image.video_frame_buffer()->DataU(), |
316 input_image.video_frame_buffer()->StrideU(), | 315 input_image.video_frame_buffer()->StrideU(), |
317 input_image.video_frame_buffer()->DataV(), | 316 input_image.video_frame_buffer()->DataV(), |
318 input_image.video_frame_buffer()->StrideV(), | 317 input_image.video_frame_buffer()->StrideV(), |
319 src_width, src_height, | 318 src_width, src_height, |
320 dst_frame.video_frame_buffer()->MutableDataY(), | 319 dst_buffer->MutableDataY(), dst_buffer->StrideY(), |
321 dst_frame.video_frame_buffer()->StrideY(), | 320 dst_buffer->MutableDataU(), dst_buffer->StrideU(), |
322 dst_frame.video_frame_buffer()->MutableDataU(), | 321 dst_buffer->MutableDataV(), dst_buffer->StrideV(), |
323 dst_frame.video_frame_buffer()->StrideU(), | |
324 dst_frame.video_frame_buffer()->MutableDataV(), | |
325 dst_frame.video_frame_buffer()->StrideV(), | |
326 dst_width, dst_height, | 322 dst_width, dst_height, |
327 libyuv::kFilterBilinear); | 323 libyuv::kFilterBilinear); |
328 dst_frame.set_timestamp(input_image.timestamp()); | 324 |
329 dst_frame.set_render_time_ms(input_image.render_time_ms()); | |
330 int ret = streaminfos_[stream_idx].encoder->Encode( | 325 int ret = streaminfos_[stream_idx].encoder->Encode( |
331 dst_frame, codec_specific_info, &stream_frame_types); | 326 VideoFrame(dst_buffer, input_image.timestamp(), |
| 327 input_image.render_time_ms(), webrtc::kVideoRotation_0), |
| 328 codec_specific_info, &stream_frame_types); |
332 if (ret != WEBRTC_VIDEO_CODEC_OK) { | 329 if (ret != WEBRTC_VIDEO_CODEC_OK) { |
333 return ret; | 330 return ret; |
334 } | 331 } |
335 } | 332 } |
336 } | 333 } |
337 | 334 |
338 return WEBRTC_VIDEO_CODEC_OK; | 335 return WEBRTC_VIDEO_CODEC_OK; |
339 } | 336 } |
340 | 337 |
341 int SimulcastEncoderAdapter::RegisterEncodeCompleteCallback( | 338 int SimulcastEncoderAdapter::RegisterEncodeCompleteCallback( |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 return false; | 518 return false; |
522 } | 519 } |
523 return true; | 520 return true; |
524 } | 521 } |
525 | 522 |
526 const char* SimulcastEncoderAdapter::ImplementationName() const { | 523 const char* SimulcastEncoderAdapter::ImplementationName() const { |
527 return implementation_name_.c_str(); | 524 return implementation_name_.c_str(); |
528 } | 525 } |
529 | 526 |
530 } // namespace webrtc | 527 } // namespace webrtc |
OLD | NEW |