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

Unified Diff: remoting/host/video_scheduler.h

Issue 893353002: Rename VideoScheduler->VideoFramePipe. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scheduler_cleanup
Patch Set: Created 5 years, 10 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
« no previous file with comments | « remoting/host/video_frame_pump_unittest.cc ('k') | remoting/host/video_scheduler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/video_scheduler.h
diff --git a/remoting/host/video_scheduler.h b/remoting/host/video_scheduler.h
deleted file mode 100644
index 6adab1892a3e27e0d61f3e5ec93bd0ad7afe9d66..0000000000000000000000000000000000000000
--- a/remoting/host/video_scheduler.h
+++ /dev/null
@@ -1,204 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef REMOTING_HOST_VIDEO_SCHEDULER_H_
-#define REMOTING_HOST_VIDEO_SCHEDULER_H_
-
-#include <vector>
-
-#include "base/basictypes.h"
-#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/time/time.h"
-#include "base/timer/timer.h"
-#include "remoting/codec/video_encoder.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"
-
-namespace base {
-class SingleThreadTaskRunner;
-} // namespace base
-
-namespace media {
-class DesktopCapturer;
-} // namespace media
-
-namespace remoting {
-
-class CaptureScheduler;
-class CursorShapeInfo;
-
-namespace protocol {
-class CursorShapeInfo;
-class CursorShapeStub;
-class VideoStub;
-} // namespace protocol
-
-// Class responsible for scheduling frame captures from a
-// webrtc::DesktopCapturer, delivering them to a VideoEncoder to encode, and
-// finally passing the encoded video packets to the specified VideoStub to send
-// on the network.
-//
-// THREADING
-//
-// This class is supplied TaskRunners to use for capture, encode and network
-// operations. Capture, encode and network transmission tasks are interleaved
-// as illustrated below:
-//
-// | CAPTURE ENCODE NETWORK
-// | .............
-// | . Capture .
-// | .............
-// | ............
-// | . .
-// | ............. . .
-// | . Capture . . Encode .
-// | ............. . .
-// | . .
-// | ............
-// | ............. ............ ..........
-// | . Capture . . . . Send .
-// | ............. . . ..........
-// | . Encode .
-// | . .
-// | . .
-// | ............
-// | Time
-// v
-//
-// VideoScheduler would ideally schedule captures so as to saturate the slowest
-// of the capture, encode and network processes. However, it also needs to
-// rate-limit captures to avoid overloading the host system, either by consuming
-// too much CPU, or hogging the host's graphics subsystem.
-//
-// TODO(sergeyu): Rename this class to VideoFramePipe.
-class VideoScheduler : public base::RefCountedThreadSafe<VideoScheduler>,
- public webrtc::DesktopCapturer::Callback,
- public webrtc::MouseCursorMonitor::Callback {
- public:
- // Enables timestamps for generated frames. Used for testing.
- static void EnableTimestampsForTests();
-
- // Creates a VideoScheduler running capture, encode and network tasks on the
- // supplied TaskRunners. Video and cursor shape updates will be pumped to
- // |video_stub| and |client_stub|, which must remain valid until Stop() is
- // called. |capturer| is used to capture frames.
- VideoScheduler(
- scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner,
- scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner,
- scoped_refptr<base::SingleThreadTaskRunner> network_task_runner,
- scoped_ptr<webrtc::DesktopCapturer> capturer,
- scoped_ptr<webrtc::MouseCursorMonitor> mouse_cursor_monitor,
- scoped_ptr<VideoEncoder> encoder,
- protocol::CursorShapeStub* cursor_stub,
- protocol::VideoStub* video_stub);
-
- // Starts scheduling frame captures.
- void Start();
-
- // Stop scheduling frame captures. This object cannot be re-used once
- // it has been stopped.
- void Stop();
-
- // Pauses or resumes scheduling of frame captures. Pausing/resuming captures
- // only affects capture scheduling and does not stop/start the capturer.
- void Pause(bool pause);
-
- // Updates event timestamp from the last event received from the client. This
- // value is sent back to the client for roundtrip latency estimates.
- void SetLatestEventTimestamp(int64 latest_event_timestamp);
-
- // Sets whether the video encoder should be requested to encode losslessly,
- // or to use a lossless color space (typically requiring higher bandwidth).
- void SetLosslessEncode(bool want_lossless);
- void SetLosslessColor(bool want_lossless);
-
- private:
- friend class base::RefCountedThreadSafe<VideoScheduler>;
- ~VideoScheduler() override;
-
- // Capturer thread ----------------------------------------------------------
-
- // TODO(sergeyu): Move all methods that run on the capture thread to a
- // separate class and make VideoScheduler not ref-counted.
-
- // 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();
-
- // Captures next frame on the capture thread.
- void CaptureNextFrameOnCaptureThread();
-
- // Network thread -----------------------------------------------------------
-
- // Captures a new frame. Called by CaptureScheduler.
- void CaptureNextFrame();
-
- // Encodes and sends |frame|.
- void EncodeAndSendFrame(scoped_ptr<webrtc::DesktopFrame> frame);
-
- // Sends encoded frame
- void SendEncodedFrame(int64 latest_event_timestamp,
- base::TimeTicks timestamp,
- scoped_ptr<VideoPacket> packet);
-
- // Callback passed to |video_stub_| for the last packet in each frame, to
- // rate-limit frame captures to network throughput.
- void OnVideoPacketSent();
-
- // Called by |keep_alive_timer_|.
- void SendKeepAlivePacket();
-
- // Callback for |video_stub_| called after a keep-alive packet is sent.
- void OnKeepAlivePacketSent();
-
- // Send updated cursor shape to client.
- void SendCursorShape(scoped_ptr<protocol::CursorShapeInfo> cursor_shape);
-
- // Task runners used by this class.
- scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner_;
- scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner_;
- scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_;
-
- // Used to capture frames. Always accessed on the capture thread.
- scoped_ptr<webrtc::DesktopCapturer> capturer_;
-
- // Used to capture mouse cursor shapes. Always accessed on the capture thread.
- scoped_ptr<webrtc::MouseCursorMonitor> mouse_cursor_monitor_;
-
- // Used to encode captured frames. Always accessed on the encode thread.
- scoped_ptr<VideoEncoder> encoder_;
-
- // Interfaces through which video frames and cursor shapes are passed to the
- // client. These members are always accessed on the network thread.
- protocol::CursorShapeStub* cursor_stub_;
- protocol::VideoStub* video_stub_;
-
- // 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_;
-
- // Number updated by the caller to trace performance.
- int64 latest_event_timestamp_;
-
- scoped_ptr<CaptureScheduler> capture_scheduler_;
-
- DISALLOW_COPY_AND_ASSIGN(VideoScheduler);
-};
-
-} // namespace remoting
-
-#endif // REMOTING_HOST_VIDEO_SCHEDULER_H_
« no previous file with comments | « remoting/host/video_frame_pump_unittest.cc ('k') | remoting/host/video_scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698