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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 void CaptureNextFrame(); | 68 void CaptureNextFrame(); |
69 | 69 |
70 // Task running on the encoder thread to encode the |frame|. | 70 // Task running on the encoder thread to encode the |frame|. |
71 static EncodedFrameWithTimestamps EncodeFrame( | 71 static EncodedFrameWithTimestamps EncodeFrame( |
72 WebrtcVideoEncoder* encoder, | 72 WebrtcVideoEncoder* encoder, |
73 std::unique_ptr<webrtc::DesktopFrame> frame, | 73 std::unique_ptr<webrtc::DesktopFrame> frame, |
74 WebrtcVideoEncoder::FrameParams params, | 74 WebrtcVideoEncoder::FrameParams params, |
75 std::unique_ptr<WebrtcVideoStream::FrameTimestamps> timestamps); | 75 std::unique_ptr<WebrtcVideoStream::FrameTimestamps> timestamps); |
76 void OnFrameEncoded(EncodedFrameWithTimestamps frame); | 76 void OnFrameEncoded(EncodedFrameWithTimestamps frame); |
77 | 77 |
78 void SetKeyFrameRequest(); | |
79 void SetTargetBitrate(int bitrate); | |
80 | |
81 // Capturer used to capture the screen. | 78 // Capturer used to capture the screen. |
82 std::unique_ptr<webrtc::DesktopCapturer> capturer_; | 79 std::unique_ptr<webrtc::DesktopCapturer> capturer_; |
83 // Used to send across encoded frames. | 80 // Used to send across encoded frames. |
84 WebrtcTransport* webrtc_transport_ = nullptr; | 81 WebrtcTransport* webrtc_transport_ = nullptr; |
85 // Task runner used to run |encoder_|. | 82 // Task runner used to run |encoder_|. |
86 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner_; | 83 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner_; |
87 // Used to encode captured frames. Always accessed on the encode thread. | 84 // Used to encode captured frames. Always accessed on the encode thread. |
88 std::unique_ptr<WebrtcVideoEncoder> encoder_; | 85 std::unique_ptr<WebrtcVideoEncoder> encoder_; |
89 | 86 |
90 scoped_refptr<webrtc::PeerConnectionInterface> peer_connection_; | 87 scoped_refptr<webrtc::PeerConnectionInterface> peer_connection_; |
91 scoped_refptr<webrtc::MediaStreamInterface> stream_; | 88 scoped_refptr<webrtc::MediaStreamInterface> stream_; |
92 | 89 |
93 HostVideoStatsDispatcher video_stats_dispatcher_; | 90 HostVideoStatsDispatcher video_stats_dispatcher_; |
94 | 91 |
95 // Timestamps for the frame to be captured next. | 92 // Timestamps for the frame to be captured next. |
96 std::unique_ptr<FrameTimestamps> next_frame_timestamps_; | 93 std::unique_ptr<FrameTimestamps> next_frame_timestamps_; |
97 | 94 |
98 // Timestamps for the frame that's being captured. | 95 // Timestamps for the frame that's being captured. |
99 std::unique_ptr<FrameTimestamps> captured_frame_timestamps_; | 96 std::unique_ptr<FrameTimestamps> captured_frame_timestamps_; |
100 | 97 |
101 std::unique_ptr<WebrtcFrameScheduler> scheduler_; | 98 std::unique_ptr<WebrtcFrameScheduler> scheduler_; |
102 | 99 |
103 bool received_first_frame_request_ = false; | |
104 | |
105 webrtc::DesktopSize frame_size_; | 100 webrtc::DesktopSize frame_size_; |
106 webrtc::DesktopVector frame_dpi_; | 101 webrtc::DesktopVector frame_dpi_; |
107 Observer* observer_ = nullptr; | 102 Observer* observer_ = nullptr; |
108 | 103 |
109 base::ThreadChecker thread_checker_; | 104 base::ThreadChecker thread_checker_; |
110 | 105 |
111 base::WeakPtrFactory<WebrtcVideoStream> weak_factory_; | 106 base::WeakPtrFactory<WebrtcVideoStream> weak_factory_; |
112 | 107 |
113 DISALLOW_COPY_AND_ASSIGN(WebrtcVideoStream); | 108 DISALLOW_COPY_AND_ASSIGN(WebrtcVideoStream); |
114 }; | 109 }; |
115 | 110 |
116 } // namespace protocol | 111 } // namespace protocol |
117 } // namespace remoting | 112 } // namespace remoting |
118 | 113 |
119 #endif // REMOTING_PROTOCOL_WEBRTC_VIDEO_STREAM_H_ | 114 #endif // REMOTING_PROTOCOL_WEBRTC_VIDEO_STREAM_H_ |
OLD | NEW |