[vlc-devel] "Race condition" in livehttp module

Enrique Arizón Benito enrique.arizonbenito at gmail.com
Thu Jun 13 09:09:54 CEST 2013


Hello,

For an small project I'm developping an livehttp server based on
vlc+livehttp and a web server (Apache).

The livehttp module works properly but when I add the delsegs option to
remove old segment next random raise condition sequence of events arise:

Note:

1.- Clients requests index.m3u8 index file to apache
2.- web-server sends back the index.m3u8 index file to the client
3.- Client reads the m3u8 and parses it.
4.- livehttp creates a new ts segment, updates the index.m3u8 index and
removes the oldest existing fragment.
5.- Client request to the web-server the first ts fragment it founds after
parsing (*this fragment has just been removed in step 4*)
6.- web-server returns a *404-Not Found error*.

I think a simple patch in modules/access_output/livehttp.c like the next
one will fix the error.
The two oldest files will not be removed inmediatly but just after two
other updates:

532c532
<     if ( p_sys->b_delsegs && i_firstseg > 1 )
---
>     if ( p_sys->b_delsegs && i_firstseg > 3 )
534c534
<         char *psz_name = formatSegmentPath( p_access->psz_path,
i_firstseg-1, true );
---
>         char *psz_name = formatSegmentPath( p_access->psz_path,
i_firstseg-3, true );


Regards!

Enrique
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20130613/20a6d850/attachment.html>


More information about the vlc-devel mailing list