| 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/webrtc_video_encoder_vpx.h" | |
| 15 #include "remoting/protocol/audio_writer.h" | 14 #include "remoting/protocol/audio_writer.h" |
| 16 #include "remoting/protocol/clipboard_stub.h" | 15 #include "remoting/protocol/clipboard_stub.h" |
| 17 #include "remoting/protocol/host_control_dispatcher.h" | 16 #include "remoting/protocol/host_control_dispatcher.h" |
| 18 #include "remoting/protocol/host_event_dispatcher.h" | 17 #include "remoting/protocol/host_event_dispatcher.h" |
| 19 #include "remoting/protocol/host_stub.h" | 18 #include "remoting/protocol/host_stub.h" |
| 20 #include "remoting/protocol/input_stub.h" | 19 #include "remoting/protocol/input_stub.h" |
| 21 #include "remoting/protocol/message_pipe.h" | 20 #include "remoting/protocol/message_pipe.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" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 session_->Close(error); | 70 session_->Close(error); |
| 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 | |
| 82 std::unique_ptr<VideoEncoder> video_encoder = | |
| 83 WebrtcVideoEncoderVpx::CreateForVP8(); | |
| 84 std::unique_ptr<WebrtcVideoStream> stream(new WebrtcVideoStream()); | 80 std::unique_ptr<WebrtcVideoStream> stream(new WebrtcVideoStream()); |
| 85 if (!stream->Start(std::move(desktop_capturer), transport_.get(), | 81 if (!stream->Start(std::move(desktop_capturer), transport_.get(), |
| 86 video_encode_task_runner_, std::move(video_encoder))) { | 82 video_encode_task_runner_)) { |
| 87 return nullptr; | 83 return nullptr; |
| 88 } | 84 } |
| 89 return std::move(stream); | 85 return std::move(stream); |
| 90 } | 86 } |
| 91 | 87 |
| 92 AudioStub* WebrtcConnectionToClient::audio_stub() { | 88 AudioStub* WebrtcConnectionToClient::audio_stub() { |
| 93 DCHECK(thread_checker_.CalledOnValidThread()); | 89 DCHECK(thread_checker_.CalledOnValidThread()); |
| 94 return nullptr; | 90 return nullptr; |
| 95 } | 91 } |
| 96 | 92 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 ChannelDispatcherBase* channel_dispatcher) { | 200 ChannelDispatcherBase* channel_dispatcher) { |
| 205 DCHECK(thread_checker_.CalledOnValidThread()); | 201 DCHECK(thread_checker_.CalledOnValidThread()); |
| 206 | 202 |
| 207 LOG(ERROR) << "Channel " << channel_dispatcher->channel_name() | 203 LOG(ERROR) << "Channel " << channel_dispatcher->channel_name() |
| 208 << " was closed unexpectedly."; | 204 << " was closed unexpectedly."; |
| 209 Disconnect(INCOMPATIBLE_PROTOCOL); | 205 Disconnect(INCOMPATIBLE_PROTOCOL); |
| 210 } | 206 } |
| 211 | 207 |
| 212 } // namespace protocol | 208 } // namespace protocol |
| 213 } // namespace remoting | 209 } // namespace remoting |
| OLD | NEW |