| 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" | 14 #include "remoting/codec/webrtc_video_encoder_vpx.h" |
| 15 #include "remoting/protocol/audio_writer.h" | 15 #include "remoting/protocol/audio_send_stream.h" |
| 16 #include "remoting/protocol/clipboard_stub.h" | 16 #include "remoting/protocol/clipboard_stub.h" |
| 17 #include "remoting/protocol/host_control_dispatcher.h" | 17 #include "remoting/protocol/host_control_dispatcher.h" |
| 18 #include "remoting/protocol/host_event_dispatcher.h" | 18 #include "remoting/protocol/host_event_dispatcher.h" |
| 19 #include "remoting/protocol/host_stub.h" | 19 #include "remoting/protocol/host_stub.h" |
| 20 #include "remoting/protocol/input_stub.h" | 20 #include "remoting/protocol/input_stub.h" |
| 21 #include "remoting/protocol/message_pipe.h" | 21 #include "remoting/protocol/message_pipe.h" |
| 22 #include "remoting/protocol/transport_context.h" | 22 #include "remoting/protocol/transport_context.h" |
| 23 #include "remoting/protocol/webrtc_transport.h" | 23 #include "remoting/protocol/webrtc_transport.h" |
| 24 #include "remoting/protocol/webrtc_video_stream.h" | 24 #include "remoting/protocol/webrtc_video_stream.h" |
| 25 #include "third_party/webrtc/api/mediastreaminterface.h" | 25 #include "third_party/webrtc/api/mediastreaminterface.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 std::unique_ptr<VideoEncoder> video_encoder = | 82 std::unique_ptr<VideoEncoder> video_encoder = |
| 83 WebrtcVideoEncoderVpx::CreateForVP8(); | 83 WebrtcVideoEncoderVpx::CreateForVP8(); |
| 84 std::unique_ptr<WebrtcVideoStream> stream(new WebrtcVideoStream()); | 84 std::unique_ptr<WebrtcVideoStream> stream(new WebrtcVideoStream()); |
| 85 if (!stream->Start(std::move(desktop_capturer), transport_.get(), | 85 if (!stream->Start(std::move(desktop_capturer), transport_.get(), |
| 86 video_encode_task_runner_, std::move(video_encoder))) { | 86 video_encode_task_runner_, std::move(video_encoder))) { |
| 87 return nullptr; | 87 return nullptr; |
| 88 } | 88 } |
| 89 return std::move(stream); | 89 return std::move(stream); |
| 90 } | 90 } |
| 91 | 91 |
| 92 AudioStub* WebrtcConnectionToClient::audio_stub() { | 92 std::unique_ptr<AudioSendStream> WebrtcConnectionToClient::StartAudioStream( |
| 93 DCHECK(thread_checker_.CalledOnValidThread()); | 93 std::unique_ptr<AudioSource> audio_source) { |
| 94 NOTIMPLEMENTED(); |
| 94 return nullptr; | 95 return nullptr; |
| 95 } | 96 } |
| 96 | 97 |
| 97 // Return pointer to ClientStub. | 98 // Return pointer to ClientStub. |
| 98 ClientStub* WebrtcConnectionToClient::client_stub() { | 99 ClientStub* WebrtcConnectionToClient::client_stub() { |
| 99 DCHECK(thread_checker_.CalledOnValidThread()); | 100 DCHECK(thread_checker_.CalledOnValidThread()); |
| 100 return control_dispatcher_.get(); | 101 return control_dispatcher_.get(); |
| 101 } | 102 } |
| 102 | 103 |
| 103 void WebrtcConnectionToClient::set_clipboard_stub( | 104 void WebrtcConnectionToClient::set_clipboard_stub( |
| (...skipping 28 matching lines...) Expand all Loading... |
| 132 event_handler_->OnConnectionAuthenticating(this); | 133 event_handler_->OnConnectionAuthenticating(this); |
| 133 break; | 134 break; |
| 134 | 135 |
| 135 case Session::AUTHENTICATED: { | 136 case Session::AUTHENTICATED: { |
| 136 base::WeakPtr<WebrtcConnectionToClient> self = weak_factory_.GetWeakPtr(); | 137 base::WeakPtr<WebrtcConnectionToClient> self = weak_factory_.GetWeakPtr(); |
| 137 event_handler_->OnConnectionAuthenticated(this); | 138 event_handler_->OnConnectionAuthenticated(this); |
| 138 | 139 |
| 139 // OnConnectionAuthenticated() call above may result in the connection | 140 // OnConnectionAuthenticated() call above may result in the connection |
| 140 // being torn down. | 141 // being torn down. |
| 141 if (self) | 142 if (self) |
| 142 event_handler_->CreateVideoStreams(this); | 143 event_handler_->CreateMediaStreams(this); |
| 143 break; | 144 break; |
| 144 } | 145 } |
| 145 | 146 |
| 146 case Session::CLOSED: | 147 case Session::CLOSED: |
| 147 case Session::FAILED: | 148 case Session::FAILED: |
| 148 control_dispatcher_.reset(); | 149 control_dispatcher_.reset(); |
| 149 event_dispatcher_.reset(); | 150 event_dispatcher_.reset(); |
| 150 transport_->Close(state == Session::CLOSED ? OK : session_->error()); | 151 transport_->Close(state == Session::CLOSED ? OK : session_->error()); |
| 151 event_handler_->OnConnectionClosed( | 152 event_handler_->OnConnectionClosed( |
| 152 this, state == Session::CLOSED ? OK : session_->error()); | 153 this, state == Session::CLOSED ? OK : session_->error()); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 ChannelDispatcherBase* channel_dispatcher) { | 205 ChannelDispatcherBase* channel_dispatcher) { |
| 205 DCHECK(thread_checker_.CalledOnValidThread()); | 206 DCHECK(thread_checker_.CalledOnValidThread()); |
| 206 | 207 |
| 207 LOG(ERROR) << "Channel " << channel_dispatcher->channel_name() | 208 LOG(ERROR) << "Channel " << channel_dispatcher->channel_name() |
| 208 << " was closed unexpectedly."; | 209 << " was closed unexpectedly."; |
| 209 Disconnect(INCOMPATIBLE_PROTOCOL); | 210 Disconnect(INCOMPATIBLE_PROTOCOL); |
| 210 } | 211 } |
| 211 | 212 |
| 212 } // namespace protocol | 213 } // namespace protocol |
| 213 } // namespace remoting | 214 } // namespace remoting |
| OLD | NEW |