OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/notifications/notification_audio_controller.h" | 5 #include "chrome/browser/notifications/notification_audio_controller.h" |
6 | 6 |
7 #include <cstring> | 7 #include <cstring> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 format, | 244 format, |
245 media::GuessChannelLayout(wav_audio_.num_channels()), | 245 media::GuessChannelLayout(wav_audio_.num_channels()), |
246 wav_audio_.num_channels(), | 246 wav_audio_.num_channels(), |
247 wav_audio_.sample_rate(), | 247 wav_audio_.sample_rate(), |
248 wav_audio_.bits_per_sample(), | 248 wav_audio_.bits_per_sample(), |
249 kFramesPerBuffer); | 249 kFramesPerBuffer); |
250 | 250 |
251 if (!params.IsValid()) | 251 if (!params.IsValid()) |
252 return false; | 252 return false; |
253 | 253 |
254 stream_ = audio_manager_->MakeAudioOutputStreamProxy(params); | 254 stream_ = audio_manager_->MakeAudioOutputStreamProxy(params, std::string()); |
255 if (!stream_->Open()) { | 255 if (!stream_->Open()) { |
256 DLOG(ERROR) << "Failed to open the output stream"; | 256 DLOG(ERROR) << "Failed to open the output stream"; |
257 stream_->Close(); | 257 stream_->Close(); |
258 return false; | 258 return false; |
259 } | 259 } |
260 | 260 |
261 stop_playing_sound_.Reset(base::Bind( | 261 stop_playing_sound_.Reset(base::Bind( |
262 &AudioHandler::StopPlayingSound, base::Unretained(this))); | 262 &AudioHandler::StopPlayingSound, base::Unretained(this))); |
263 stream_->Start(this); | 263 stream_->Start(this); |
264 return true; | 264 return true; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 while (!audio_handlers_.empty()) | 384 while (!audio_handlers_.empty()) |
385 audio_handlers_[0]->StopPlayingSound(); | 385 audio_handlers_[0]->StopPlayingSound(); |
386 | 386 |
387 delete this; | 387 delete this; |
388 } | 388 } |
389 | 389 |
390 size_t NotificationAudioController::GetAudioHandlersSizeCallback() { | 390 size_t NotificationAudioController::GetAudioHandlersSizeCallback() { |
391 DCHECK(message_loop_->BelongsToCurrentThread()); | 391 DCHECK(message_loop_->BelongsToCurrentThread()); |
392 return audio_handlers_.size(); | 392 return audio_handlers_.size(); |
393 } | 393 } |
OLD | NEW |