[vlc-devel] [PATCH 04/10] MED Support - Logic and Input thread behavior change

Roiy Shpaner roiy at cs.umanitoba.ca
Fri Apr 4 20:07:41 CEST 2014

First, the feature is built so no related functionality will be running if
there is no MED file. 

If the MED file exists, and the user selects layers to play, the code in
mainLoop makes an appropriate jump, and will only search for another jump
location when the item time is out of the bounds of the currently playing


Second, I'll note a change to the input thread behavior.

Previously, there was a race condition between the input thread and the
InputManager thread. It was possible for the input thread to start the
initialization, when the InputManager thread has not set its callback yet,
which lead to input events being missed. 

(some code from preparser.c: 

input_Preparse( obj, p_item );

*this starts the input initialization and event transmissions*

and then 

var_SetAddress( obj, "item-change", p_item );

This will get the InputManager to *at some point* call setInput and add a


This was not a problem previously because events would repeat and be picked
up when the InputManager has actually set the callback. 

But in my case I have two events that do not repeat, so I needed to fix this
behavior. I added a mutex and I also changed the behavior of the
inputManager to only delete its callback when a setInput event was called
with a different input than the existing one. 

This guarantees the synchronization of the threads and prevents any kind of
missed events.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20140404/9198fd84/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-MED-Support-Logic-and-Input-thread-behavior-change.patch
Type: application/octet-stream
Size: 34292 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20140404/9198fd84/attachment.obj>

More information about the vlc-devel mailing list