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 #include "remoting/protocol/webrtc_connection_to_client.h" | 5 #include "remoting/protocol/webrtc_connection_to_client.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
11 #include "jingle/glue/thread_wrapper.h" | 11 #include "jingle/glue/thread_wrapper.h" |
12 #include "net/base/io_buffer.h" | 12 #include "net/base/io_buffer.h" |
13 #include "remoting/codec/video_encoder.h" | 13 #include "remoting/codec/video_encoder.h" |
14 #include "remoting/codec/video_encoder_verbatim.h" | 14 #include "remoting/codec/webrtc_video_encoder_vpx.h" |
15 #include "remoting/codec/video_encoder_vpx.h" | |
16 #include "remoting/protocol/audio_writer.h" | 15 #include "remoting/protocol/audio_writer.h" |
17 #include "remoting/protocol/clipboard_stub.h" | 16 #include "remoting/protocol/clipboard_stub.h" |
18 #include "remoting/protocol/host_control_dispatcher.h" | 17 #include "remoting/protocol/host_control_dispatcher.h" |
19 #include "remoting/protocol/host_event_dispatcher.h" | 18 #include "remoting/protocol/host_event_dispatcher.h" |
20 #include "remoting/protocol/host_stub.h" | 19 #include "remoting/protocol/host_stub.h" |
21 #include "remoting/protocol/input_stub.h" | 20 #include "remoting/protocol/input_stub.h" |
22 #include "remoting/protocol/transport_context.h" | 21 #include "remoting/protocol/transport_context.h" |
23 #include "remoting/protocol/webrtc_transport.h" | 22 #include "remoting/protocol/webrtc_transport.h" |
24 #include "remoting/protocol/webrtc_video_stream.h" | 23 #include "remoting/protocol/webrtc_video_stream.h" |
25 #include "third_party/webrtc/api/mediastreaminterface.h" | 24 #include "third_party/webrtc/api/mediastreaminterface.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 } | 71 } |
73 | 72 |
74 void WebrtcConnectionToClient::OnInputEventReceived(int64_t timestamp) { | 73 void WebrtcConnectionToClient::OnInputEventReceived(int64_t timestamp) { |
75 DCHECK(thread_checker_.CalledOnValidThread()); | 74 DCHECK(thread_checker_.CalledOnValidThread()); |
76 event_handler_->OnInputEventReceived(this, timestamp); | 75 event_handler_->OnInputEventReceived(this, timestamp); |
77 } | 76 } |
78 | 77 |
79 std::unique_ptr<VideoStream> WebrtcConnectionToClient::StartVideoStream( | 78 std::unique_ptr<VideoStream> WebrtcConnectionToClient::StartVideoStream( |
80 std::unique_ptr<webrtc::DesktopCapturer> desktop_capturer) { | 79 std::unique_ptr<webrtc::DesktopCapturer> desktop_capturer) { |
81 // TODO(isheriff): make this codec independent | 80 // TODO(isheriff): make this codec independent |
82 std::unique_ptr<VideoEncoder> video_encoder = VideoEncoderVpx::CreateForVP8(); | 81 std::unique_ptr<VideoEncoder> video_encoder = |
| 82 WebRtcVideoEncoderVpx::CreateForVP8(); |
83 std::unique_ptr<WebrtcVideoStream> stream(new WebrtcVideoStream()); | 83 std::unique_ptr<WebrtcVideoStream> stream(new WebrtcVideoStream()); |
84 if (!stream->Start(std::move(desktop_capturer), transport_.get(), | 84 if (!stream->Start(std::move(desktop_capturer), transport_.get(), |
85 video_encode_task_runner_, std::move(video_encoder))) { | 85 video_encode_task_runner_, std::move(video_encoder))) { |
86 return nullptr; | 86 return nullptr; |
87 } | 87 } |
88 return std::move(stream); | 88 return std::move(stream); |
89 } | 89 } |
90 | 90 |
91 AudioStub* WebrtcConnectionToClient::audio_stub() { | 91 AudioStub* WebrtcConnectionToClient::audio_stub() { |
92 DCHECK(thread_checker_.CalledOnValidThread()); | 92 DCHECK(thread_checker_.CalledOnValidThread()); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 DCHECK(thread_checker_.CalledOnValidThread()); | 183 DCHECK(thread_checker_.CalledOnValidThread()); |
184 | 184 |
185 if (control_dispatcher_ && control_dispatcher_->is_connected() && | 185 if (control_dispatcher_ && control_dispatcher_->is_connected() && |
186 event_dispatcher_ && event_dispatcher_->is_connected()) { | 186 event_dispatcher_ && event_dispatcher_->is_connected()) { |
187 event_handler_->OnConnectionChannelsConnected(this); | 187 event_handler_->OnConnectionChannelsConnected(this); |
188 } | 188 } |
189 } | 189 } |
190 | 190 |
191 } // namespace protocol | 191 } // namespace protocol |
192 } // namespace remoting | 192 } // namespace remoting |
OLD | NEW |