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 28 matching lines...) Expand all Loading... |
39 public HostVideoStatsDispatcher::EventHandler { | 39 public HostVideoStatsDispatcher::EventHandler { |
40 public: | 40 public: |
41 WebrtcVideoStream(); | 41 WebrtcVideoStream(); |
42 ~WebrtcVideoStream() override; | 42 ~WebrtcVideoStream() override; |
43 | 43 |
44 void Start(std::unique_ptr<webrtc::DesktopCapturer> desktop_capturer, | 44 void Start(std::unique_ptr<webrtc::DesktopCapturer> desktop_capturer, |
45 WebrtcTransport* webrtc_transport, | 45 WebrtcTransport* webrtc_transport, |
46 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner); | 46 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner); |
47 | 47 |
48 // VideoStream interface. | 48 // VideoStream interface. |
| 49 void SetEventTimestampsSource(scoped_refptr<InputEventTimestampsSource> |
| 50 event_timestamps_source) override; |
49 void Pause(bool pause) override; | 51 void Pause(bool pause) override; |
50 void OnInputEventReceived(int64_t event_timestamp) override; | |
51 void SetLosslessEncode(bool want_lossless) override; | 52 void SetLosslessEncode(bool want_lossless) override; |
52 void SetLosslessColor(bool want_lossless) override; | 53 void SetLosslessColor(bool want_lossless) override; |
53 void SetObserver(Observer* observer) override; | 54 void SetObserver(Observer* observer) override; |
54 | 55 |
55 private: | 56 private: |
56 struct FrameTimestamps; | 57 struct FrameTimestamps; |
57 struct EncodedFrameWithTimestamps; | 58 struct EncodedFrameWithTimestamps; |
58 | 59 |
59 // webrtc::DesktopCapturer::Callback interface. | 60 // webrtc::DesktopCapturer::Callback interface. |
60 void OnCaptureResult(webrtc::DesktopCapturer::Result result, | 61 void OnCaptureResult(webrtc::DesktopCapturer::Result result, |
(...skipping 19 matching lines...) Expand all Loading... |
80 | 81 |
81 // Capturer used to capture the screen. | 82 // Capturer used to capture the screen. |
82 std::unique_ptr<webrtc::DesktopCapturer> capturer_; | 83 std::unique_ptr<webrtc::DesktopCapturer> capturer_; |
83 // Used to send across encoded frames. | 84 // Used to send across encoded frames. |
84 WebrtcTransport* webrtc_transport_ = nullptr; | 85 WebrtcTransport* webrtc_transport_ = nullptr; |
85 // Task runner used to run |encoder_|. | 86 // Task runner used to run |encoder_|. |
86 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner_; | 87 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner_; |
87 // Used to encode captured frames. Always accessed on the encode thread. | 88 // Used to encode captured frames. Always accessed on the encode thread. |
88 std::unique_ptr<WebrtcVideoEncoder> encoder_; | 89 std::unique_ptr<WebrtcVideoEncoder> encoder_; |
89 | 90 |
| 91 scoped_refptr<InputEventTimestampsSource> event_timestamps_source_; |
| 92 |
90 scoped_refptr<webrtc::PeerConnectionInterface> peer_connection_; | 93 scoped_refptr<webrtc::PeerConnectionInterface> peer_connection_; |
91 scoped_refptr<webrtc::MediaStreamInterface> stream_; | 94 scoped_refptr<webrtc::MediaStreamInterface> stream_; |
92 | 95 |
93 HostVideoStatsDispatcher video_stats_dispatcher_; | 96 HostVideoStatsDispatcher video_stats_dispatcher_; |
94 | 97 |
95 // Timestamps for the frame to be captured next. | |
96 std::unique_ptr<FrameTimestamps> next_frame_timestamps_; | |
97 | |
98 // Timestamps for the frame that's being captured. | 98 // Timestamps for the frame that's being captured. |
99 std::unique_ptr<FrameTimestamps> captured_frame_timestamps_; | 99 std::unique_ptr<FrameTimestamps> captured_frame_timestamps_; |
100 | 100 |
101 std::unique_ptr<WebrtcFrameScheduler> scheduler_; | 101 std::unique_ptr<WebrtcFrameScheduler> scheduler_; |
102 | 102 |
103 bool received_first_frame_request_ = false; | 103 bool received_first_frame_request_ = false; |
104 | 104 |
105 webrtc::DesktopSize frame_size_; | 105 webrtc::DesktopSize frame_size_; |
106 webrtc::DesktopVector frame_dpi_; | 106 webrtc::DesktopVector frame_dpi_; |
107 Observer* observer_ = nullptr; | 107 Observer* observer_ = nullptr; |
108 | 108 |
109 base::ThreadChecker thread_checker_; | 109 base::ThreadChecker thread_checker_; |
110 | 110 |
111 base::WeakPtrFactory<WebrtcVideoStream> weak_factory_; | 111 base::WeakPtrFactory<WebrtcVideoStream> weak_factory_; |
112 | 112 |
113 DISALLOW_COPY_AND_ASSIGN(WebrtcVideoStream); | 113 DISALLOW_COPY_AND_ASSIGN(WebrtcVideoStream); |
114 }; | 114 }; |
115 | 115 |
116 } // namespace protocol | 116 } // namespace protocol |
117 } // namespace remoting | 117 } // namespace remoting |
118 | 118 |
119 #endif // REMOTING_PROTOCOL_WEBRTC_VIDEO_STREAM_H_ | 119 #endif // REMOTING_PROTOCOL_WEBRTC_VIDEO_STREAM_H_ |
OLD | NEW |