[FFmpeg-devel] [PATCH 4/7] avformat/hlsenc: do not regenerate the playlist for each segment

Michael Niedermayer michaelni at gmx.at
Wed Jul 30 15:30:37 CEST 2014


On Wed, Jul 30, 2014 at 10:30:29AM +0200, Nicolas Martyanoff wrote:
> On 2014-07-29 15:59, Michael Niedermayer wrote:
> > On Fri, Jul 18, 2014 at 10:57:44AM +0200, Nicolas Martyanoff wrote:
> > > Since we need all segments to find out the target duration, we can only
> > > generate the playlist after writing all segments.
> > > 
> > > There is no need to rewrite the segment list every time we create a new
> > > segment file.
> > 
> > doesnt this break playing back hls while its still written ?
> 
> I believe you are right, I did not thing about the case where a client is
> reading the playlist while it is being written.
> 
> However I am not sure about the way avio_* functions work. Depending on the
> way buffering is done, how does one guarantee that at a time T, the playlist
> is a valid HLS playlist ?
> 
> The hlsenc muxer uses avio_open2(), a bunch of avio_printf() then
> avio_closep(). I have no idea whether a part of the file is readable by other
> processed before the call to avio_closep().

theres a internal buffer, once its filled data will be flushed out to
the OS, which i guess may or may not write data atomically in case
of remote FS

theres also avio_flush() and AVFMT_FLAG_FLUSH_PACKETS to force earlier
flushing

so i guess there could be some corner cases where the file is
truncated somehow but still it seems better than no file to me

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who are best at talking, realize last or never when they are wrong.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140730/f8d73826/attachment.asc>


More information about the ffmpeg-devel mailing list