partial writes in bse-jack?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

partial writes in bse-jack?

Tim Janik-2

hi Stefan.

i'm wondering how you could ever encounter partial writes
in bse-jack. i.e. jack_device_write() being called with a
full engine block and not enough space in the ringbuffer
being available to write all the data:
1) why is jack_device_write() being called when there
    was no prior jack_device_check_io() that returned TRUE
    or timeout==0?
2) why would jack_device_check_io() return TRUE if not
    enough ringbuffer data can be written?

maybe helpful remarks:
- bseenginemaster.c:master_poll_check() checks the poll functions
   for the master thread and decides whether data processing is
   neccessary, flagged in bseenginemaster.c:master_need_process.
- the only current poll function is added via bse_job_add_poll() in
   bsepcmmodule.c: bsepcmmodule.c:bse_pcm_module_poll().
- in this case, the poll function bse_pcm_module_poll() simply passes
   on the PCM driver's check_io() results 1:1.
- the engine shouldn't start processing data, if no poll funciton
   returned TRUE or *timeout==0.

so in theory, if your check_io() function was correctly implemented,
i'd expect partial writes to never occour. (that being said, it might
still make sense to guard against them via a Cond or similar, in case
more poll funcitons are being added in the future.)

---
ciaoTJ
_______________________________________________
beast mailing list
[hidden email]
http://mail.gnome.org/mailman/listinfo/beast
Reply | Threaded
Open this post in threaded view
|

Re: partial writes in bse-jack?

Stefan Westerfeld
   Hi!

On Sun, Jun 04, 2006 at 02:46:38AM +0200, Tim Janik wrote:

> i'm wondering how you could ever encounter partial writes
> in bse-jack. i.e. jack_device_write() being called with a
> full engine block and not enough space in the ringbuffer
> being available to write all the data:
> 1) why is jack_device_write() being called when there
>    was no prior jack_device_check_io() that returned TRUE
>    or timeout==0?
> 2) why would jack_device_check_io() return TRUE if not
>    enough ringbuffer data can be written?
>
> maybe helpful remarks:
> - bseenginemaster.c:master_poll_check() checks the poll functions
>   for the master thread and decides whether data processing is
>   neccessary, flagged in bseenginemaster.c:master_need_process.
> - the only current poll function is added via bse_job_add_poll() in
>   bsepcmmodule.c: bsepcmmodule.c:bse_pcm_module_poll().
> - in this case, the poll function bse_pcm_module_poll() simply passes
>   on the PCM driver's check_io() results 1:1.
> - the engine shouldn't start processing data, if no poll funciton
>   returned TRUE or *timeout==0.
>
> so in theory, if your check_io() function was correctly implemented,
> i'd expect partial writes to never occour. (that being said, it might
> still make sense to guard against them via a Cond or similar, in case
> more poll funcitons are being added in the future.)

I debugged it now, and its simply that the the timeout value computed by
my bse jack driver can become 0 (for instance if there are just 32
samples which miss for writing a whole engine block size to the output
ringbuffer).

When I stop using the timeout, but instead rely on a newly introduced
public bse_engine_mastere_wakeup() function (right now its private), the
code works as expected. Of course setting timeout to  MAX (1,
computedtimeout) also works, but thats not what I want to do, since
timeout based stuff is less reliable when jitter is present than pipe
based signalling.

   Cu... Stefan
--
Stefan Westerfeld, Hamburg/Germany, http://space.twc.de/~stefan
_______________________________________________
beast mailing list
[hidden email]
http://mail.gnome.org/mailman/listinfo/beast
Reply | Threaded
Open this post in threaded view
|

Re: partial writes in bse-jack?

Tim Janik
On Wed, 7 Jun 2006, Stefan Westerfeld wrote:

> On Sun, Jun 04, 2006 at 02:46:38AM +0200, Tim Janik wrote:

>> so in theory, if your check_io() function was correctly implemented,
>> i'd expect partial writes to never occour. (that being said, it might
>> still make sense to guard against them via a Cond or similar, in case
>> more poll funcitons are being added in the future.)
>
> I debugged it now, and its simply that the the timeout value computed by
> my bse jack driver can become 0 (for instance if there are just 32
> samples which miss for writing a whole engine block size to the output
> ringbuffer).

ok.

> When I stop using the timeout, but instead rely on a newly introduced
> public bse_engine_mastere_wakeup() function (right now its private), the
> code works as expected. Of course setting timeout to  MAX (1,
> computedtimeout) also works, but thats not what I want to do, since
> timeout based stuff is less reliable when jitter is present than pipe
> based signalling.

well, timeout based handling is what the engine and drivers are currently
designed for. i repeatedly told you about that. if you think the current
model can be switched to polling and be as reliable, i need at least 2
things from you:
1) a bse-jack driver that *does* work with timeouts;
2) a patch that switches *all* drivers to notify + polling.

then we have a basis for discussing, testing, benchmarking and working on
timeout vs. poll() handling.
that can and should be done seperately though, independent of jack or
other driver development.

>   Cu... Stefan

---
ciaoTJ
_______________________________________________
beast mailing list
[hidden email]
http://mail.gnome.org/mailman/listinfo/beast