Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(365)

Unified Diff: remoting/host/video_scheduler.h

Issue 872433005: Move capture scheduling logic from VideoScheduler to CaptureScheduler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: remoting/host/video_scheduler.h
diff --git a/remoting/host/video_scheduler.h b/remoting/host/video_scheduler.h
index 3bcf27723f9d64f08ad97ba9d9c08e3c784dfbe0..c30ffa25310c1b1062a758d531c35102d4b70623 100644
--- a/remoting/host/video_scheduler.h
+++ b/remoting/host/video_scheduler.h
@@ -13,7 +13,6 @@
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "remoting/codec/video_encoder.h"
-#include "remoting/host/capture_scheduler.h"
#include "remoting/proto/video.pb.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h"
#include "third_party/webrtc/modules/desktop_capture/mouse_cursor_monitor.h"
@@ -28,6 +27,7 @@ class DesktopCapturer;
namespace remoting {
+class CaptureScheduler;
class CursorShapeInfo;
namespace protocol {
@@ -94,15 +94,6 @@ class VideoScheduler : public base::RefCountedThreadSafe<VideoScheduler>,
protocol::CursorShapeStub* cursor_stub,
protocol::VideoStub* video_stub);
- // webrtc::DesktopCapturer::Callback implementation.
- webrtc::SharedMemory* CreateSharedMemory(size_t size) override;
- void OnCaptureCompleted(webrtc::DesktopFrame* frame) override;
-
- // webrtc::MouseCursorMonitor::Callback implementation.
- void OnMouseCursor(webrtc::MouseCursor* mouse_cursor) override;
- void OnMouseCursorPosition(webrtc::MouseCursorMonitor::CursorState state,
- const webrtc::DesktopVector& position) override;
-
// Starts scheduling frame captures.
void Start();
@@ -129,20 +120,29 @@ class VideoScheduler : public base::RefCountedThreadSafe<VideoScheduler>,
// Capturer thread ----------------------------------------------------------
+ // webrtc::DesktopCapturer::Callback implementation.
+ webrtc::SharedMemory* CreateSharedMemory(size_t size) override;
+ void OnCaptureCompleted(webrtc::DesktopFrame* frame) override;
+
+ // webrtc::MouseCursorMonitor::Callback implementation.
+ void OnMouseCursor(webrtc::MouseCursor* mouse_cursor) override;
+ void OnMouseCursorPosition(webrtc::MouseCursorMonitor::CursorState state,
+ const webrtc::DesktopVector& position) override;
+
// Starts the capturer on the capture thread.
void StartOnCaptureThread();
// Stops scheduling frame captures on the capture thread.
void StopOnCaptureThread();
- // Schedules the next call to CaptureNextFrame.
- void ScheduleNextCapture();
-
// Starts the next frame capture, unless there are already too many pending.
void CaptureNextFrame();
- // Called when a frame capture has been encoded & sent to the client.
- void FrameCaptureCompleted();
+ // Called when a frame has been encoded.
+ void ProcessFrameEncodedOnCaptureThread(base::TimeDelta encode_time);
+
+ // Called when a frame has been sent to the client.
+ void ProcessFrameSentOnCaptureThread();
// Network thread -----------------------------------------------------------
@@ -191,32 +191,14 @@ class VideoScheduler : public base::RefCountedThreadSafe<VideoScheduler>,
protocol::CursorShapeStub* cursor_stub_;
protocol::VideoStub* video_stub_;
- // Timer used to schedule CaptureNextFrame().
- scoped_ptr<base::OneShotTimer<VideoScheduler> > capture_timer_;
-
// Timer used to ensure that we send empty keep-alive frames to the client
// even when the video stream is paused or encoder is busy.
scoped_ptr<base::DelayTimer<VideoScheduler> > keep_alive_timer_;
- // 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_;
-
- // True if capture of video frames is paused.
- bool is_paused_;
-
// Number updated by the caller to trace performance.
int64 latest_event_timestamp_;
- // An object to schedule capturing.
- CaptureScheduler scheduler_;
+ scoped_ptr<CaptureScheduler> capture_scheduler_;
DISALLOW_COPY_AND_ASSIGN(VideoScheduler);
};

Powered by Google App Engine
This is Rietveld 408576698