OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/client/chromoting_client.h" | 5 #include "remoting/client/chromoting_client.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "remoting/client/audio_player.h" | 8 #include "remoting/client/audio_player.h" |
9 #include "remoting/client/client_context.h" | 9 #include "remoting/client/client_context.h" |
10 #include "remoting/client/client_user_interface.h" | 10 #include "remoting/client/client_user_interface.h" |
11 #include "remoting/client/rectangle_update_decoder.h" | 11 #include "remoting/client/rectangle_update_decoder.h" |
12 #include "remoting/codec/audio_decoder.h" | |
12 #include "remoting/proto/audio.pb.h" | 13 #include "remoting/proto/audio.pb.h" |
13 #include "remoting/proto/video.pb.h" | 14 #include "remoting/proto/video.pb.h" |
14 #include "remoting/protocol/authentication_method.h" | 15 #include "remoting/protocol/authentication_method.h" |
15 #include "remoting/protocol/connection_to_host.h" | 16 #include "remoting/protocol/connection_to_host.h" |
16 #include "remoting/protocol/negotiating_authenticator.h" | 17 #include "remoting/protocol/negotiating_authenticator.h" |
17 #include "remoting/protocol/session_config.h" | 18 #include "remoting/protocol/session_config.h" |
18 #include "remoting/protocol/transport.h" | 19 #include "remoting/protocol/transport.h" |
19 | 20 |
20 namespace remoting { | 21 namespace remoting { |
21 | 22 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
136 DispatchPacket(); | 137 DispatchPacket(); |
137 } | 138 } |
138 | 139 |
139 int ChromotingClient::GetPendingVideoPackets() { | 140 int ChromotingClient::GetPendingVideoPackets() { |
140 DCHECK(task_runner_->BelongsToCurrentThread()); | 141 DCHECK(task_runner_->BelongsToCurrentThread()); |
141 return received_packets_.size(); | 142 return received_packets_.size(); |
142 } | 143 } |
143 | 144 |
144 void ChromotingClient::ProcessAudioPacket(scoped_ptr<AudioPacket> packet, | 145 void ChromotingClient::ProcessAudioPacket(scoped_ptr<AudioPacket> packet, |
145 const base::Closure& done) { | 146 const base::Closure& done) { |
146 audio_player_->ProcessAudioPacket(packet.Pass()); | 147 scoped_ptr<AudioPacket> decoded_packet = |
Sergey Ulanov
2012/08/01 17:43:54
Add DCHECK to verify that this method is called on
kxing
2012/08/01 22:15:38
Done.
| |
148 audio_decoder_->Decode(packet.Pass()); | |
Sergey Ulanov
2012/08/01 17:43:54
We shouldn't be decoding audio on the main plugin
kxing
2012/08/01 22:15:38
Done.
| |
149 audio_player_->ProcessAudioPacket(decoded_packet.Pass()); | |
147 done.Run(); | 150 done.Run(); |
148 } | 151 } |
149 | 152 |
150 void ChromotingClient::DispatchPacket() { | 153 void ChromotingClient::DispatchPacket() { |
151 DCHECK(task_runner_->BelongsToCurrentThread()); | 154 DCHECK(task_runner_->BelongsToCurrentThread()); |
152 CHECK(!packet_being_processed_); | 155 CHECK(!packet_being_processed_); |
153 | 156 |
154 if (received_packets_.empty()) { | 157 if (received_packets_.empty()) { |
155 // Nothing to do! | 158 // Nothing to do! |
156 return; | 159 return; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
210 | 213 |
211 // Process the next video packet. | 214 // Process the next video packet. |
212 DispatchPacket(); | 215 DispatchPacket(); |
213 } | 216 } |
214 | 217 |
215 void ChromotingClient::Initialize() { | 218 void ChromotingClient::Initialize() { |
216 DCHECK(task_runner_->BelongsToCurrentThread()); | 219 DCHECK(task_runner_->BelongsToCurrentThread()); |
217 | 220 |
218 // Initialize the decoder. | 221 // Initialize the decoder. |
219 rectangle_decoder_->Initialize(connection_->config()); | 222 rectangle_decoder_->Initialize(connection_->config()); |
223 if (connection_->config().is_audio_enabled()) { | |
224 audio_decoder_.reset( | |
225 AudioDecoder::CreateAudioDecoder(connection_->config()).release()); | |
226 } | |
220 } | 227 } |
221 | 228 |
222 } // namespace remoting | 229 } // namespace remoting |
OLD | NEW |