Index: content/browser/media/capture/aura_window_capture_machine.cc |
diff --git a/content/browser/media/capture/aura_window_capture_machine.cc b/content/browser/media/capture/aura_window_capture_machine.cc |
index b17f31d68f170aab5a2a5e85264ef181f22886a9..e518896ba4125e16b2c883920931b591a2b31cf5 100644 |
--- a/content/browser/media/capture/aura_window_capture_machine.cc |
+++ b/content/browser/media/capture/aura_window_capture_machine.cc |
@@ -10,13 +10,13 @@ |
#include "cc/output/copy_output_request.h" |
#include "cc/output/copy_output_result.h" |
#include "content/browser/compositor/image_transport_factory.h" |
-#include "content/browser/media/capture/content_video_capture_device_core.h" |
#include "content/browser/media/capture/desktop_capture_device_uma_types.h" |
#include "content/common/gpu/client/gl_helper.h" |
#include "content/public/browser/browser_thread.h" |
#include "content/public/browser/power_save_blocker.h" |
#include "media/base/video_capture_types.h" |
#include "media/base/video_util.h" |
+#include "media/capture/media_video_capture_device_core.h" |
#include "skia/ext/image_operations.h" |
#include "third_party/skia/include/core/SkBitmap.h" |
#include "ui/aura/client/screen_position_client.h" |
@@ -91,7 +91,7 @@ void RenderCursorOnVideoFrame( |
void CopyOutputFinishedForVideo( |
base::TimeTicks start_time, |
- const ThreadSafeCaptureOracle::CaptureFrameCallback& capture_frame_cb, |
+ const CaptureFrameCallback& capture_frame_cb, |
const scoped_refptr<media::VideoFrame>& target, |
const SkBitmap& cursor_bitmap, |
const gfx::Point& cursor_position, |
@@ -117,8 +117,23 @@ AuraWindowCaptureMachine::AuraWindowCaptureMachine() |
AuraWindowCaptureMachine::~AuraWindowCaptureMachine() {} |
-bool AuraWindowCaptureMachine::Start( |
- const scoped_refptr<ThreadSafeCaptureOracle>& oracle_proxy, |
+void AuraWindowCaptureMachine::Start( |
+ const scoped_refptr<media::ThreadSafeCaptureOracle>& oracle_proxy, |
+ const media::VideoCaptureParams& params, |
+ const base::Callback<void(bool)> callback) { |
+ // Starts the capture machine asynchronously. |
+ BrowserThread::PostTaskAndReplyWithResult( |
+ BrowserThread::UI, |
+ FROM_HERE, |
+ base::Bind(&AuraWindowCaptureMachine::InternalStart, |
+ base::Unretained(this), |
+ oracle_proxy, |
+ params), |
+ callback); |
+} |
+ |
+bool AuraWindowCaptureMachine::InternalStart( |
+ const scoped_refptr<media::ThreadSafeCaptureOracle>& oracle_proxy, |
const media::VideoCaptureParams& params) { |
DCHECK_CURRENTLY_ON(BrowserThread::UI); |
@@ -160,6 +175,15 @@ bool AuraWindowCaptureMachine::Start( |
} |
void AuraWindowCaptureMachine::Stop(const base::Closure& callback) { |
+ // Stops the capture machine asynchronously. |
+ BrowserThread::PostTask( |
+ BrowserThread::UI, FROM_HERE, base::Bind( |
+ &AuraWindowCaptureMachine::InternalStop, |
+ base::Unretained(this), |
+ callback)); |
+} |
+ |
+void AuraWindowCaptureMachine::InternalStop(const base::Closure& callback) { |
DCHECK_CURRENTLY_ON(BrowserThread::UI); |
power_save_blocker_.reset(); |
@@ -213,7 +237,7 @@ void AuraWindowCaptureMachine::Capture(bool dirty) { |
return; |
scoped_refptr<media::VideoFrame> frame; |
- ThreadSafeCaptureOracle::CaptureFrameCallback capture_frame_cb; |
+ media::ThreadSafeCaptureOracle::CaptureFrameCallback capture_frame_cb; |
// TODO(miu): Need to fix this so the compositor is providing the presentation |
// timestamps and damage regions, to leverage the frame timestamp rewriting |
@@ -238,7 +262,7 @@ void AuraWindowCaptureMachine::Capture(bool dirty) { |
void AuraWindowCaptureMachine::DidCopyOutput( |
scoped_refptr<media::VideoFrame> video_frame, |
base::TimeTicks start_time, |
- const ThreadSafeCaptureOracle::CaptureFrameCallback& capture_frame_cb, |
+ const CaptureFrameCallback& capture_frame_cb, |
scoped_ptr<cc::CopyOutputResult> result) { |
static bool first_call = true; |
@@ -271,7 +295,7 @@ void AuraWindowCaptureMachine::DidCopyOutput( |
bool AuraWindowCaptureMachine::ProcessCopyOutputResponse( |
scoped_refptr<media::VideoFrame> video_frame, |
base::TimeTicks start_time, |
- const ThreadSafeCaptureOracle::CaptureFrameCallback& capture_frame_cb, |
+ const CaptureFrameCallback& capture_frame_cb, |
scoped_ptr<cc::CopyOutputResult> result) { |
DCHECK_CURRENTLY_ON(BrowserThread::UI); |