[MPlayer-dev-eng] [PATCH] Add audio support for sndio API.
Reimar.Doeffinger at gmx.de
Fri Dec 20 08:30:20 CET 2013
On 20.12.2013, at 01:36, Alexandre Ratchov <alex at caoua.org> wrote:
> On Thu, Dec 19, 2013 at 01:32:05PM +0100, Reimar Döffinger wrote:
>> Alexandre Ratchov <alex at caoua.org> wrote:
>>> On Thu, Dec 19, 2013 at 11:25:25AM +0100, Reimar Döffinger wrote:
>>>> Alexandre Ratchov <alex at caoua.org> wrote:
>>>> Sorry, but this makes 0 sense to me. Delay is something you
>>>> calculate yourself in e.g. movcb, you don't get it from sndio, so
>>>> I don't understand how what sndio does helps you.
>>> During playback, the delay is defined as:
>>> delay = (samples_written - samples_played) / sample_rate
>>> where samples_played is the sum of "deltas" reported by the
>>> onmove() call-back.
>>> It can't be negative (sndio pauses when the buffer is empty)
>> It can still become negative if you end up updating delay in a
>> way that makes it mismatch the actual buffer fill. You set it to
>> 0, which would only be correct if reset discarded the buffers,
>> but previously we said it doesn't. The documentation as usual
>> doesn't document the behaviour at all, so I can't know what it
>>>> Also, since reset does not drop the buffers I can't see how it
>>>> should be correct to set delay to 0, any new data should be
>>>> delayed by as much time as there is data the old buffers.
>>> When we call sio_start() to resume, we consider buffers are drained
>>> (thus empty)
>> You can't just "consider" them empty when they aren't.
>> Either reset discards the buffers or it does not. You said it
>> doesn't, so the buffers are not empty after reset and setting
>> delay to 0 is wrong (since delay 0 should mean the buffers are
> according to the man page "The sio_stop() function stops playback
> and recording and puts the audio subsystem in the same state as
> after sio_open() is called."
> So the "contract" is: after sio_stop() returns, the device can be
> used as if it was freshly opened & configured (implies empty
So it does discard buffers? You were telling me the opposite before.
Or does it block and not return until everything was played?
Documentation can claim a lot, it's only relevant if it's actually true, and as I pointed out before some parts of the sndio documentation just make no sense, so I kind of would go with assuming that what the documentation says probably has little to do with reality.
More information about the MPlayer-dev-eng