diff --git a/webrtc/video_engine/include/vie_capture.h b/webrtc/video_engine/include/vie_capture.h index bcae930bf4..2174d5dc6f 100644 --- a/webrtc/video_engine/include/vie_capture.h +++ b/webrtc/video_engine/include/vie_capture.h @@ -114,7 +114,6 @@ class WEBRTC_DLLEXPORT ViEExternalCapture { // This method is specifically for delivering a new captured I420 frame to // VideoEngine. // |capture_time| must be specified in the NTP time format in milliseconds. - // This method uses an internal buffer and must be called sequentially. virtual int IncomingFrameI420( const ViEVideoFrameI420& video_frame, unsigned long long capture_time = 0) = 0; diff --git a/webrtc/video_engine/vie_capturer.cc b/webrtc/video_engine/vie_capturer.cc index c5844e2293..d7e33e77db 100644 --- a/webrtc/video_engine/vie_capturer.cc +++ b/webrtc/video_engine/vie_capturer.cc @@ -43,6 +43,7 @@ ViECapturer::ViECapturer(int capture_id, external_capture_module_(NULL), module_process_thread_(module_process_thread), capture_id_(capture_id), + incoming_frame_cs_(CriticalSectionWrapper::CreateCriticalSection()), capture_thread_(*ThreadWrapper::CreateThread(ViECaptureThreadFunction, this, kHighPriority, "ViECaptureThread")), @@ -332,7 +333,8 @@ int ViECapturer::IncomingFrameI420(const ViEVideoFrameI420& video_frame, 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, + CriticalSectionScoped cs(incoming_frame_cs_.get()); + int ret = incoming_frame_.CreateFrame(size_y, video_frame.y_plane, size_u, video_frame.u_plane, @@ -352,7 +354,7 @@ int ViECapturer::IncomingFrameI420(const ViEVideoFrameI420& video_frame, return -1; } - return external_capture_module_->IncomingI420VideoFrame(&capture_frame_, + return external_capture_module_->IncomingI420VideoFrame(&incoming_frame_, capture_time); } diff --git a/webrtc/video_engine/vie_capturer.h b/webrtc/video_engine/vie_capturer.h index 7900e55cf7..e47700f82f 100644 --- a/webrtc/video_engine/vie_capturer.h +++ b/webrtc/video_engine/vie_capturer.h @@ -157,6 +157,10 @@ class ViECapturer ProcessThread& module_process_thread_; const int capture_id_; + // Frame used in IncomingFrameI420. + scoped_ptr incoming_frame_cs_; + I420VideoFrame incoming_frame_; + // Capture thread. ThreadWrapper& capture_thread_; EventWrapper& capture_event_; @@ -181,8 +185,6 @@ class ViECapturer CaptureCapability requested_capability_; - I420VideoFrame capture_frame_; - scoped_ptr overuse_detector_; };