[pulseaudio-discuss] Adjust volume may cause audio playback corruption

cee1 fykcee1 at gmail.com
Sun May 27 02:16:03 PDT 2012


2012/5/18 cee1 <fykcee1 at gmail.com>:
> 2012/5/18 cee1 <fykcee1 at gmail.com>:
>> 在 2012年5月18日星期五,Clemens Ladisch 写道:
>>
>>> cee1 wrote:
>>> > We've found a way the can reproduce the problem more quickly on our
>>> > product:
>>> > 1. do audio playback
>>> > 2. alsamixer, select 'Master', press 'm' and hold for a while.
>>> >
>>> > Then release 'm', playback corrupts(sounds similar to
>>> > http://dev.lemote.com/files/upload/software/PA-apc/corrupted_sound.ogg).
I've written a small program[1] that will let PA mute/unmute repeatedly.

I find the problem is something to do with rewind_safeguard, If I
adjust rewind_safeguard to eighth of the original value, it can also
be easily reproduced through pa-mute-test.c on the AMD turion 64 x2
board in ubuntu 12.04:
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -86,8 +86,8 @@

 #define VOLUME_ACCURACY (PA_VOLUME_NORM/100)  /* don't require volume
adjustments to be perfectly correct. do

-#define DEFAULT_REWIND_SAFEGUARD_BYTES (256U) /* 1.33ms @48kHz, we'll
never rewind less than this */
-#define DEFAULT_REWIND_SAFEGUARD_USEC (1330) /* 1.33ms, depending on
channels/rate/sample we may rewind more
+#define DEFAULT_REWIND_SAFEGUARD_BYTES (32U) /* 1.33ms @48kHz, we'll
never rewind less than this */
+#define DEFAULT_REWIND_SAFEGUARD_USEC (166) /* 1.33ms, depending on
channels/rate/sample we may rewind more t

 struct userdata {
     pa_core *core;

Should we calculate limit_nbytes considering tsched_watermark?
e.g.(which works on our platform)
@@ -1614,7 +1614,7 @@ static int process_rewind(struct userdata *u) {
     unused_nbytes = (size_t) unused * u->frame_size;

     /* make sure rewind doesn't go too far, can cause issues with DMAs */
-    unused_nbytes += u->rewind_safeguard;
+    unused_nbytes += u->tsched_watermark;

     if (u->hwbuf_size > unused_nbytes)
         limit_nbytes = u->hwbuf_size - unused_nbytes;


----
[1]. See pa-mute-test.c in attachment, using build.sh to build it.


Regards,
-- cee1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pa-mute-test.c
Type: text/x-csrc
Size: 1349 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20120527/089c0e86/attachment.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: build.sh
Type: application/x-sh
Size: 180 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20120527/089c0e86/attachment.sh>


More information about the pulseaudio-discuss mailing list