From b9ed58f046141b4610c1bdc966d962d5fb95ac6b Mon Sep 17 00:00:00 2001 From: "sergeyu@chromium.org" Date: Thu, 16 May 2013 10:45:24 +0000 Subject: Use webrtc::DesktopCapturer for screen capturer implementation. Screen capturers are being moved from media/video/capture/screen to third_party/webrtc. This CL is an intermediate step in that process. Depends on https://webrtc-codereview.appspot.com/1322007/ TBR=brettw@chromium.org (third_party/webrtc dependency) Review URL: https://chromiumcodereview.appspot.com/13983010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@200504 0039d316-1c4b-4281-b951-d872f2087c98 --- remoting/host/video_scheduler.h | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'remoting/host/video_scheduler.h') diff --git a/remoting/host/video_scheduler.h b/remoting/host/video_scheduler.h index d26c394..16f6247 100644 --- a/remoting/host/video_scheduler.h +++ b/remoting/host/video_scheduler.h @@ -23,7 +23,6 @@ class SingleThreadTaskRunner; } // namespace base namespace media { -class ScreenCaptureData; class ScreenCapturer; } // namespace media @@ -74,7 +73,8 @@ class VideoStub; // too much CPU, or hogging the host's graphics subsystem. class VideoScheduler : public base::RefCountedThreadSafe, - public media::ScreenCapturer::Delegate { + public webrtc::DesktopCapturer::Callback, + public media::ScreenCapturer::MouseShapeObserver { public: // Creates a VideoScheduler running capture, encode and network tasks on the // supplied TaskRunners. Video and cursor shape updates will be pumped to @@ -89,9 +89,11 @@ class VideoScheduler : public base::RefCountedThreadSafe, protocol::CursorShapeStub* cursor_stub, protocol::VideoStub* video_stub); - // media::ScreenCapturer::Delegate implementation. - virtual void OnCaptureCompleted( - scoped_refptr capture_data) OVERRIDE; + // webrtc::DesktopCapturer::Callback implementation. + virtual webrtc::SharedMemory* CreateSharedMemory(size_t size) OVERRIDE; + virtual void OnCaptureCompleted(webrtc::DesktopFrame* frame) OVERRIDE; + + // media::ScreenCapturer::MouseShapeObserver implementation. virtual void OnCursorShapeChanged( scoped_ptr cursor_shape) OVERRIDE; @@ -119,8 +121,7 @@ class VideoScheduler : public base::RefCountedThreadSafe, // Starts the capturer on the capture thread. void StartOnCaptureThread(); - // Stops scheduling frame captures on the capture thread, and posts - // StopOnEncodeThread() to the network thread when done. + // Stops scheduling frame captures on the capture thread. void StopOnCaptureThread(); // Schedules the next call to CaptureNextFrame. @@ -147,13 +148,11 @@ class VideoScheduler : public base::RefCountedThreadSafe, // Encoder thread ----------------------------------------------------------- // Encode a frame, passing generated VideoPackets to SendVideoPacket(). - void EncodeFrame(scoped_refptr capture_data); - - void EncodedDataAvailableCallback(scoped_ptr packet); + void EncodeFrame(scoped_ptr frame, + int sequence_number); - // Used to synchronize capture and encode thread teardown, notifying the - // network thread when done. - void StopOnEncodeThread(scoped_ptr capturer); + void EncodedDataAvailableCallback(int sequence_number, + scoped_ptr packet); // Task runners used by this class. scoped_refptr capture_task_runner_; @@ -174,8 +173,13 @@ class VideoScheduler : public base::RefCountedThreadSafe, // Timer used to schedule CaptureNextFrame(). scoped_ptr > capture_timer_; - // Count the number of recordings (i.e. capture or encode) happening. - int pending_captures_; + // The number of frames being processed, i.e. frames that we are currently + // capturing, encoding or sending. The value is capped at 2 to minimize + // latency. + int pending_frames_; + + // Set when the capturer is capturing a frame. + bool capture_pending_; // True if the previous scheduled capture was skipped. bool did_skip_frame_; -- cgit v1.1