On 2014/01/19 13:14, Marcello Desantis <[email protected]> wrote:
> when I try to play a WAV file streamed by a media server I get a corrupted 
> playback. The same file, retrieved with "curl -o ? http://?"; and played as a 
> local file works flawlessly.
[...]
> The problem itself is very simple: libsndfile needs that the read function in 
> CurlInputPlugin return a number of bytes that is a multiple of the frames 
> size of the WAV file being decoded (4, 6 or 8 bytes for 16, 24, 32 bit depth, 
> respectively, for a 2 channel PCM stream). If the read function doesn?t 
> return whole frames, libsndfile discards the last ?remaining? bytes of the 
> returned buffer and the corruption occurs.

Thanks for debugging.  Though it would be preferrable to use the bug tracker.

> I tried to think to several solutions, but as long as the whole read
> functions chain doesn?t include a ?nbr of items? parameter, the only
> viable solution seems to be CurlInputPlugin block until the request
> number of bytes can be returned to the caller (or EOF is reached).

No, not a good idea.  Some callers may pass very large buffers, and
blocking until the buffer is full would make MPD stutter (ALSA
underrun), because that would increase latency a lot.

We should never make all InputStream callers suffer because of some
undocumented (and stupid) libsndfile API requirement.  What we can do
instead is implement this only in sndfile_vio_read().

Max
_______________________________________________
mpd-devel mailing list
[email protected]
http://mailman.blarg.de/listinfo/mpd-devel

Reply via email to