OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_pulse.h" | 5 #include "chrome/browser/chromeos/audio_mixer_pulse.h" |
6 | 6 |
7 #include <pulse/pulseaudio.h> | 7 #include <pulse/pulseaudio.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
11 #include "base/task.h" | 11 #include "base/task.h" |
12 #include "base/threading/thread_restrictions.h" | 12 #include "base/threading/thread_restrictions.h" |
13 #include "chrome/browser/browser_thread.h" | 13 #include "content/browser/browser_thread.h" |
14 | 14 |
15 namespace chromeos { | 15 namespace chromeos { |
16 | 16 |
17 // Using asynchronous versions of the threaded PulseAudio API, as well | 17 // Using asynchronous versions of the threaded PulseAudio API, as well |
18 // as a worker thread so gets, sets, and the init sequence do not block the | 18 // as a worker thread so gets, sets, and the init sequence do not block the |
19 // calling thread. GetVolume() and IsMute() can still be called synchronously | 19 // calling thread. GetVolume() and IsMute() can still be called synchronously |
20 // if needed, but take a bit longer (~2ms vs ~0.3ms). | 20 // if needed, but take a bit longer (~2ms vs ~0.3ms). |
21 // | 21 // |
22 // Set calls just return without waiting. If you must guarantee the value has | 22 // Set calls just return without waiting. If you must guarantee the value has |
23 // been set before continuing, immediately call the blocking Get version to | 23 // been set before continuing, immediately call the blocking Get version to |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 if (mixer_state_ != READY) | 479 if (mixer_state_ != READY) |
480 return false; | 480 return false; |
481 if (!pa_mainloop_) | 481 if (!pa_mainloop_) |
482 return false; | 482 return false; |
483 pa_threaded_mainloop_lock(pa_mainloop_); | 483 pa_threaded_mainloop_lock(pa_mainloop_); |
484 ++mainloop_lock_count_; | 484 ++mainloop_lock_count_; |
485 return true; | 485 return true; |
486 } | 486 } |
487 | 487 |
488 } // namespace chromeos | 488 } // namespace chromeos |
OLD | NEW |