[pulseaudio-discuss] [PATCH 7/7] resampler: Make some basic functions for rewinding

Alexander E. Patrakov patrakov at gmail.com
Tue Feb 17 09:37:43 PST 2015


17.02.2015 17:29, David Henningsson wrote:
> The resampler framework just forwards the request to the lfe filter.
> There are no resampler impl that can rewind yet, so just reset the
> resampler impl instead of properly rewinding yet.
>
> Note: Rewinds on the resampler happens very rarely - since this is
> done on the sink-input side rather than the sink side, and PA keeps
> a copy of already processed material, then this can only happen if
> the client actively rewinds. And I don't know of any application that
> actually uses that feature...

I have applied this patch and others to my local copy of PulseAudio 
sources, and then inserted one line that logs the fact that 
pa_resampler_rewind() has been reached.

Contrary to your note, there is an easy way to trigger such rewinds. No 
special client is needed. Just run this:

aplay -f cd /dev/zero &
mpv file.mp3  # assuming a CD-quality file

Open pavucontrol and adjust the volumes so that the aplay stream has a 
higher volume set on it than the stream from mpv. Then adjust the volume 
on the mpv stream up and down, while making sure that it is always lower 
than what is set on aplay.

On stereo output profile, the test works flawlessly - no artifacts are 
heard, but my logging statement is not reached, either. On the 2.1 
profile, this statement is reached, and there are slight but audible 
clicks even with your patches, so I'd suspect (but cannot be 100% sure 
yet, as other explanations are possible) that the rewinding 
implementation introduced in PATCH 6/7 is incorrect. Sorry, I have done 
only this manual black-box sort of testing so far, and cannot point to 
any specific line.

Given this "suspect a bug but unsure" statement from myself, I'd 
actually want to see a unit test on this feature. Create some test 
pulses in a buffer of total length, say, 4096 samples, run through a 
crossover filter. Add 4096 more samples, also process them. Save the 
results. Then rewind 6000 samples, resubmit them in their original form, 
get 6000 output samples, compare with what you saved.

P.S. regarding your note - see also 
https://bugs.freedesktop.org/show_bug.cgi?id=50113 .

-- 
Alexander E. Patrakov


More information about the pulseaudio-discuss mailing list