OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef REMOTING_PROTOCOL_WEBRTC_VIDEO_STREAM_H_ | 5 #ifndef REMOTING_PROTOCOL_WEBRTC_VIDEO_STREAM_H_ |
6 #define REMOTING_PROTOCOL_WEBRTC_VIDEO_STREAM_H_ | 6 #define REMOTING_PROTOCOL_WEBRTC_VIDEO_STREAM_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 std::unique_ptr<webrtc::DesktopCapturer> desktop_capturer, | 42 std::unique_ptr<webrtc::DesktopCapturer> desktop_capturer, |
43 WebrtcTransport* webrtc_transport, | 43 WebrtcTransport* webrtc_transport, |
44 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner, | 44 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner, |
45 std::unique_ptr<VideoEncoder> video_encoder); | 45 std::unique_ptr<VideoEncoder> video_encoder); |
46 | 46 |
47 // VideoStream interface. | 47 // VideoStream interface. |
48 void Pause(bool pause) override; | 48 void Pause(bool pause) override; |
49 void OnInputEventReceived(int64_t event_timestamp) override; | 49 void OnInputEventReceived(int64_t event_timestamp) override; |
50 void SetLosslessEncode(bool want_lossless) override; | 50 void SetLosslessEncode(bool want_lossless) override; |
51 void SetLosslessColor(bool want_lossless) override; | 51 void SetLosslessColor(bool want_lossless) override; |
52 void SetSizeCallback(const SizeCallback& size_callback) override; | 52 void SetObserver(Observer* observer) override; |
53 | 53 |
54 private: | 54 private: |
55 // webrtc::DesktopCapturer::Callback interface. | 55 // webrtc::DesktopCapturer::Callback interface. |
56 void OnCaptureResult(webrtc::DesktopCapturer::Result result, | 56 void OnCaptureResult(webrtc::DesktopCapturer::Result result, |
57 std::unique_ptr<webrtc::DesktopFrame> frame) override; | 57 std::unique_ptr<webrtc::DesktopFrame> frame) override; |
58 | 58 |
59 // Starts |capture_timer_|. | 59 // Starts |capture_timer_|. |
60 void StartCaptureTimer(); | 60 void StartCaptureTimer(); |
61 | 61 |
62 // Called by |capture_timer_|. | 62 // Called by |capture_timer_|. |
(...skipping 14 matching lines...) Expand all Loading... |
77 bool received_first_frame_request_ = false; | 77 bool received_first_frame_request_ = false; |
78 | 78 |
79 bool capture_pending_ = false; | 79 bool capture_pending_ = false; |
80 bool encode_pending_ = false; | 80 bool encode_pending_ = false; |
81 | 81 |
82 // Last time capture was started. | 82 // Last time capture was started. |
83 base::TimeTicks last_capture_started_ticks_; | 83 base::TimeTicks last_capture_started_ticks_; |
84 | 84 |
85 webrtc::DesktopSize frame_size_; | 85 webrtc::DesktopSize frame_size_; |
86 webrtc::DesktopVector frame_dpi_; | 86 webrtc::DesktopVector frame_dpi_; |
87 SizeCallback size_callback_; | 87 Observer* observer_ = nullptr; |
88 | 88 |
89 // Main task runner. | 89 // Main task runner. |
90 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; | 90 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; |
91 | 91 |
92 // Task runner used to run |encoder_|. | 92 // Task runner used to run |encoder_|. |
93 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner_; | 93 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner_; |
94 | 94 |
95 // Capturer used to capture the screen. | 95 // Capturer used to capture the screen. |
96 std::unique_ptr<webrtc::DesktopCapturer> capturer_; | 96 std::unique_ptr<webrtc::DesktopCapturer> capturer_; |
97 | 97 |
98 std::unique_ptr<base::RepeatingTimer> capture_timer_; | 98 std::unique_ptr<base::RepeatingTimer> capture_timer_; |
99 | 99 |
100 // Used to send across encoded frames. | 100 // Used to send across encoded frames. |
101 WebrtcTransport* webrtc_transport_ = nullptr; | 101 WebrtcTransport* webrtc_transport_ = nullptr; |
102 | 102 |
103 // Used to encode captured frames. Always accessed on the encode thread. | 103 // Used to encode captured frames. Always accessed on the encode thread. |
104 std::unique_ptr<VideoEncoder> encoder_; | 104 std::unique_ptr<VideoEncoder> encoder_; |
105 | 105 |
106 base::ThreadChecker thread_checker_; | 106 base::ThreadChecker thread_checker_; |
107 | 107 |
108 base::WeakPtrFactory<WebrtcVideoStream> weak_factory_; | 108 base::WeakPtrFactory<WebrtcVideoStream> weak_factory_; |
109 | 109 |
110 DISALLOW_COPY_AND_ASSIGN(WebrtcVideoStream); | 110 DISALLOW_COPY_AND_ASSIGN(WebrtcVideoStream); |
111 }; | 111 }; |
112 | 112 |
113 } // namespace protocol | 113 } // namespace protocol |
114 } // namespace remoting | 114 } // namespace remoting |
115 | 115 |
116 #endif // REMOTING_PROTOCOL_WEBRTC_VIDEO_STREAM_H_ | 116 #endif // REMOTING_PROTOCOL_WEBRTC_VIDEO_STREAM_H_ |
OLD | NEW |