Chromium Code Reviews| Index: content/renderer/media/gpu/rtc_video_encoder.cc |
| diff --git a/content/renderer/media/gpu/rtc_video_encoder.cc b/content/renderer/media/gpu/rtc_video_encoder.cc |
| index 7ec22b2f3d0a9996ed3ea0f422d9432e8c303567..17d9b39134b24f9fa8b494f07d9ae885e5cb8177 100644 |
| --- a/content/renderer/media/gpu/rtc_video_encoder.cc |
| +++ b/content/renderer/media/gpu/rtc_video_encoder.cc |
| @@ -585,22 +585,26 @@ void RTCVideoEncoder::Impl::EncodeOneFrame() { |
| media::VideoEncodeAccelerator::kPlatformFailureError); |
| return; |
| } |
| - // Do a strided copy of the input frame to match the input requirements for |
| - // the encoder. |
| - // TODO(sheu): support zero-copy from WebRTC. http://crbug.com/269312 |
| - if (libyuv::I420Copy(next_frame->video_frame_buffer()->DataY(), |
| - next_frame->video_frame_buffer()->StrideY(), |
| - next_frame->video_frame_buffer()->DataU(), |
| - next_frame->video_frame_buffer()->StrideU(), |
| - next_frame->video_frame_buffer()->DataV(), |
| - next_frame->video_frame_buffer()->StrideV(), |
| - frame->data(media::VideoFrame::kYPlane), |
| - frame->stride(media::VideoFrame::kYPlane), |
| - frame->data(media::VideoFrame::kUPlane), |
| - frame->stride(media::VideoFrame::kUPlane), |
| - frame->data(media::VideoFrame::kVPlane), |
| - frame->stride(media::VideoFrame::kVPlane), |
| - next_frame->width(), next_frame->height())) { |
| + |
| + // Do a strided copy and scale (if necessary) the input frame to match |
| + // the input requirements for the encoder. |
| + // TODO(sheu): support zero-copy from WebRTC. http://crbug.com/269312 |
| + if (libyuv::I420Scale(next_frame->video_frame_buffer()->DataY(), |
| + next_frame->video_frame_buffer()->StrideY(), |
| + next_frame->video_frame_buffer()->DataU(), |
| + next_frame->video_frame_buffer()->StrideU(), |
| + next_frame->video_frame_buffer()->DataV(), |
| + next_frame->video_frame_buffer()->StrideV(), |
| + next_frame->width(), next_frame->height(), |
| + frame->visible_data(media::VideoFrame::kYPlane), |
| + frame->stride(media::VideoFrame::kYPlane), |
| + frame->visible_data(media::VideoFrame::kUPlane), |
| + frame->stride(media::VideoFrame::kUPlane), |
| + frame->visible_data(media::VideoFrame::kVPlane), |
| + frame->stride(media::VideoFrame::kVPlane), |
| + frame->visible_rect().width(), |
| + frame->visible_rect().height(), |
| + libyuv::kFilterBilinear)) { |
|
Pawel Osciak
2016/07/28 01:48:08
Do we have an idea of the performance impact of bi
tommi (sloooow) - chröme
2016/07/28 07:40:40
+1
magjed_chromium
2016/07/28 10:27:19
I think we should use libyuv::kFilterBox instead o
emircan
2016/07/28 19:35:45
SimulcastEncoderAdapter uses libyuv::kFilterBiline
emircan
2016/07/28 19:35:45
Thanks for the metrics. Would you recommend changi
magjed_chromium
2016/07/30 08:30:17
I think it's ok to use kFilterBilinear for now. Yo
|
| LogAndNotifyError(FROM_HERE, "Failed to copy buffer", |
| media::VideoEncodeAccelerator::kPlatformFailureError); |
| return; |