[pulseaudio-discuss] pa_stream_seek ... not

Lennart Poettering lennart at poettering.net
Tue Dec 22 10:00:17 PST 2009


On Mon, 14.12.09 20:16, Mads Kiilerich (mads at kiilerich.com) wrote:

> The streams.h documentation tells how the write pointer can be moved
> with pa_stream_write() - and reset with pa_stream_flush().
> 
> But AFAICS there is no way to move the write pointer without writing
> anything. pa_stream_write() has assertion on data not being NULL and
> doesn't move the pointer if nbytes is 0.
> 
> Is there some kind of trick that can be used?

One option is to simply cache the seek position locally and then use
it the next time you write again.

> Would it make sense to change PA so pa_stream_write() accepts a NULL
> pointer if nbytes is 0 and then just moves the write pointer?

Not sure if that really is advisable. We should minimize the traffic,
and thus I'd say that seeking without writing is a redundant
operation...

> (Is the behaviour of pa_stream_write() with nbytes = 0 currently
> well-defined and working correctly? I have seen some strange some
> strange errors because of that - but that might be because I don't
> know what to expect.)

This should return PA_ERR_INVALID, though it apparently currently does
not. /me goes and fixes that.

Lennart

-- 
Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net
http://0pointer.net/lennart/           GnuPG 0x1A015CC4



More information about the pulseaudio-discuss mailing list