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

Side by Side Diff: chrome/browser/chromeos/audio_mixer_alsa.cc

Issue 8511026: Don't start speech synthesis until after the audio mixer is initialized. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/chromeos/audio_mixer_alsa.h" 5 #include "chrome/browser/chromeos/audio_mixer_alsa.h"
6 6
7 #include <unistd.h> 7 #include <unistd.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
11 11
12 #include <alsa/asoundlib.h> 12 #include <alsa/asoundlib.h>
13 13
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/message_loop.h" 15 #include "base/message_loop.h"
16 #include "base/task.h" 16 #include "base/task.h"
17 #include "base/threading/thread.h" 17 #include "base/threading/thread.h"
18 #include "base/threading/thread_restrictions.h" 18 #include "base/threading/thread_restrictions.h"
19 #include "chrome/browser/browser_process.h" 19 #include "chrome/browser/browser_process.h"
20 #include "chrome/browser/extensions/extension_tts_api_chromeos.h"
20 #include "chrome/browser/prefs/pref_service.h" 21 #include "chrome/browser/prefs/pref_service.h"
21 #include "chrome/common/pref_names.h" 22 #include "chrome/common/pref_names.h"
22 #include "content/public/browser/browser_thread.h" 23 #include "content/public/browser/browser_thread.h"
23 24
24 typedef long alsa_long_t; // 'long' is required for ALSA API calls. 25 typedef long alsa_long_t; // 'long' is required for ALSA API calls.
25 26
26 using content::BrowserThread; 27 using content::BrowserThread;
27 using std::max; 28 using std::max;
28 using std::min; 29 using std::min;
29 using std::string; 30 using std::string;
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 { 296 {
296 base::AutoLock lock(lock_); 297 base::AutoLock lock(lock_);
297 alsa_mixer_ = handle; 298 alsa_mixer_ = handle;
298 master_element_ = master_element; 299 master_element_ = master_element;
299 pcm_element_ = pcm_element; 300 pcm_element_ = pcm_element;
300 min_volume_db_ = min_volume_db; 301 min_volume_db_ = min_volume_db;
301 max_volume_db_ = max_volume_db; 302 max_volume_db_ = max_volume_db;
302 volume_db_ = min(max(volume_db_, min_volume_db_), max_volume_db_); 303 volume_db_ = min(max(volume_db_, min_volume_db_), max_volume_db_);
303 } 304 }
304 305
306 // The speech synthesis service shouldn't be initialized until after
307 // we get to this point, so we call this function to tell it that it's
308 // safe to do TTS now. NotificationService would be cleaner,
309 // but it's not available at this point.
310 EnableChromeOsTts();
311
305 ApplyState(); 312 ApplyState();
306 return true; 313 return true;
307 } 314 }
308 315
309 void AudioMixerAlsa::Disconnect() { 316 void AudioMixerAlsa::Disconnect() {
310 DCHECK(MessageLoop::current() == thread_->message_loop()); 317 DCHECK(MessageLoop::current() == thread_->message_loop());
311 if (alsa_mixer_) { 318 if (alsa_mixer_) {
312 snd_mixer_close(alsa_mixer_); 319 snd_mixer_close(alsa_mixer_);
313 alsa_mixer_ = NULL; 320 alsa_mixer_ = NULL;
314 } 321 }
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 if (alsa_result != 0) { 447 if (alsa_result != 0) {
441 LOG(WARNING) << "snd_mixer_selem_set_playback_switch_all() failed: " 448 LOG(WARNING) << "snd_mixer_selem_set_playback_switch_all() failed: "
442 << snd_strerror(alsa_result); 449 << snd_strerror(alsa_result);
443 } else { 450 } else {
444 VLOG(1) << "Set playback switch " << snd_mixer_selem_get_name(element) 451 VLOG(1) << "Set playback switch " << snd_mixer_selem_get_name(element)
445 << " to " << mute; 452 << " to " << mute;
446 } 453 }
447 } 454 }
448 455
449 } // namespace chromeos 456 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/accessibility_util.cc ('k') | chrome/browser/chromeos/login/wizard_accessibility_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698