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 16 matching lines...) Expand all Loading... |
77 | 78 |
78 // Capturer used to capture the screen. | 79 // Capturer used to capture the screen. |
79 std::unique_ptr<webrtc::DesktopCapturer> capturer_; | 80 std::unique_ptr<webrtc::DesktopCapturer> capturer_; |
80 // Used to send across encoded frames. | 81 // Used to send across encoded frames. |
81 WebrtcTransport* webrtc_transport_ = nullptr; | 82 WebrtcTransport* webrtc_transport_ = nullptr; |
82 // Task runner used to run |encoder_|. | 83 // Task runner used to run |encoder_|. |
83 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner_; | 84 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner_; |
84 // Used to encode captured frames. Always accessed on the encode thread. | 85 // Used to encode captured frames. Always accessed on the encode thread. |
85 std::unique_ptr<WebrtcVideoEncoder> encoder_; | 86 std::unique_ptr<WebrtcVideoEncoder> encoder_; |
86 | 87 |
| 88 scoped_refptr<InputEventTimestampsSource> event_timestamps_source_; |
| 89 |
87 scoped_refptr<webrtc::PeerConnectionInterface> peer_connection_; | 90 scoped_refptr<webrtc::PeerConnectionInterface> peer_connection_; |
88 scoped_refptr<webrtc::MediaStreamInterface> stream_; | 91 scoped_refptr<webrtc::MediaStreamInterface> stream_; |
89 | 92 |
90 HostVideoStatsDispatcher video_stats_dispatcher_; | 93 HostVideoStatsDispatcher video_stats_dispatcher_; |
91 | 94 |
92 // Timestamps for the frame to be captured next. | |
93 std::unique_ptr<FrameTimestamps> next_frame_timestamps_; | |
94 | |
95 // Timestamps for the frame that's being captured. | 95 // Timestamps for the frame that's being captured. |
96 std::unique_ptr<FrameTimestamps> captured_frame_timestamps_; | 96 std::unique_ptr<FrameTimestamps> captured_frame_timestamps_; |
97 | 97 |
98 std::unique_ptr<WebrtcFrameScheduler> scheduler_; | 98 std::unique_ptr<WebrtcFrameScheduler> scheduler_; |
99 | 99 |
100 webrtc::DesktopSize frame_size_; | 100 webrtc::DesktopSize frame_size_; |
101 webrtc::DesktopVector frame_dpi_; | 101 webrtc::DesktopVector frame_dpi_; |
102 Observer* observer_ = nullptr; | 102 Observer* observer_ = nullptr; |
103 | 103 |
104 base::ThreadChecker thread_checker_; | 104 base::ThreadChecker thread_checker_; |
105 | 105 |
106 base::WeakPtrFactory<WebrtcVideoStream> weak_factory_; | 106 base::WeakPtrFactory<WebrtcVideoStream> weak_factory_; |
107 | 107 |
108 DISALLOW_COPY_AND_ASSIGN(WebrtcVideoStream); | 108 DISALLOW_COPY_AND_ASSIGN(WebrtcVideoStream); |
109 }; | 109 }; |
110 | 110 |
111 } // namespace protocol | 111 } // namespace protocol |
112 } // namespace remoting | 112 } // namespace remoting |
113 | 113 |
114 #endif // REMOTING_PROTOCOL_WEBRTC_VIDEO_STREAM_H_ | 114 #endif // REMOTING_PROTOCOL_WEBRTC_VIDEO_STREAM_H_ |
OLD | NEW |