Message ID | 1476083141-24270-1-git-send-email-zzjjob@gmail.com |
---|---|
State | Changes Requested |
Headers | show |
On Mon, Oct 10, 2016 at 9:05 AM, zzj <zzjjob@gmail.com> wrote: > Signed-off-by: zzj <zzjjob@gmail.com> > --- > libavformat/utils.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavformat/utils.c b/libavformat/utils.c > index 5be1e86..c7d6a41 100644 > --- a/libavformat/utils.c > +++ b/libavformat/utils.c > @@ -2776,7 +2776,7 @@ static void estimate_timings(AVFormatContext *ic, int64_t old_offset) > * the components */ > fill_all_stream_timings(ic); > ic->duration_estimation_method = AVFMT_DURATION_FROM_STREAM; > - } else { > + } else if (strcmp(ic->iformat->name, "hls,applehttp")) { > /* less precise: use bitrate info */ > estimate_timings_from_bit_rate(ic); > ic->duration_estimation_method = AVFMT_DURATION_FROM_BITRATE; format name comparisons in generic code should really be avoided, if at all possible. - Hendrik
On Mon, Oct 10, 2016 at 09:13:02AM +0200, Hendrik Leppkes wrote: > On Mon, Oct 10, 2016 at 9:05 AM, zzj <zzjjob@gmail.com> wrote: > > Signed-off-by: zzj <zzjjob@gmail.com> > > --- > > libavformat/utils.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/libavformat/utils.c b/libavformat/utils.c > > index 5be1e86..c7d6a41 100644 > > --- a/libavformat/utils.c > > +++ b/libavformat/utils.c > > @@ -2776,7 +2776,7 @@ static void estimate_timings(AVFormatContext *ic, int64_t old_offset) > > * the components */ > > fill_all_stream_timings(ic); > > ic->duration_estimation_method = AVFMT_DURATION_FROM_STREAM; > > - } else { > > + } else if (strcmp(ic->iformat->name, "hls,applehttp")) { > > /* less precise: use bitrate info */ > > estimate_timings_from_bit_rate(ic); > > ic->duration_estimation_method = AVFMT_DURATION_FROM_BITRATE; > > format name comparisons in generic code should really be avoided, if > at all possible. not arguing in favor of the specific patch but name comparisons are how the iformat is compared currently. A discussion to change this in a seperate thread here on ffmpeg-devel would be a good idea i think but This isnt a problem of this specific patch [...]
On Mon, Oct 10, 2016 at 03:05:41PM +0800, zzj wrote: > Signed-off-by: zzj <zzjjob@gmail.com> > --- > libavformat/utils.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavformat/utils.c b/libavformat/utils.c > index 5be1e86..c7d6a41 100644 > --- a/libavformat/utils.c > +++ b/libavformat/utils.c > @@ -2776,7 +2776,7 @@ static void estimate_timings(AVFormatContext *ic, int64_t old_offset) > * the components */ > fill_all_stream_timings(ic); > ic->duration_estimation_method = AVFMT_DURATION_FROM_STREAM; > - } else { > + } else if (strcmp(ic->iformat->name, "hls,applehttp")) { i would suggest to add a AVFMT_DURATION_LIVE and set duration_estimation_method to it in the hls demuxer and then skip estimation in utils if AVFMT_DURATION_LIVE is set this can easily be extended to other formats thats one line of thinking, another one would be to rather see this as that filesize of the main file is not representative as its just a "play list" and rather have the demuxers export this information and then check for that before using the filesize for duration estimation either should solve this and in fact both could be done thx [...]
diff --git a/libavformat/utils.c b/libavformat/utils.c index 5be1e86..c7d6a41 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2776,7 +2776,7 @@ static void estimate_timings(AVFormatContext *ic, int64_t old_offset) * the components */ fill_all_stream_timings(ic); ic->duration_estimation_method = AVFMT_DURATION_FROM_STREAM; - } else { + } else if (strcmp(ic->iformat->name, "hls,applehttp")) { /* less precise: use bitrate info */ estimate_timings_from_bit_rate(ic); ic->duration_estimation_method = AVFMT_DURATION_FROM_BITRATE;
Signed-off-by: zzj <zzjjob@gmail.com> --- libavformat/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)