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

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

Issue 2384063004: Move audio decoding to protocol layer (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/ice_connection_to_host.h" 5 #include "remoting/protocol/ice_connection_to_host.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/location.h" 11 #include "base/location.h"
12 #include "remoting/base/constants.h" 12 #include "remoting/base/constants.h"
13 #include "remoting/protocol/audio_decode_scheduler.h"
13 #include "remoting/protocol/audio_reader.h" 14 #include "remoting/protocol/audio_reader.h"
14 #include "remoting/protocol/audio_stub.h" 15 #include "remoting/protocol/audio_stub.h"
15 #include "remoting/protocol/auth_util.h" 16 #include "remoting/protocol/auth_util.h"
16 #include "remoting/protocol/client_control_dispatcher.h" 17 #include "remoting/protocol/client_control_dispatcher.h"
17 #include "remoting/protocol/client_event_dispatcher.h" 18 #include "remoting/protocol/client_event_dispatcher.h"
18 #include "remoting/protocol/client_stub.h" 19 #include "remoting/protocol/client_stub.h"
19 #include "remoting/protocol/client_video_dispatcher.h" 20 #include "remoting/protocol/client_video_dispatcher.h"
20 #include "remoting/protocol/clipboard_stub.h" 21 #include "remoting/protocol/clipboard_stub.h"
21 #include "remoting/protocol/errors.h" 22 #include "remoting/protocol/errors.h"
22 #include "remoting/protocol/ice_transport.h" 23 #include "remoting/protocol/ice_transport.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 void IceConnectionToHost::set_clipboard_stub(ClipboardStub* clipboard_stub) { 73 void IceConnectionToHost::set_clipboard_stub(ClipboardStub* clipboard_stub) {
73 clipboard_stub_ = clipboard_stub; 74 clipboard_stub_ = clipboard_stub;
74 } 75 }
75 76
76 void IceConnectionToHost::set_video_renderer(VideoRenderer* video_renderer) { 77 void IceConnectionToHost::set_video_renderer(VideoRenderer* video_renderer) {
77 DCHECK(video_renderer); 78 DCHECK(video_renderer);
78 DCHECK(!monitored_video_stub_); 79 DCHECK(!monitored_video_stub_);
79 video_renderer_ = video_renderer; 80 video_renderer_ = video_renderer;
80 } 81 }
81 82
82 void IceConnectionToHost::set_audio_stub(AudioStub* audio_stub) { 83 void IceConnectionToHost::InitializeAudio(
83 audio_stub_ = audio_stub; 84 scoped_refptr<base::SingleThreadTaskRunner> audio_decode_task_runner,
85 base::WeakPtr<AudioStub> audio_stub) {
86 audio_decode_scheduler_.reset(
87 new AudioDecodeScheduler(audio_decode_task_runner, audio_stub));
84 } 88 }
85 89
86 void IceConnectionToHost::OnSessionStateChange(Session::State state) { 90 void IceConnectionToHost::OnSessionStateChange(Session::State state) {
87 DCHECK(CalledOnValidThread()); 91 DCHECK(CalledOnValidThread());
88 DCHECK(event_callback_); 92 DCHECK(event_callback_);
89 93
90 switch (state) { 94 switch (state) {
91 case Session::INITIALIZING: 95 case Session::INITIALIZING:
92 case Session::CONNECTING: 96 case Session::CONNECTING:
93 case Session::ACCEPTING: 97 case Session::ACCEPTING:
(...skipping 23 matching lines...) Expand all
117 base::TimeDelta::FromSeconds( 121 base::TimeDelta::FromSeconds(
118 MonitoredVideoStub::kConnectivityCheckDelaySeconds), 122 MonitoredVideoStub::kConnectivityCheckDelaySeconds),
119 base::Bind(&IceConnectionToHost::OnVideoChannelStatus, 123 base::Bind(&IceConnectionToHost::OnVideoChannelStatus,
120 base::Unretained(this)))); 124 base::Unretained(this))));
121 video_dispatcher_.reset( 125 video_dispatcher_.reset(
122 new ClientVideoDispatcher(monitored_video_stub_.get(), client_stub_)); 126 new ClientVideoDispatcher(monitored_video_stub_.get(), client_stub_));
123 video_dispatcher_->Init(transport_->GetChannelFactory(), this); 127 video_dispatcher_->Init(transport_->GetChannelFactory(), this);
124 128
125 // Configure audio pipeline if necessary. 129 // Configure audio pipeline if necessary.
126 if (session_->config().is_audio_enabled()) { 130 if (session_->config().is_audio_enabled()) {
127 audio_reader_.reset(new AudioReader(audio_stub_)); 131 audio_reader_.reset(new AudioReader(audio_decode_scheduler_.get()));
128 audio_reader_->Init(transport_->GetMultiplexedChannelFactory(), this); 132 audio_reader_->Init(transport_->GetMultiplexedChannelFactory(), this);
133 audio_decode_scheduler_->Initialize(session_->config());
129 } 134 }
130 break; 135 break;
131 136
132 case Session::CLOSED: 137 case Session::CLOSED:
133 CloseChannels(); 138 CloseChannels();
134 SetState(CLOSED, OK); 139 SetState(CLOSED, OK);
135 break; 140 break;
136 141
137 case Session::FAILED: 142 case Session::FAILED:
138 // If we were connected then treat signaling timeout error as if 143 // If we were connected then treat signaling timeout error as if
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 223
219 if (state != state_) { 224 if (state != state_) {
220 state_ = state; 225 state_ = state;
221 error_ = error; 226 error_ = error;
222 event_callback_->OnConnectionState(state_, error_); 227 event_callback_->OnConnectionState(state_, error_);
223 } 228 }
224 } 229 }
225 230
226 } // namespace protocol 231 } // namespace protocol
227 } // namespace remoting 232 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698