OK, a preliminary version of my module is functional. It's way away
from production grade:

* the producer segfaults on exit
* if the producer dies while holding the lock, the whole thing freezes
* if the consumer restarts, the running producer(s)'s reference to
shared memory will become invalid

But all of these are fixable, maybe getting rid of the lock and using
something like zmq (or just unix sockets, to minimize dependencies)
for syncronizations. Although this wouldn't fix the consumer dying
scenario.

In any case, the big issue I'm facing right now is sync on the
consumer side. I'm using posix's clock_nanosleep to run the consumer
thread every ((1 / fps) * 1000000000) nanoseconds, but it's running
slightly slow. I've even stopped using the read lock on the producer's
side in case write starvation was the issue (slightly dangerous, might
get corrupted data if the frame changes while making a read, but
hasn't seen it happen so far).

https://github.com/inaes-tic/mlt/blob/posixshm/src/modules/posixshm/consumer_posixshm.c
https://github.com/inaes-tic/mlt/blob/posixshm/src/modules/posixshm/producer_posixshm.c

if anyone cares to take a look, I'm specially worried about my usage
of rt_frame in consumer_start (I need to get the audio format in order
to allocate the shared memory space), and the pool_alloc's I do in
https://github.com/inaes-tic/mlt/blob/posixshm/src/modules/posixshm/producer_posixshm.c#L170

Is doing set_data with the destructor, and then setting it to NULL
when I pass the data to the frame the right way to do it? I'm talking
about making sure the memory will be freed in case the producer is
closed.

--
"The whole of Japan is pure invention. There is no such country, there
are no such people" --Oscar Wilde

|_|0|_|
|_|_|0|
|0|0|0|

(\__/)
(='.'=)This is Bunny. Copy and paste bunny
(")_(") to help him gain world domination.

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Mlt-devel mailing list
Mlt-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlt-devel

Reply via email to