summaryrefslogtreecommitdiff
path: root/video_engine/vie_capturer.cc
diff options
context:
space:
mode:
authorpbos@webrtc.org <pbos@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d>2013-11-22 13:10:13 +0000
committerpbos@webrtc.org <pbos@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d>2013-11-22 13:10:13 +0000
commit50293f5d7d3084d1d1389ccda3970cf8e6d4dc9f (patch)
tree933b9e6a0eeb3aa906760548b4665aec07ee7cba /video_engine/vie_capturer.cc
parent84d69d428c28904ffff4106b714356ef9f979c04 (diff)
downloadwebrtc-50293f5d7d3084d1d1389ccda3970cf8e6d4dc9f.tar.gz
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
Diffstat (limited to 'video_engine/vie_capturer.cc')
-rw-r--r--video_engine/vie_capturer.cc36
1 files changed, 25 insertions, 11 deletions
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,