[vlc-devel] [PATCH] livehttp - keep index file up to date when doing non-live transcoding on Windows

Rémi Denis-Courmont remi at remlab.net
Thu Feb 17 18:36:43 CET 2011

Le jeudi 17 février 2011 19:11:01 Rob, vous avez écrit :
> previously, the live http encoding made all changes after the first write
> to index.m3u8 to index.m3u8.tmp when doing non-live encoding. This patch
> gets rid of the .tmp and just keeps the index.m3u8 up to date. This makes
> the stream viewable even when it isn't finished.

The point of rename is to make the file update atomic, so that an HTTP client 
will either get the old or the new M3U8 file, and never an incomplete file.

> this follows the author's comment with the initial livehttp.c
> 'I'm not sure I am doing the right thing with the Win32 rename function.
> Linux (I believe) allows me to rename a file over an existing file, even
> if the existing file is in use.  Win32 is not so friendly.  This ability
> is useful for updating the index file at same time it may be currently
> being read by the HTTP server serving the files.'

On Windows, vlc_rename() erases the old file before renaming. This is not 
atomic, but:
- the window of opportunity for failure is still much smaller,
- the client never gets an incomplete file; at worse, an error,
- it does not break working POSIX systems for the sake of Windows.

I don't really see the point of this patch.

> http://techblog.unwiredappeal.com/2010/03/vlc-http-live-streaming-module-pa
> tch.html it brings functionality in line with linux/mac.
> tested on winxp, win7

Rémi Denis-Courmont

More information about the vlc-devel mailing list