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/fake_connection_to_client.h" | 5 #include "remoting/protocol/fake_connection_to_client.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
| 9 #include "remoting/codec/video_encoder.h" |
9 #include "remoting/protocol/session.h" | 10 #include "remoting/protocol/session.h" |
| 11 #include "remoting/protocol/video_frame_pump.h" |
10 #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h" | 12 #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h" |
11 | 13 |
12 namespace remoting { | 14 namespace remoting { |
13 namespace protocol { | 15 namespace protocol { |
14 | 16 |
15 FakeVideoStream::FakeVideoStream() : weak_factory_(this) {} | 17 FakeVideoStream::FakeVideoStream() : weak_factory_(this) {} |
16 FakeVideoStream::~FakeVideoStream() {} | 18 FakeVideoStream::~FakeVideoStream() {} |
17 | 19 |
18 void FakeVideoStream::Pause(bool pause) {} | 20 void FakeVideoStream::Pause(bool pause) {} |
19 | 21 |
(...skipping 15 matching lines...) Expand all Loading... |
35 : session_(std::move(session)) {} | 37 : session_(std::move(session)) {} |
36 | 38 |
37 FakeConnectionToClient::~FakeConnectionToClient() {} | 39 FakeConnectionToClient::~FakeConnectionToClient() {} |
38 | 40 |
39 void FakeConnectionToClient::SetEventHandler(EventHandler* event_handler) { | 41 void FakeConnectionToClient::SetEventHandler(EventHandler* event_handler) { |
40 event_handler_ = event_handler; | 42 event_handler_ = event_handler; |
41 } | 43 } |
42 | 44 |
43 std::unique_ptr<VideoStream> FakeConnectionToClient::StartVideoStream( | 45 std::unique_ptr<VideoStream> FakeConnectionToClient::StartVideoStream( |
44 std::unique_ptr<webrtc::DesktopCapturer> desktop_capturer) { | 46 std::unique_ptr<webrtc::DesktopCapturer> desktop_capturer) { |
| 47 if (video_stub_ && video_encode_task_runner_) { |
| 48 std::unique_ptr<VideoEncoder> video_encoder = |
| 49 VideoEncoder::Create(session_->config()); |
| 50 |
| 51 std::unique_ptr<protocol::VideoFramePump> pump( |
| 52 new protocol::VideoFramePump(video_encode_task_runner_, |
| 53 std::move(desktop_capturer), |
| 54 std::move(video_encoder), |
| 55 video_stub_)); |
| 56 video_feedback_stub_ = pump->video_feedback_stub(); |
| 57 return std::move(pump); |
| 58 } |
| 59 |
45 std::unique_ptr<FakeVideoStream> result(new FakeVideoStream()); | 60 std::unique_ptr<FakeVideoStream> result(new FakeVideoStream()); |
46 last_video_stream_ = result->GetWeakPtr(); | 61 last_video_stream_ = result->GetWeakPtr(); |
47 return std::move(result); | 62 return std::move(result); |
48 } | 63 } |
49 | 64 |
50 AudioStub* FakeConnectionToClient::audio_stub() { | 65 AudioStub* FakeConnectionToClient::audio_stub() { |
51 return audio_stub_; | 66 return audio_stub_; |
52 } | 67 } |
53 | 68 |
54 ClientStub* FakeConnectionToClient::client_stub() { | 69 ClientStub* FakeConnectionToClient::client_stub() { |
(...skipping 22 matching lines...) Expand all Loading... |
77 void FakeConnectionToClient::set_host_stub(HostStub* host_stub) { | 92 void FakeConnectionToClient::set_host_stub(HostStub* host_stub) { |
78 host_stub_ = host_stub; | 93 host_stub_ = host_stub; |
79 } | 94 } |
80 | 95 |
81 void FakeConnectionToClient::set_input_stub(InputStub* input_stub) { | 96 void FakeConnectionToClient::set_input_stub(InputStub* input_stub) { |
82 input_stub_ = input_stub; | 97 input_stub_ = input_stub; |
83 } | 98 } |
84 | 99 |
85 } // namespace protocol | 100 } // namespace protocol |
86 } // namespace remoting | 101 } // namespace remoting |
OLD | NEW |