[pulseaudio-discuss] Crackling audio with Pulseaudio 4.0 and the simple Pulse API.
Peter Meerwald
pmeerw at pmeerw.net
Wed Jul 10 16:13:05 PDT 2013
Hello,
> > This commit seems to break speech-dispatcher:
> > http://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/?id=30ce3a14e5ae1cd316a18bec95b831c07ac57a1a
this is not good
> buffer handling. Converting o_ss.channels to work_channels isn't enough
> to fix the issue with speech-dispatcher, however, because there's also
> another thing issue: when resampling happens before remapping, the
> leftover buffer handling is completely broken, because it assumes that
> the leftover data from the resampling phase is supposed to be stored in
> the remap buffer, while it actually should be stored in the
> to_work_format buffer. At least the ffmpeg resampler needs the leftover
> handling with the speech-dispatcher stream. I don't have a simple fix
> for this, so I'll just revert the patch for now.
the ffmpeg and libsamplerate code use the leftover logic; I assume
speech-dispatcher selects ffmpeg or libsamplerate instead of the default
speex? or is the bug due to the issue in the peaks resampler?
Tanu, do you know the constellation that triggers the bug? is #output
channel > #input channels?
a resampler implementation has several options wrt input and output buffer
use:
(i) it allows short reads, i.e. it is free not to use all samples given
in the input buffer
(ii) it allows short writes, i.e. it is free to not write all samples
requested to the output buffer
(iii) both, (i) and (ii)
save_leftover() is necessary if the resampler does (i)
doing (ii) is much less painful for PA, there is just more or less (maybe
zero) output sometimes
> It's by no means impossible to add support for storing the leftover data
> in the to_work_format buffer, if someone wants to work on it, but the
> leftover code is hairy already as it is, and this would make it doubly
> so. I will accept patches that do that, although it would be better if
> the leftover buffer handling could be simplified. I'm not sure if it's
> possible to simplify the code without affecting the performance, though.
> I tried pretty hard when I originally wrote the leftover logic. That
> said, perhaps a minor performance hit would be acceptable just for code
> readability.
maybe we can get rid of the leftover logic altogether:
* ffmpeg is going to be replaced by libswresample / livavresample;
swr_convert() [1] takes all input and buffers it, hence is not type-(i)
* libsamplerate offers three APIs: simple, full, and callback [2]; it
seems the callback interface could be used which is not type-(i)
nevertheless, I think any type-(i) resampler could be relaxed (made more
convenient for PA) by implementing a wrapper to add buffering and not
pushing back samples to the remap buffer (maybe this is what you meant by
simplifying the leftover buffer handling?)
I'd be interested in working in that direction
regards, p.
[1] http://ffmpeg.mplayerhq.hu/doxygen/trunk/group__lswr.html
[2] http://www.mega-nerd.com/SRC/api_callback.html
--
Peter Meerwald
+43-664-2444418 (mobile)
More information about the pulseaudio-discuss
mailing list