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

Unified Diff: media/audio/linux/alsa_wrapper.cc

Issue 11019010: replace snd_pcm_hw_params_set_* with snd_pcm_set_params. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/linux/alsa_wrapper.cc
diff --git a/media/audio/linux/alsa_wrapper.cc b/media/audio/linux/alsa_wrapper.cc
index 67331b4b17d407dcfacb4c6942ed54f77505105f..7d084befcf14bdfea00474c5c1b39c12747de146 100644
--- a/media/audio/linux/alsa_wrapper.cc
+++ b/media/audio/linux/alsa_wrapper.cc
@@ -71,76 +71,16 @@ const char* AlsaWrapper::PcmName(snd_pcm_t* handle) {
return snd_pcm_name(handle);
}
-int AlsaWrapper::ConfigureHwParams(snd_pcm_t* handle,
- snd_pcm_hw_params_t* hw_params,
- snd_pcm_format_t format,
- snd_pcm_access_t access,
- unsigned int channels,
- unsigned int rate,
- int soft_resample,
- unsigned int latency) {
- int err = 0;
- if ((err = snd_pcm_hw_params_any(handle, hw_params)) < 0)
- return err;
-
- if ((err = snd_pcm_hw_params_set_rate_resample(handle, hw_params,
- soft_resample)) < 0) {
- return err;
- }
-
- if ((err = snd_pcm_hw_params_set_format(handle, hw_params, format)) < 0)
- return err;
-
- int dir = 0;
- unsigned new_rate = rate;
- if ((err = snd_pcm_hw_params_set_rate_near(handle, hw_params,
- &new_rate, &dir)) < 0) {
- return err;
- }
-
- if ((err = snd_pcm_hw_params_set_access(handle, hw_params, access)) < 0)
- return err;
-
- if ((err = snd_pcm_hw_params_set_channels(handle, hw_params, channels)) < 0)
- return err;
-
- unsigned buffer_time = latency;
- if (buffer_time == 0) {
- if ((err = snd_pcm_hw_params_get_buffer_time_max(hw_params,
- &buffer_time, 0)) < 0) {
- return err;
- }
- if (buffer_time > 500000)
- buffer_time = 500000;
- }
-
- unsigned period_time = buffer_time / 4;
- if ((err = snd_pcm_hw_params_set_period_time_near(handle, hw_params,
- &period_time, 0)) < 0) {
- return err;
- }
-
- err = snd_pcm_hw_params_set_buffer_time_near(handle, hw_params,
- &buffer_time, 0);
- return err;
-}
-
int AlsaWrapper::PcmSetParams(snd_pcm_t* handle, snd_pcm_format_t format,
snd_pcm_access_t access, unsigned int channels,
unsigned int rate, int soft_resample,
unsigned int latency) {
- int err = 0;
- snd_pcm_hw_params_t* hw_params;
- if ((err = snd_pcm_hw_params_malloc(&hw_params)) < 0)
- return err;
-
- if ((err = ConfigureHwParams(handle, hw_params, format, access, channels,
- rate, soft_resample, latency)) >= 0) {
- err = snd_pcm_hw_params(handle, hw_params);
- }
-
- snd_pcm_hw_params_free(hw_params);
- return err;
+ return snd_pcm_set_params(handle, format,
+ SND_PCM_ACCESS_RW_INTERLEAVED,
DaleCurtis 2012/10/01 18:59:16 What is the difference between SND_PCM_ACCESS_MMAP
no longer working on chromium 2012/10/01 19:51:13 Sorry, it was one of some quick fixes I tried, I s
+ channels,
+ rate,
+ soft_resample,
+ latency);
}
int AlsaWrapper::PcmGetParams(snd_pcm_t* handle, snd_pcm_uframes_t* buffer_size,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698