[FFmpeg-devel] understanding usage of av_compare_ts() in avformat/hlsenc

Nicolas Martyanoff khaelin at gmail.com
Tue Jul 8 12:19:23 CEST 2014


Hi,

I am currently working on improving the hlsenc muxer to support byteranges
(HLS version 4), and it is starting to work :) But there is a line that really
puzzles me:


    if (can_split && av_compare_ts(pkt->pts - hls->start_pts, st->time_base,
                                           end_pts, AV_TIME_BASE_Q) >= 0) {

    // libavformat/hlsenc.c 282


Afaik, av_compare_ts() compares two presentation timestamps with potentially
different time bases, and returns a value indicating if the first timestamp is
larger (i.e. more recent) than the second one.

However in this code, the first argument is the difference between two
presentation timestamp, i.e. a time length. I do not get how comparing a time
length and a presentation timestamp makes any kind of sense.

Does anyone know what I am missing here ?

Thank you in advance.

Regards,

-- 
Nicolas Martyanoff
http://wandrian.net
khaelin at gmail.com


More information about the ffmpeg-devel mailing list