Index: media/capture/media_video_capture_device_core.h |
diff --git a/content/browser/media/capture/content_video_capture_device_core.h b/media/capture/media_video_capture_device_core.h |
similarity index 69% |
rename from content/browser/media/capture/content_video_capture_device_core.h |
rename to media/capture/media_video_capture_device_core.h |
index 50600cf42998aa12225be2c7df78e2a907e03193..58c8d832327706be1f6247cc31c6c094cd37d82a 100644 |
--- a/content/browser/media/capture/content_video_capture_device_core.h |
+++ b/media/capture/media_video_capture_device_core.h |
@@ -2,8 +2,8 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef CONTENT_BROWSER_MEDIA_CAPTURE_CONTENT_VIDEO_CAPTURE_DEVICE_CORE_H_ |
-#define CONTENT_BROWSER_MEDIA_CAPTURE_CONTENT_VIDEO_CAPTURE_DEVICE_CORE_H_ |
+#ifndef MEDIA_CAPTURE_MEDIA_VIDEO_CAPTURE_DEVICE_CORE_H_ |
+#define MEDIA_CAPTURE_MEDIA_VIDEO_CAPTURE_DEVICE_CORE_H_ |
#include <string> |
@@ -11,18 +11,16 @@ |
#include "base/memory/weak_ptr.h" |
#include "base/threading/thread.h" |
#include "base/threading/thread_checker.h" |
-#include "content/browser/media/capture/capture_resolution_chooser.h" |
-#include "content/browser/media/capture/video_capture_oracle.h" |
-#include "content/common/content_export.h" |
+#include "media/base/media_export.h" |
#include "media/base/video_frame.h" |
+#include "media/capture/capture_resolution_chooser.h" |
+#include "media/capture/video_capture_oracle.h" |
#include "media/video/capture/video_capture_device.h" |
namespace media { |
+ |
class VideoCaptureParams; |
class VideoFrame; |
-} // namespace media |
- |
-namespace content { |
class VideoCaptureMachine; |
@@ -33,21 +31,21 @@ class VideoCaptureMachine; |
class ThreadSafeCaptureOracle |
: public base::RefCountedThreadSafe<ThreadSafeCaptureOracle> { |
public: |
- ThreadSafeCaptureOracle(scoped_ptr<media::VideoCaptureDevice::Client> client, |
- const media::VideoCaptureParams& params); |
+ ThreadSafeCaptureOracle(scoped_ptr<VideoCaptureDevice::Client> client, |
+ const VideoCaptureParams& params); |
// Called when a captured frame is available or an error has occurred. |
// If |success| is true then |frame| is valid and |timestamp| indicates when |
// the frame was painted. |
// If |success| is false, all other parameters are invalid. |
- typedef base::Callback<void(const scoped_refptr<media::VideoFrame>& frame, |
+ typedef base::Callback<void(const scoped_refptr<VideoFrame>& frame, |
base::TimeTicks timestamp, |
bool success)> CaptureFrameCallback; |
bool ObserveEventAndDecideCapture(VideoCaptureOracle::Event event, |
const gfx::Rect& damage_rect, |
base::TimeTicks event_time, |
- scoped_refptr<media::VideoFrame>* storage, |
+ scoped_refptr<VideoFrame>* storage, |
CaptureFrameCallback* callback); |
base::TimeDelta min_capture_period() const { |
@@ -78,10 +76,10 @@ class ThreadSafeCaptureOracle |
// Callback invoked on completion of all captures. |
void DidCaptureFrame( |
int frame_number, |
- scoped_ptr<media::VideoCaptureDevice::Client::Buffer> buffer, |
+ scoped_ptr<VideoCaptureDevice::Client::Buffer> buffer, |
base::TimeTicks capture_begin_time, |
base::TimeDelta estimated_frame_duration, |
- const scoped_refptr<media::VideoFrame>& frame, |
+ const scoped_refptr<VideoFrame>& frame, |
base::TimeTicks timestamp, |
bool success); |
@@ -89,13 +87,13 @@ class ThreadSafeCaptureOracle |
mutable base::Lock lock_; |
// Recipient of our capture activity. |
- scoped_ptr<media::VideoCaptureDevice::Client> client_; |
+ scoped_ptr<VideoCaptureDevice::Client> client_; |
// Makes the decision to capture a frame. |
VideoCaptureOracle oracle_; |
// The video capture parameters used to construct the oracle proxy. |
- const media::VideoCaptureParams params_; |
+ const VideoCaptureParams params_; |
// Determines video capture frame sizes. |
CaptureResolutionChooser resolution_chooser_; |
@@ -108,12 +106,13 @@ class VideoCaptureMachine { |
VideoCaptureMachine() {} |
virtual ~VideoCaptureMachine() {} |
- // Starts capturing. Returns true if succeeded. |
- // Must be run on the UI BrowserThread. |
- virtual bool Start(const scoped_refptr<ThreadSafeCaptureOracle>& oracle_proxy, |
- const media::VideoCaptureParams& params) = 0; |
+ // Starts capturing. |
+ // |callback| is invoked with true if succeeded. Otherwise, with false. |
+ virtual void Start(const scoped_refptr<ThreadSafeCaptureOracle>& oracle_proxy, |
+ const VideoCaptureParams& params, |
+ const base::Callback<void(bool)> callback) = 0; |
- // Stops capturing. Must be run on the UI BrowserThread. |
+ // Stops capturing. |
// |callback| is invoked after the capturing has stopped. |
virtual void Stop(const base::Closure& callback) = 0; |
@@ -127,20 +126,20 @@ class VideoCaptureMachine { |
// DesktopCaptureDeviceAura allows safe destruction without needing to block any |
// threads, as well as code sharing. |
// |
-// ContentVideoCaptureDeviceCore manages a simple state machine and the pipeline |
+// MediaVideoCaptureDeviceCore manages a simple state machine and the pipeline |
// (see notes at top of this file). It times the start of successive captures |
// and facilitates the processing of each through the stages of the |
// pipeline. |
-class CONTENT_EXPORT ContentVideoCaptureDeviceCore |
- : public base::SupportsWeakPtr<ContentVideoCaptureDeviceCore> { |
+class MEDIA_EXPORT MediaVideoCaptureDeviceCore |
miu
2015/06/05 01:13:37
naming: Could you name this class ScreenCaptureDev
jiajia.qin
2015/06/05 02:31:34
Hi, miu. I am considering that maybe VideoCaptureD
jiajia.qin
2015/06/08 04:58:24
Done.
|
+ : public base::SupportsWeakPtr<MediaVideoCaptureDeviceCore> { |
public: |
- ContentVideoCaptureDeviceCore( |
+ MediaVideoCaptureDeviceCore( |
scoped_ptr<VideoCaptureMachine> capture_machine); |
- virtual ~ContentVideoCaptureDeviceCore(); |
+ virtual ~MediaVideoCaptureDeviceCore(); |
- // Asynchronous requests to change ContentVideoCaptureDeviceCore state. |
- void AllocateAndStart(const media::VideoCaptureParams& params, |
- scoped_ptr<media::VideoCaptureDevice::Client> client); |
+ // Asynchronous requests to change MediaVideoCaptureDeviceCore state. |
+ void AllocateAndStart(const VideoCaptureParams& params, |
+ scoped_ptr<VideoCaptureDevice::Client> client); |
void StopAndDeAllocate(); |
private: |
@@ -166,9 +165,9 @@ class CONTENT_EXPORT ContentVideoCaptureDeviceCore |
// Current lifecycle state. |
State state_; |
- // Tracks the CaptureMachine that's doing work on our behalf on the UI thread. |
- // This value should never be dereferenced by this class, other than to |
- // create and destroy it on the UI thread. |
+ // Tracks the CaptureMachine that's doing work on our behalf |
+ // on the device thread or UI thread. |
+ // This value should never be dereferenced by this class. |
scoped_ptr<VideoCaptureMachine> capture_machine_; |
// Our thread-safe capture oracle which serves as the gateway to the video |
@@ -176,10 +175,10 @@ class CONTENT_EXPORT ContentVideoCaptureDeviceCore |
// component of the system with direct access to |client_|. |
scoped_refptr<ThreadSafeCaptureOracle> oracle_proxy_; |
- DISALLOW_COPY_AND_ASSIGN(ContentVideoCaptureDeviceCore); |
+ DISALLOW_COPY_AND_ASSIGN(MediaVideoCaptureDeviceCore); |
}; |
-} // namespace content |
+} // namespace media |
-#endif // CONTENT_BROWSER_MEDIA_CAPTURE_CONTENT_VIDEO_CAPTURE_DEVICE_CORE_H_ |
+#endif // MEDIA_CAPTURE_MEDIA_VIDEO_CAPTURE_DEVICE_CORE_H_ |