From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JsiDr-0006DI-3C for qemu-devel@nongnu.org; Sun, 04 May 2008 13:42:03 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JsiDq-0006CX-FG for qemu-devel@nongnu.org; Sun, 04 May 2008 13:42:02 -0400 Received: from [199.232.76.173] (port=60747 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JsiDq-0006CU-BK for qemu-devel@nongnu.org; Sun, 04 May 2008 13:42:02 -0400 Received: from fmmailgate02.web.de ([217.72.192.227]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JsiDq-0002py-BX for qemu-devel@nongnu.org; Sun, 04 May 2008 13:42:02 -0400 Message-ID: <481DF561.4050709@web.de> Date: Sun, 04 May 2008 19:41:53 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <481B6626.7010603@web.de> <481B80F0.8050705@web.de> <481D670D.6070602@web.de> In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigFAC6EB8EB8CA31FE7A6F5254" Sender: jan.kiszka@web.de Subject: [Qemu-devel] Re: [PATCH] alsaaudio: increase default buffer sizes Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: malc Cc: qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigFAC6EB8EB8CA31FE7A6F5254 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable malc wrote: > On Sun, 4 May 2008, Jan Kiszka wrote: >=20 >> malc wrote: >>> On Fri, 2 May 2008, Jan Kiszka wrote: >>> >>>> malc wrote: >>>>> On Fri, 2 May 2008, Jan Kiszka wrote: >>>>> >>>>>> Sound though the ALSA driver is skipping here unless I increase th= e >>>>>> buffer size. OSS seems to use 16K as well, and 1K was obviously to= >>>>>> small >>>>>> for recording anyway. >>>>>> >>>>>> [ PS: Can someone explain to me why I also have to override the >>>>>> DAC/ADC_FIXED_FREQ to 48000 to make ALSA work? Suboptimal... ] >>>>> >>>>> How exactly it doesn't work if you don't override it? Do you get an= y >>>>> messages prefixed with "alsa:"? As for the defaults they were set t= o >>>>> 1024/256 because that's what was needed to make it sound on par >>>>> with OSS >>>>> on the two machines i had at the time. >=20 > [..snip..] >=20 >>> >>> >>> Could you give it a whirl please? >> >> No difference - except that it now complains about the 16384 byte buff= er >> size. >=20 > Okay more of the same... >=20 > diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c > index 43cfa25..59c091d 100644 > --- a/audio/alsaaudio.c > +++ b/audio/alsaaudio.c > @@ -428,15 +428,15 @@ static int alsa_open (int in, struct > alsa_params_req *req, > } > } >=20 > - err =3D snd_pcm_hw_params_set_period_size ( > + err =3D snd_pcm_hw_params_set_period_size_near ( > handle, > hw_params, > - period_size, > + &period_size, > 0 > ); > if (err < 0) { > alsa_logerr2 (err, typ, "Failed to set period size= > %d\n", > - req->period_size); > + period_size); > goto err; > } > } > @@ -466,14 +466,14 @@ static int alsa_open (int in, struct > alsa_params_req *req, > } > } >=20 > - err =3D snd_pcm_hw_params_set_buffer_size ( > + err =3D snd_pcm_hw_params_set_buffer_size_near ( > handle, > hw_params, > - buffer_size > + &buffer_size > ); > if (err < 0) { > alsa_logerr2 (err, typ, "Failed to set buffer size %d\= n", > - req->buffer_size); > + buffer_size); > goto err; > } > } Yeah, great, that was the key! Find below the version that works for me (on 64 bit 8) ). It even obsoletes my buffer size patch. Please merge! Index: qemu/audio/alsaaudio.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- qemu/audio/alsaaudio.c (Revision 4332) +++ qemu/audio/alsaaudio.c (Arbeitskopie) @@ -396,7 +396,7 @@ static int alsa_open (int in, struct als } else { int dir; - snd_pcm_uframes_t minval; + snd_pcm_uframes_t minval, val; =20 if (period_size) { minval =3D period_size; @@ -428,15 +428,16 @@ static int alsa_open (int in, struct als } } =20 - err =3D snd_pcm_hw_params_set_period_size ( + val =3D period_size; + err =3D snd_pcm_hw_params_set_period_size_near ( handle, hw_params, - period_size, + &val, 0 ); if (err < 0) { alsa_logerr2 (err, typ, "Failed to set period size %= d\n", - req->period_size); + period_size); goto err; } } @@ -466,14 +467,15 @@ static int alsa_open (int in, struct als } } =20 - err =3D snd_pcm_hw_params_set_buffer_size ( + val =3D buffer_size; + err =3D snd_pcm_hw_params_set_buffer_size_near ( handle, hw_params, - buffer_size + &val ); if (err < 0) { alsa_logerr2 (err, typ, "Failed to set buffer size %d\n"= , - req->buffer_size); + buffer_size); goto err; } } --------------enigFAC6EB8EB8CA31FE7A6F5254 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4-svn0 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iD8DBQFIHfVlniDOoMHTA+kRAq8MAJ0bakhmJ/32xW/GbB/vcYMLyneCjwCcCcW9 Vs/NgGYBExF7kZ2+FJH7KxU= =jvLj -----END PGP SIGNATURE----- --------------enigFAC6EB8EB8CA31FE7A6F5254--