| 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" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "third_party/webrtc/api/test/fakeconstraints.h" | 28 #include "third_party/webrtc/api/test/fakeconstraints.h" |
| 29 | 29 |
| 30 namespace remoting { | 30 namespace remoting { |
| 31 namespace protocol { | 31 namespace protocol { |
| 32 | 32 |
| 33 // Currently the network thread is also used as worker thread for webrtc. | 33 // Currently the network thread is also used as worker thread for webrtc. |
| 34 // | 34 // |
| 35 // TODO(sergeyu): Figure out if we would benefit from using a separate | 35 // TODO(sergeyu): Figure out if we would benefit from using a separate |
| 36 // thread as a worker thread. | 36 // thread as a worker thread. |
| 37 WebrtcConnectionToClient::WebrtcConnectionToClient( | 37 WebrtcConnectionToClient::WebrtcConnectionToClient( |
| 38 scoped_ptr<protocol::Session> session, | 38 std::unique_ptr<protocol::Session> session, |
| 39 scoped_refptr<protocol::TransportContext> transport_context) | 39 scoped_refptr<protocol::TransportContext> transport_context) |
| 40 : transport_(jingle_glue::JingleThreadWrapper::current(), | 40 : transport_(jingle_glue::JingleThreadWrapper::current(), |
| 41 transport_context, | 41 transport_context, |
| 42 this), | 42 this), |
| 43 session_(std::move(session)), | 43 session_(std::move(session)), |
| 44 control_dispatcher_(new HostControlDispatcher()), | 44 control_dispatcher_(new HostControlDispatcher()), |
| 45 event_dispatcher_(new HostEventDispatcher()) { | 45 event_dispatcher_(new HostEventDispatcher()) { |
| 46 session_->SetEventHandler(this); | 46 session_->SetEventHandler(this); |
| 47 session_->SetTransport(&transport_); | 47 session_->SetTransport(&transport_); |
| 48 } | 48 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 66 // This should trigger OnConnectionClosed() event and this object | 66 // This should trigger OnConnectionClosed() event and this object |
| 67 // may be destroyed as the result. | 67 // may be destroyed as the result. |
| 68 session_->Close(error); | 68 session_->Close(error); |
| 69 } | 69 } |
| 70 | 70 |
| 71 void WebrtcConnectionToClient::OnInputEventReceived(int64_t timestamp) { | 71 void WebrtcConnectionToClient::OnInputEventReceived(int64_t timestamp) { |
| 72 DCHECK(thread_checker_.CalledOnValidThread()); | 72 DCHECK(thread_checker_.CalledOnValidThread()); |
| 73 event_handler_->OnInputEventReceived(this, timestamp); | 73 event_handler_->OnInputEventReceived(this, timestamp); |
| 74 } | 74 } |
| 75 | 75 |
| 76 scoped_ptr<VideoStream> WebrtcConnectionToClient::StartVideoStream( | 76 std::unique_ptr<VideoStream> WebrtcConnectionToClient::StartVideoStream( |
| 77 scoped_ptr<webrtc::DesktopCapturer> desktop_capturer) { | 77 std::unique_ptr<webrtc::DesktopCapturer> desktop_capturer) { |
| 78 scoped_ptr<WebrtcVideoStream> stream(new WebrtcVideoStream()); | 78 std::unique_ptr<WebrtcVideoStream> stream(new WebrtcVideoStream()); |
| 79 if (!stream->Start(std::move(desktop_capturer), transport_.peer_connection(), | 79 if (!stream->Start(std::move(desktop_capturer), transport_.peer_connection(), |
| 80 transport_.peer_connection_factory())) { | 80 transport_.peer_connection_factory())) { |
| 81 return nullptr; | 81 return nullptr; |
| 82 } | 82 } |
| 83 return std::move(stream); | 83 return std::move(stream); |
| 84 | 84 |
| 85 } | 85 } |
| 86 | 86 |
| 87 AudioStub* WebrtcConnectionToClient::audio_stub() { | 87 AudioStub* WebrtcConnectionToClient::audio_stub() { |
| 88 DCHECK(thread_checker_.CalledOnValidThread()); | 88 DCHECK(thread_checker_.CalledOnValidThread()); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 DCHECK(thread_checker_.CalledOnValidThread()); | 168 DCHECK(thread_checker_.CalledOnValidThread()); |
| 169 | 169 |
| 170 if (control_dispatcher_ && control_dispatcher_->is_connected() && | 170 if (control_dispatcher_ && control_dispatcher_->is_connected() && |
| 171 event_dispatcher_ && event_dispatcher_->is_connected()) { | 171 event_dispatcher_ && event_dispatcher_->is_connected()) { |
| 172 event_handler_->OnConnectionChannelsConnected(this); | 172 event_handler_->OnConnectionChannelsConnected(this); |
| 173 } | 173 } |
| 174 } | 174 } |
| 175 | 175 |
| 176 } // namespace protocol | 176 } // namespace protocol |
| 177 } // namespace remoting | 177 } // namespace remoting |
| OLD | NEW |