Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: remoting/protocol/webrtc_connection_to_client.cc

Issue 2413553003: Add InputEventTimestampSource interface. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 } 76 }
77 77
78 std::unique_ptr<VideoStream> WebrtcConnectionToClient::StartVideoStream( 78 std::unique_ptr<VideoStream> WebrtcConnectionToClient::StartVideoStream(
79 std::unique_ptr<webrtc::DesktopCapturer> desktop_capturer) { 79 std::unique_ptr<webrtc::DesktopCapturer> desktop_capturer) {
80 DCHECK(thread_checker_.CalledOnValidThread()); 80 DCHECK(thread_checker_.CalledOnValidThread());
81 DCHECK(transport_); 81 DCHECK(transport_);
82 82
83 std::unique_ptr<WebrtcVideoStream> stream(new WebrtcVideoStream()); 83 std::unique_ptr<WebrtcVideoStream> stream(new WebrtcVideoStream());
84 stream->Start(std::move(desktop_capturer), transport_.get(), 84 stream->Start(std::move(desktop_capturer), transport_.get(),
85 video_encode_task_runner_); 85 video_encode_task_runner_);
86 stream->SetEventTimestampSource(event_dispatcher_->GetEventTimestampSource());
86 return std::move(stream); 87 return std::move(stream);
87 } 88 }
88 89
89 std::unique_ptr<AudioStream> WebrtcConnectionToClient::StartAudioStream( 90 std::unique_ptr<AudioStream> WebrtcConnectionToClient::StartAudioStream(
90 std::unique_ptr<AudioSource> audio_source) { 91 std::unique_ptr<AudioSource> audio_source) {
91 DCHECK(thread_checker_.CalledOnValidThread()); 92 DCHECK(thread_checker_.CalledOnValidThread());
92 DCHECK(transport_); 93 DCHECK(transport_);
93 94
94 std::unique_ptr<WebrtcAudioStream> stream(new WebrtcAudioStream()); 95 std::unique_ptr<WebrtcAudioStream> stream(new WebrtcAudioStream());
95 stream->Start(audio_task_runner_, std::move(audio_source), transport_.get()); 96 stream->Start(audio_task_runner_, std::move(audio_source), transport_.get());
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 DCHECK(thread_checker_.CalledOnValidThread()); 175 DCHECK(thread_checker_.CalledOnValidThread());
175 Disconnect(error); 176 Disconnect(error);
176 } 177 }
177 178
178 void WebrtcConnectionToClient::OnWebrtcTransportIncomingDataChannel( 179 void WebrtcConnectionToClient::OnWebrtcTransportIncomingDataChannel(
179 const std::string& name, 180 const std::string& name,
180 std::unique_ptr<MessagePipe> pipe) { 181 std::unique_ptr<MessagePipe> pipe) {
181 DCHECK(thread_checker_.CalledOnValidThread()); 182 DCHECK(thread_checker_.CalledOnValidThread());
182 if (name == event_dispatcher_->channel_name() && 183 if (name == event_dispatcher_->channel_name() &&
183 !event_dispatcher_->is_connected()) { 184 !event_dispatcher_->is_connected()) {
184 event_dispatcher_->set_on_input_event_callback(
185 base::Bind(&WebrtcConnectionToClient::OnInputEventReceived,
186 base::Unretained(this)));
187 event_dispatcher_->Init(std::move(pipe), this); 185 event_dispatcher_->Init(std::move(pipe), this);
188 } 186 }
189 } 187 }
190 188
191 void WebrtcConnectionToClient::OnWebrtcTransportMediaStreamAdded( 189 void WebrtcConnectionToClient::OnWebrtcTransportMediaStreamAdded(
192 scoped_refptr<webrtc::MediaStreamInterface> stream) { 190 scoped_refptr<webrtc::MediaStreamInterface> stream) {
193 DCHECK(thread_checker_.CalledOnValidThread()); 191 DCHECK(thread_checker_.CalledOnValidThread());
194 LOG(WARNING) << "The client created an unexpected media stream."; 192 LOG(WARNING) << "The client created an unexpected media stream.";
195 } 193 }
196 194
(...skipping 14 matching lines...) Expand all
211 209
212 void WebrtcConnectionToClient::OnChannelClosed( 210 void WebrtcConnectionToClient::OnChannelClosed(
213 ChannelDispatcherBase* channel_dispatcher) { 211 ChannelDispatcherBase* channel_dispatcher) {
214 DCHECK(thread_checker_.CalledOnValidThread()); 212 DCHECK(thread_checker_.CalledOnValidThread());
215 213
216 LOG(ERROR) << "Channel " << channel_dispatcher->channel_name() 214 LOG(ERROR) << "Channel " << channel_dispatcher->channel_name()
217 << " was closed unexpectedly."; 215 << " was closed unexpectedly.";
218 Disconnect(INCOMPATIBLE_PROTOCOL); 216 Disconnect(INCOMPATIBLE_PROTOCOL);
219 } 217 }
220 218
221 void WebrtcConnectionToClient::OnInputEventReceived(int64_t timestamp) {
222 DCHECK(thread_checker_.CalledOnValidThread());
223 event_handler_->OnInputEventReceived(timestamp);
224 }
225
226 } // namespace protocol 219 } // namespace protocol
227 } // namespace remoting 220 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698