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

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

Issue 1923573006: Implement a dummy host to do capturing and analysis only. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resolve review commnets Created 4 years, 7 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
« no previous file with comments | « remoting/protocol/fake_connection_to_client.cc ('k') | remoting/protocol/session_config.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/ice_connection_to_client.h" 5 #include "remoting/protocol/ice_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 "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.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/video_encoder_verbatim.h"
15 #include "remoting/codec/video_encoder_vpx.h"
16 #include "remoting/protocol/audio_writer.h" 14 #include "remoting/protocol/audio_writer.h"
17 #include "remoting/protocol/clipboard_stub.h" 15 #include "remoting/protocol/clipboard_stub.h"
18 #include "remoting/protocol/host_control_dispatcher.h" 16 #include "remoting/protocol/host_control_dispatcher.h"
19 #include "remoting/protocol/host_event_dispatcher.h" 17 #include "remoting/protocol/host_event_dispatcher.h"
20 #include "remoting/protocol/host_stub.h" 18 #include "remoting/protocol/host_stub.h"
21 #include "remoting/protocol/host_video_dispatcher.h" 19 #include "remoting/protocol/host_video_dispatcher.h"
22 #include "remoting/protocol/input_stub.h" 20 #include "remoting/protocol/input_stub.h"
23 #include "remoting/protocol/transport_context.h" 21 #include "remoting/protocol/transport_context.h"
24 #include "remoting/protocol/video_frame_pump.h" 22 #include "remoting/protocol/video_frame_pump.h"
25 23
26 namespace remoting { 24 namespace remoting {
27 namespace protocol { 25 namespace protocol {
28 26
29 namespace {
30
31 std::unique_ptr<VideoEncoder> CreateVideoEncoder(
32 const protocol::SessionConfig& config) {
33 const protocol::ChannelConfig& video_config = config.video_config();
34
35 if (video_config.codec == protocol::ChannelConfig::CODEC_VP8) {
36 return VideoEncoderVpx::CreateForVP8();
37 } else if (video_config.codec == protocol::ChannelConfig::CODEC_VP9) {
38 return VideoEncoderVpx::CreateForVP9();
39 } else if (video_config.codec == protocol::ChannelConfig::CODEC_VERBATIM) {
40 return base::WrapUnique(new VideoEncoderVerbatim());
41 }
42
43 NOTREACHED();
44 return nullptr;
45 }
46
47 } // namespace
48
49 IceConnectionToClient::IceConnectionToClient( 27 IceConnectionToClient::IceConnectionToClient(
50 std::unique_ptr<protocol::Session> session, 28 std::unique_ptr<protocol::Session> session,
51 scoped_refptr<TransportContext> transport_context, 29 scoped_refptr<TransportContext> transport_context,
52 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner) 30 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner)
53 : event_handler_(nullptr), 31 : event_handler_(nullptr),
54 session_(std::move(session)), 32 session_(std::move(session)),
55 video_encode_task_runner_(video_encode_task_runner), 33 video_encode_task_runner_(video_encode_task_runner),
56 transport_(transport_context, this), 34 transport_(transport_context, this),
57 control_dispatcher_(new HostControlDispatcher()), 35 control_dispatcher_(new HostControlDispatcher()),
58 event_dispatcher_(new HostEventDispatcher()), 36 event_dispatcher_(new HostEventDispatcher()),
(...skipping 26 matching lines...) Expand all
85 void IceConnectionToClient::OnInputEventReceived(int64_t timestamp) { 63 void IceConnectionToClient::OnInputEventReceived(int64_t timestamp) {
86 DCHECK(thread_checker_.CalledOnValidThread()); 64 DCHECK(thread_checker_.CalledOnValidThread());
87 event_handler_->OnInputEventReceived(this, timestamp); 65 event_handler_->OnInputEventReceived(this, timestamp);
88 } 66 }
89 67
90 std::unique_ptr<VideoStream> IceConnectionToClient::StartVideoStream( 68 std::unique_ptr<VideoStream> IceConnectionToClient::StartVideoStream(
91 std::unique_ptr<webrtc::DesktopCapturer> desktop_capturer) { 69 std::unique_ptr<webrtc::DesktopCapturer> desktop_capturer) {
92 DCHECK(thread_checker_.CalledOnValidThread()); 70 DCHECK(thread_checker_.CalledOnValidThread());
93 71
94 std::unique_ptr<VideoEncoder> video_encoder = 72 std::unique_ptr<VideoEncoder> video_encoder =
95 CreateVideoEncoder(session_->config()); 73 VideoEncoder::Create(session_->config());
96 74
97 std::unique_ptr<VideoFramePump> pump( 75 std::unique_ptr<VideoFramePump> pump(
98 new VideoFramePump(video_encode_task_runner_, std::move(desktop_capturer), 76 new VideoFramePump(video_encode_task_runner_, std::move(desktop_capturer),
99 std::move(video_encoder), video_dispatcher_.get())); 77 std::move(video_encoder), video_dispatcher_.get()));
100 video_dispatcher_->set_video_feedback_stub(pump->video_feedback_stub()); 78 video_dispatcher_->set_video_feedback_stub(pump->video_feedback_stub());
101 return std::move(pump); 79 return std::move(pump);
102 } 80 }
103 81
104 AudioStub* IceConnectionToClient::audio_stub() { 82 AudioStub* IceConnectionToClient::audio_stub() {
105 DCHECK(thread_checker_.CalledOnValidThread()); 83 DCHECK(thread_checker_.CalledOnValidThread());
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 189
212 void IceConnectionToClient::CloseChannels() { 190 void IceConnectionToClient::CloseChannels() {
213 control_dispatcher_.reset(); 191 control_dispatcher_.reset();
214 event_dispatcher_.reset(); 192 event_dispatcher_.reset();
215 video_dispatcher_.reset(); 193 video_dispatcher_.reset();
216 audio_writer_.reset(); 194 audio_writer_.reset();
217 } 195 }
218 196
219 } // namespace protocol 197 } // namespace protocol
220 } // namespace remoting 198 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/fake_connection_to_client.cc ('k') | remoting/protocol/session_config.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698