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

Side by Side Diff: media/audio/pulse/audio_manager_pulse.cc

Issue 2538793002: Log audio system used to WebRTC log. (Closed)
Patch Set: Code review. Created 4 years 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
OLDNEW
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 30 matching lines...) Expand all
41 static const int kMaximumOutputBufferSize = 8192; 41 static const int kMaximumOutputBufferSize = 8192;
42 42
43 // Default input buffer size. 43 // Default input buffer size.
44 static const int kDefaultInputBufferSize = 1024; 44 static const int kDefaultInputBufferSize = 1024;
45 45
46 #if defined(DLOPEN_PULSEAUDIO) 46 #if defined(DLOPEN_PULSEAUDIO)
47 static const base::FilePath::CharType kPulseLib[] = 47 static const base::FilePath::CharType kPulseLib[] =
48 FILE_PATH_LITERAL("libpulse.so.0"); 48 FILE_PATH_LITERAL("libpulse.so.0");
49 #endif 49 #endif
50 50
51 namespace {
52 const char kAudioManagerName[] = "PulseAudio";
53 }
54
51 AudioManagerPulse::AudioManagerPulse( 55 AudioManagerPulse::AudioManagerPulse(
52 scoped_refptr<base::SingleThreadTaskRunner> task_runner, 56 scoped_refptr<base::SingleThreadTaskRunner> task_runner,
53 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner, 57 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner,
54 AudioLogFactory* audio_log_factory) 58 AudioLogFactory* audio_log_factory)
55 : AudioManagerBase(std::move(task_runner), 59 : AudioManagerBase(std::move(task_runner),
56 std::move(worker_task_runner), 60 std::move(worker_task_runner),
57 audio_log_factory), 61 audio_log_factory),
58 input_mainloop_(NULL), 62 input_mainloop_(NULL),
59 input_context_(NULL), 63 input_context_(NULL),
60 devices_(NULL), 64 devices_(NULL),
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 int buffer_size = user_buffer_size ? 140 int buffer_size = user_buffer_size ?
137 user_buffer_size : kDefaultInputBufferSize; 141 user_buffer_size : kDefaultInputBufferSize;
138 142
139 // TODO(xians): add support for querying native channel layout for pulse. 143 // TODO(xians): add support for querying native channel layout for pulse.
140 UpdateNativeAudioHardwareInfo(); 144 UpdateNativeAudioHardwareInfo();
141 return AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, 145 return AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
142 CHANNEL_LAYOUT_STEREO, native_input_sample_rate_, 16, 146 CHANNEL_LAYOUT_STEREO, native_input_sample_rate_, 16,
143 buffer_size); 147 buffer_size);
144 } 148 }
145 149
150 const char* AudioManagerPulse::GetName() {
151 return kAudioManagerName;
152 }
153
146 AudioOutputStream* AudioManagerPulse::MakeLinearOutputStream( 154 AudioOutputStream* AudioManagerPulse::MakeLinearOutputStream(
147 const AudioParameters& params, 155 const AudioParameters& params,
148 const LogCallback& log_callback) { 156 const LogCallback& log_callback) {
149 DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format()); 157 DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format());
150 return MakeOutputStream(params, AudioDeviceDescription::kDefaultDeviceId); 158 return MakeOutputStream(params, AudioDeviceDescription::kDefaultDeviceId);
151 } 159 }
152 160
153 AudioOutputStream* AudioManagerPulse::MakeLowLatencyOutputStream( 161 AudioOutputStream* AudioManagerPulse::MakeLowLatencyOutputStream(
154 const AudioParameters& params, 162 const AudioParameters& params,
155 const std::string& device_id, 163 const std::string& device_id,
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 const pa_server_info* info, 353 const pa_server_info* info,
346 void* user_data) { 354 void* user_data) {
347 AudioManagerPulse* manager = reinterpret_cast<AudioManagerPulse*>(user_data); 355 AudioManagerPulse* manager = reinterpret_cast<AudioManagerPulse*>(user_data);
348 356
349 manager->native_input_sample_rate_ = info->sample_spec.rate; 357 manager->native_input_sample_rate_ = info->sample_spec.rate;
350 manager->native_channel_count_ = info->sample_spec.channels; 358 manager->native_channel_count_ = info->sample_spec.channels;
351 pa_threaded_mainloop_signal(manager->input_mainloop_, 0); 359 pa_threaded_mainloop_signal(manager->input_mainloop_, 0);
352 } 360 }
353 361
354 } // namespace media 362 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698