diff options
author | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-07 15:26:05 +0000 |
---|---|---|
committer | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-07 15:26:05 +0000 |
commit | 2770c95a50db703c322d65d286aa5771e58ac25a (patch) | |
tree | 595b2adf92be75f65eccbbb0760e3969d2d840c3 /media/audio/linux | |
parent | eac3ba4f0f315bb2c68289062cb9f4f5ec632f90 (diff) | |
download | chromium_src-2770c95a50db703c322d65d286aa5771e58ac25a.zip chromium_src-2770c95a50db703c322d65d286aa5771e58ac25a.tar.gz chromium_src-2770c95a50db703c322d65d286aa5771e58ac25a.tar.bz2 |
Cleaning up src/media to be consistent with static versus anonymous namespaces.
We were using a mix of both (and sometimes even static functions *inside* anonymous namespaces!) so we decided to stick to using static.
Also moved static/test code into media namespace and removed media:: prefixes.
BUG=none
TEST=compiles
Review URL: http://codereview.chromium.org/6628020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77135 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/audio/linux')
-rw-r--r-- | media/audio/linux/alsa_input.cc | 14 | ||||
-rw-r--r-- | media/audio/linux/alsa_output.cc | 30 | ||||
-rw-r--r-- | media/audio/linux/alsa_util.cc | 22 | ||||
-rw-r--r-- | media/audio/linux/audio_manager_linux.cc | 10 |
4 files changed, 29 insertions, 47 deletions
diff --git a/media/audio/linux/alsa_input.cc b/media/audio/linux/alsa_input.cc index afc37d6..02b6fd3 100644 --- a/media/audio/linux/alsa_input.cc +++ b/media/audio/linux/alsa_input.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -11,17 +11,13 @@ #include "media/audio/linux/alsa_util.h" #include "media/audio/linux/alsa_wrapper.h" -namespace { - -const int kNumPacketsInRingBuffer = 3; +static const int kNumPacketsInRingBuffer = 3; // If a read failed with no audio data, try again after this duration. -const int kNoAudioReadAgainTimeoutMs = 20; - -const char kDefaultDevice1[] = "default"; -const char kDefaultDevice2[] = "plug:default"; +static const int kNoAudioReadAgainTimeoutMs = 20; -} // namespace +static const char kDefaultDevice1[] = "default"; +static const char kDefaultDevice2[] = "plug:default"; const char* AlsaPcmInputStream::kAutoSelectDevice = ""; diff --git a/media/audio/linux/alsa_output.cc b/media/audio/linux/alsa_output.cc index 338ff08..d8e502c 100644 --- a/media/audio/linux/alsa_output.cc +++ b/media/audio/linux/alsa_output.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -105,20 +105,9 @@ static const int kPcmRecoverIsSilent = 1; static const int kPcmRecoverIsSilent = 0; #endif -const char AlsaPcmOutputStream::kDefaultDevice[] = "default"; -const char AlsaPcmOutputStream::kAutoSelectDevice[] = ""; -const char AlsaPcmOutputStream::kPlugPrefix[] = "plug:"; - -// Since we expect to only be able to wake up with a resolution of -// kSleepErrorMilliseconds, double that for our minimum required latency. -const uint32 AlsaPcmOutputStream::kMinLatencyMicros = - kSleepErrorMilliseconds * 2 * 1000; - -namespace { - // ALSA is currently limited to 48Khz. // TODO(fbarchard): Resample audio from higher frequency to 48000. -const int kAlsaMaxSampleRate = 48000; +static const int kAlsaMaxSampleRate = 48000; // While the "default" device may support multi-channel audio, in Alsa, only // the device names surround40, surround41, surround50, etc, have a defined @@ -137,7 +126,7 @@ const int kAlsaMaxSampleRate = 48000; // TODO(ajwong): The source data should have enough info to tell us if we want // surround41 versus surround51, etc., instead of needing us to guess base don // channel number. Fix API to pass that data down. -const char* GuessSpecificDeviceName(uint32 channels) { +static const char* GuessSpecificDeviceName(uint32 channels) { switch (channels) { case 8: return "surround71"; @@ -190,10 +179,6 @@ static void Swizzle51Layout(Format* b, uint32 filled) { } } -} // namespace - -// Not in an anonymous namespace so that it can be a friend to -// AlsaPcmOutputStream. std::ostream& operator<<(std::ostream& os, AlsaPcmOutputStream::InternalState state) { switch (state) { @@ -219,6 +204,15 @@ std::ostream& operator<<(std::ostream& os, return os; } +const char AlsaPcmOutputStream::kDefaultDevice[] = "default"; +const char AlsaPcmOutputStream::kAutoSelectDevice[] = ""; +const char AlsaPcmOutputStream::kPlugPrefix[] = "plug:"; + +// Since we expect to only be able to wake up with a resolution of +// kSleepErrorMilliseconds, double that for our minimum required latency. +const uint32 AlsaPcmOutputStream::kMinLatencyMicros = + kSleepErrorMilliseconds * 2 * 1000; + AlsaPcmOutputStream::AlsaPcmOutputStream(const std::string& device_name, AudioParameters params, AlsaWrapper* wrapper, diff --git a/media/audio/linux/alsa_util.cc b/media/audio/linux/alsa_util.cc index 27d0fc9..55aa50e 100644 --- a/media/audio/linux/alsa_util.cc +++ b/media/audio/linux/alsa_util.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -9,15 +9,15 @@ #include "base/logging.h" #include "media/audio/linux/alsa_wrapper.h" -namespace { +namespace alsa_util { -snd_pcm_t* OpenDevice(AlsaWrapper* wrapper, - const char* device_name, - snd_pcm_stream_t type, - int channels, - int sample_rate, - snd_pcm_format_t pcm_format, - int latency_us) { +static snd_pcm_t* OpenDevice(AlsaWrapper* wrapper, + const char* device_name, + snd_pcm_stream_t type, + int channels, + int sample_rate, + snd_pcm_format_t pcm_format, + int latency_us) { snd_pcm_t* handle = NULL; int error = wrapper->PcmOpen(&handle, device_name, type, SND_PCM_NONBLOCK); if (error < 0) { @@ -43,10 +43,6 @@ snd_pcm_t* OpenDevice(AlsaWrapper* wrapper, return handle; } -} // namespace - -namespace alsa_util { - snd_pcm_format_t BitsToFormat(int bits_per_sample) { switch (bits_per_sample) { case 8: diff --git a/media/audio/linux/audio_manager_linux.cc b/media/audio/linux/audio_manager_linux.cc index 09c8625..b1108be 100644 --- a/media/audio/linux/audio_manager_linux.cc +++ b/media/audio/linux/audio_manager_linux.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -18,14 +18,10 @@ #include "media/base/limits.h" #include "media/base/media_switches.h" -namespace { - // Maximum number of output streams that can be open simultaneously. -const size_t kMaxOutputStreams = 50; - -const int kMaxInputChannels = 2; +static const size_t kMaxOutputStreams = 50; -} // namespace +static const int kMaxInputChannels = 2; // Implementation of AudioManager. bool AudioManagerLinux::HasAudioOutputDevices() { |