Index: remoting/protocol/webrtc_frame_scheduler.h |
diff --git a/remoting/protocol/webrtc_frame_scheduler.h b/remoting/protocol/webrtc_frame_scheduler.h |
deleted file mode 100644 |
index 363eac15c58eb11c6ba8bd7f9d8f2a8514524e53..0000000000000000000000000000000000000000 |
--- a/remoting/protocol/webrtc_frame_scheduler.h |
+++ /dev/null |
@@ -1,117 +0,0 @@ |
-// Copyright 2016 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_PROTOCOL_WEBRTC_FRAME_SCHEDULER_H_ |
-#define REMOTING_PROTOCOL_WEBRTC_FRAME_SCHEDULER_H_ |
- |
-#include <memory> |
- |
-#include "base/macros.h" |
-#include "base/memory/ref_counted.h" |
-#include "base/memory/weak_ptr.h" |
-#include "base/single_thread_task_runner.h" |
-#include "base/task/cancelable_task_tracker.h" |
-#include "base/threading/thread_checker.h" |
-#include "base/timer/timer.h" |
-#include "remoting/codec/video_encoder.h" |
-#include "remoting/protocol/video_stream.h" |
-#include "remoting/protocol/webrtc_transport.h" |
-#include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h" |
-#include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" |
- |
-namespace remoting { |
-namespace protocol { |
- |
-// Class responsible for scheduling frames for encode and hand-over to |
-// Webrtc transport for sending across the network. |
-class WebrtcFrameScheduler : public webrtc::DesktopCapturer::Callback { |
- public: |
- WebrtcFrameScheduler( |
- scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner, |
- std::unique_ptr<webrtc::DesktopCapturer> capturer, |
- WebrtcTransport* webrtc_transport, |
- std::unique_ptr<VideoEncoder> encoder); |
- ~WebrtcFrameScheduler() override; |
- |
- // Starts scheduling frames to be encoded and transported. |
- void Start(); |
- // Stops scheduling frames. |
- void Stop(); |
- |
- void Pause(bool pause); |
- |
- void SetSizeCallback(const VideoStream::SizeCallback& size_callback); |
- |
- private: |
- // webrtc::DesktopCapturer::Callback interface. |
- void OnCaptureResult(webrtc::DesktopCapturer::Result result, |
- std::unique_ptr<webrtc::DesktopFrame> frame) override; |
- |
- // Starts |capture_timer_|. |
- void StartCaptureTimer(); |
- |
- // Called by |capture_timer_|. |
- void CaptureNextFrame(); |
- |
- // Task running on the encoder thread to encode the |frame|. |
- static std::unique_ptr<VideoPacket> EncodeFrame( |
- VideoEncoder* encoder, |
- std::unique_ptr<webrtc::DesktopFrame> frame, |
- uint32_t target_bitrate, |
- bool key_frame_request, |
- int64_t capture_time_ms); |
- void OnFrameEncoded(std::unique_ptr<VideoPacket> packet); |
- |
- void SetKeyFrameRequest(); |
- bool ClearAndGetKeyFrameRequest(); |
- void SetTargetBitrate(int bitrate); |
- |
- // Protects |key_frame_request_| and |target_bitrate_kbps_|. |
- base::Lock lock_; |
- bool key_frame_request_ = false; |
- uint32_t target_bitrate_kbps_; |
- |
- bool received_first_frame_request_ = false; |
- |
- bool capture_pending_ = false; |
- bool encode_pending_ = false; |
- |
- // Last time capture was completed. |
- base::TimeTicks last_capture_completed_ticks_; |
- // Last time capture was started. |
- base::TimeTicks last_capture_started_ticks_; |
- |
- webrtc::DesktopSize frame_size_; |
- webrtc::DesktopVector frame_dpi_; |
- VideoStream::SizeCallback size_callback_; |
- |
- // Main task runner. |
- scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; |
- |
- // Task runner used to run |encoder_|. |
- scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner_; |
- base::CancelableTaskTracker task_tracker_; |
- |
- // Capturer used to capture the screen. |
- std::unique_ptr<webrtc::DesktopCapturer> capturer_; |
- |
- std::unique_ptr<base::RepeatingTimer> capture_timer_; |
- |
- // Used to send across encoded frames. |
- WebrtcTransport* webrtc_transport_; |
- |
- // Used to encode captured frames. Always accessed on the encode thread. |
- std::unique_ptr<VideoEncoder> encoder_; |
- |
- base::ThreadChecker thread_checker_; |
- |
- base::WeakPtrFactory<WebrtcFrameScheduler> weak_factory_; |
- |
- DISALLOW_COPY_AND_ASSIGN(WebrtcFrameScheduler); |
-}; |
- |
-} // namespace protocol |
-} // namespace remoting |
- |
-#endif // REMOTING_PROTOCOL_WEBRTC_FRAME_SCHEDULER_H_ |