| 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 "media/audio/pulse/audio_manager_pulse.h" | 5 #include "media/audio/pulse/audio_manager_pulse.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/environment.h" | 8 #include "base/environment.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 // Maximum number of output streams that can be open simultaneously. | 35 // Maximum number of output streams that can be open simultaneously. |
| 36 static const int kMaxOutputStreams = 50; | 36 static const int kMaxOutputStreams = 50; |
| 37 | 37 |
| 38 // Define bounds for the output buffer size. | 38 // Define bounds for the output buffer size. |
| 39 static const int kMinimumOutputBufferSize = 512; | 39 static const int kMinimumOutputBufferSize = 512; |
| 40 static const int kMaximumOutputBufferSize = 8192; | 40 static const int kMaximumOutputBufferSize = 8192; |
| 41 | 41 |
| 42 // Default input buffer size. | 42 // Default input buffer size. |
| 43 static const int kDefaultInputBufferSize = 1024; | 43 static const int kDefaultInputBufferSize = 1024; |
| 44 | 44 |
| 45 #if defined(DLOPEN_PULSEAUDIO) |
| 45 static const base::FilePath::CharType kPulseLib[] = | 46 static const base::FilePath::CharType kPulseLib[] = |
| 46 FILE_PATH_LITERAL("libpulse.so.0"); | 47 FILE_PATH_LITERAL("libpulse.so.0"); |
| 48 #endif |
| 47 | 49 |
| 48 // static | 50 // static |
| 49 AudioManager* AudioManagerPulse::Create(AudioLogFactory* audio_log_factory) { | 51 AudioManager* AudioManagerPulse::Create(AudioLogFactory* audio_log_factory) { |
| 50 scoped_ptr<AudioManagerPulse> ret(new AudioManagerPulse(audio_log_factory)); | 52 scoped_ptr<AudioManagerPulse> ret(new AudioManagerPulse(audio_log_factory)); |
| 51 if (ret->Init()) | 53 if (ret->Init()) |
| 52 return ret.release(); | 54 return ret.release(); |
| 53 | 55 |
| 54 DVLOG(1) << "PulseAudio is not available on the OS"; | 56 DVLOG(1) << "PulseAudio is not available on the OS"; |
| 55 return NULL; | 57 return NULL; |
| 56 } | 58 } |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 void AudioManagerPulse::SampleRateInfoCallback(pa_context* context, | 335 void AudioManagerPulse::SampleRateInfoCallback(pa_context* context, |
| 334 const pa_server_info* info, | 336 const pa_server_info* info, |
| 335 void* user_data) { | 337 void* user_data) { |
| 336 AudioManagerPulse* manager = reinterpret_cast<AudioManagerPulse*>(user_data); | 338 AudioManagerPulse* manager = reinterpret_cast<AudioManagerPulse*>(user_data); |
| 337 | 339 |
| 338 manager->native_input_sample_rate_ = info->sample_spec.rate; | 340 manager->native_input_sample_rate_ = info->sample_spec.rate; |
| 339 pa_threaded_mainloop_signal(manager->input_mainloop_, 0); | 341 pa_threaded_mainloop_signal(manager->input_mainloop_, 0); |
| 340 } | 342 } |
| 341 | 343 |
| 342 } // namespace media | 344 } // namespace media |
| OLD | NEW |