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/ice_connection_to_client.h" | 5 #include "remoting/protocol/ice_connection_to_client.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "net/base/io_buffer.h" | 9 #include "net/base/io_buffer.h" |
10 #include "remoting/codec/video_encoder.h" | 10 #include "remoting/codec/video_encoder.h" |
(...skipping 11 matching lines...) Expand all Loading... | |
22 namespace remoting { | 22 namespace remoting { |
23 namespace protocol { | 23 namespace protocol { |
24 | 24 |
25 namespace { | 25 namespace { |
26 | 26 |
27 scoped_ptr<VideoEncoder> CreateVideoEncoder( | 27 scoped_ptr<VideoEncoder> CreateVideoEncoder( |
28 const protocol::SessionConfig& config) { | 28 const protocol::SessionConfig& config) { |
29 const protocol::ChannelConfig& video_config = config.video_config(); | 29 const protocol::ChannelConfig& video_config = config.video_config(); |
30 | 30 |
31 if (video_config.codec == protocol::ChannelConfig::CODEC_VP8) { | 31 if (video_config.codec == protocol::ChannelConfig::CODEC_VP8) { |
32 return VideoEncoderVpx::CreateForVP8().Pass(); | 32 return VideoEncoderVpx::CreateForVP8(); |
33 } else if (video_config.codec == protocol::ChannelConfig::CODEC_VP9) { | 33 } else if (video_config.codec == protocol::ChannelConfig::CODEC_VP9) { |
34 return VideoEncoderVpx::CreateForVP9().Pass(); | 34 return VideoEncoderVpx::CreateForVP9(); |
35 } else if (video_config.codec == protocol::ChannelConfig::CODEC_VERBATIM) { | 35 } else if (video_config.codec == protocol::ChannelConfig::CODEC_VERBATIM) { |
36 return make_scoped_ptr(new VideoEncoderVerbatim()); | 36 return make_scoped_ptr(new VideoEncoderVerbatim()); |
37 } | 37 } |
38 | 38 |
39 NOTREACHED(); | 39 NOTREACHED(); |
40 return nullptr; | 40 return nullptr; |
41 } | 41 } |
42 | 42 |
43 } // namespace | 43 } // namespace |
44 | 44 |
45 IceConnectionToClient::IceConnectionToClient( | 45 IceConnectionToClient::IceConnectionToClient( |
46 scoped_ptr<protocol::Session> session, | 46 scoped_ptr<protocol::Session> session, |
47 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner) | 47 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner) |
48 : event_handler_(nullptr), | 48 : event_handler_(nullptr), |
49 session_(session.Pass()), | 49 session_(std::move(session)), |
50 video_encode_task_runner_(video_encode_task_runner), | 50 video_encode_task_runner_(video_encode_task_runner), |
51 control_dispatcher_(new HostControlDispatcher()), | 51 control_dispatcher_(new HostControlDispatcher()), |
52 event_dispatcher_(new HostEventDispatcher()), | 52 event_dispatcher_(new HostEventDispatcher()), |
53 video_dispatcher_(new HostVideoDispatcher()) { | 53 video_dispatcher_(new HostVideoDispatcher()) { |
54 session_->SetEventHandler(this); | 54 session_->SetEventHandler(this); |
55 } | 55 } |
56 | 56 |
57 IceConnectionToClient::~IceConnectionToClient() {} | 57 IceConnectionToClient::~IceConnectionToClient() {} |
58 | 58 |
59 void IceConnectionToClient::SetEventHandler( | 59 void IceConnectionToClient::SetEventHandler( |
(...skipping 25 matching lines...) Expand all Loading... | |
85 scoped_ptr<VideoStream> IceConnectionToClient::StartVideoStream( | 85 scoped_ptr<VideoStream> IceConnectionToClient::StartVideoStream( |
86 scoped_ptr<webrtc::DesktopCapturer> desktop_capturer) { | 86 scoped_ptr<webrtc::DesktopCapturer> desktop_capturer) { |
87 DCHECK(thread_checker_.CalledOnValidThread()); | 87 DCHECK(thread_checker_.CalledOnValidThread()); |
88 | 88 |
89 scoped_ptr<VideoEncoder> video_encoder = | 89 scoped_ptr<VideoEncoder> video_encoder = |
90 CreateVideoEncoder(session_->config()); | 90 CreateVideoEncoder(session_->config()); |
91 event_handler_->OnCreateVideoEncoder(&video_encoder); | 91 event_handler_->OnCreateVideoEncoder(&video_encoder); |
92 DCHECK(video_encoder); | 92 DCHECK(video_encoder); |
93 | 93 |
94 scoped_ptr<VideoFramePump> pump( | 94 scoped_ptr<VideoFramePump> pump( |
95 new VideoFramePump(video_encode_task_runner_, desktop_capturer.Pass(), | 95 new VideoFramePump(video_encode_task_runner_, std::move(desktop_capturer), |
96 video_encoder.Pass(), video_dispatcher_.get())); | 96 std::move(video_encoder), video_dispatcher_.get())); |
97 video_dispatcher_->set_video_feedback_stub(pump->video_feedback_stub()); | 97 video_dispatcher_->set_video_feedback_stub(pump->video_feedback_stub()); |
98 return pump.Pass(); | 98 return std::move(pump); |
Jamie
2015/12/22 12:23:36
Unnecessary?
Sergey Ulanov
2015/12/22 18:07:35
Upcasting to VideoStream.
BTW the compiler (at le
| |
99 } | 99 } |
100 | 100 |
101 AudioStub* IceConnectionToClient::audio_stub() { | 101 AudioStub* IceConnectionToClient::audio_stub() { |
102 DCHECK(thread_checker_.CalledOnValidThread()); | 102 DCHECK(thread_checker_.CalledOnValidThread()); |
103 return audio_writer_.get(); | 103 return audio_writer_.get(); |
104 } | 104 } |
105 | 105 |
106 // Return pointer to ClientStub. | 106 // Return pointer to ClientStub. |
107 ClientStub* IceConnectionToClient::client_stub() { | 107 ClientStub* IceConnectionToClient::client_stub() { |
108 DCHECK(thread_checker_.CalledOnValidThread()); | 108 DCHECK(thread_checker_.CalledOnValidThread()); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
221 | 221 |
222 void IceConnectionToClient::CloseChannels() { | 222 void IceConnectionToClient::CloseChannels() { |
223 control_dispatcher_.reset(); | 223 control_dispatcher_.reset(); |
224 event_dispatcher_.reset(); | 224 event_dispatcher_.reset(); |
225 video_dispatcher_.reset(); | 225 video_dispatcher_.reset(); |
226 audio_writer_.reset(); | 226 audio_writer_.reset(); |
227 } | 227 } |
228 | 228 |
229 } // namespace protocol | 229 } // namespace protocol |
230 } // namespace remoting | 230 } // namespace remoting |
OLD | NEW |