From 50293f5d7d3084d1d1389ccda3970cf8e6d4dc9f Mon Sep 17 00:00:00 2001 From: "pbos@webrtc.org" Date: Fri, 22 Nov 2013 13:10:13 +0000 Subject: Replace VideoFrameI420 with I420VideoFrame. Gives one less struct/class for I420 video frames. BUG=2657 R=mflodman@webrtc.org, wu@webrtc.org Review URL: https://webrtc-codereview.appspot.com/4149004 git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@5160 4adac7df-926f-26a2-2b94-8c16560cd09d --- video_engine/vie_capturer.cc | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) (limited to 'video_engine/vie_capturer.cc') diff --git a/video_engine/vie_capturer.cc b/video_engine/vie_capturer.cc index 3f4f1d95..b8de7cd2 100644 --- a/video_engine/vie_capturer.cc +++ b/video_engine/vie_capturer.cc @@ -327,17 +327,31 @@ int ViECapturer::IncomingFrameI420(const ViEVideoFrameI420& video_frame, return -1; } - VideoFrameI420 frame; - frame.width = video_frame.width; - frame.height = video_frame.height; - frame.y_plane = video_frame.y_plane; - frame.u_plane = video_frame.u_plane; - frame.v_plane = video_frame.v_plane; - frame.y_pitch = video_frame.y_pitch; - frame.u_pitch = video_frame.u_pitch; - frame.v_pitch = video_frame.v_pitch; - - return external_capture_module_->IncomingFrameI420(frame, capture_time); + int size_y = video_frame.height * video_frame.y_pitch; + int size_u = video_frame.u_pitch * ((video_frame.height + 1) / 2); + int size_v = video_frame.v_pitch * ((video_frame.height + 1) / 2); + int ret = capture_frame_.CreateFrame(size_y, + video_frame.y_plane, + size_u, + video_frame.u_plane, + size_v, + video_frame.v_plane, + video_frame.width, + video_frame.height, + video_frame.y_pitch, + video_frame.u_pitch, + video_frame.v_pitch); + + if (ret < 0) { + WEBRTC_TRACE(kTraceError, + kTraceVideo, + ViEId(engine_id_, capture_id_), + "Failed to create I420VideoFrame"); + return -1; + } + + return external_capture_module_->IncomingI420VideoFrame(&capture_frame_, + capture_time); } void ViECapturer::OnIncomingCapturedFrame(const int32_t capture_id, -- cgit v1.2.3