[vlc-devel] [PATCH 3/3] Added livehttp access_out module to support HTTP Live Streaming

Geoffroy Couprie geo.couprie at gmail.com
Tue May 11 11:04:38 CEST 2010


Hello,

On Mon, May 10, 2010 at 8:41 PM, Keary Griffin
<keary.griffin at unwiredappeal.com> wrote:
>
> Rémi Denis-Courmont wrote:
>
> Indeed, I don't understand why you're retrying if you anyway set the
> REPLACE_EXISTING flag.
>
>
>
> Because REPLACE_EXISTING doesn't work if the file is open under win32, it
> still returns an error (AFAIK).  Because this function is used to replace a
> playlist file that the web server may currently be accessing it is quite
> possible it will be open while we are trying to replace.   The web server
> should only have it open momentarily for each HTTP request received, so
> hopefully the retry will allow it be to replaced.  Even if it's not (it hits
> the maximum retries), the same code will be run again when the next segment
> is created, and try again some number of times...

I don't know if I really understand what you mean here, but on
Windows, if you want to replace a file in use, there is one (strangely
unknown) trick:
-rename the old file to something else with MoveFile
-replace by the new file with MoveFile
-mark the old file for deletion with DeleteFile

After the call to DeleteFile, the old file will not be deleted until
all its handles have been closed, and no process will be able to open
it again.

It is still not atomic: someone could try to open the playlist after
it has been moved and before it has been replaced.

Best regards,

Geoffroy



More information about the vlc-devel mailing list