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