[FFmpeg-devel] [PATCH] avformat/hls Implement support for using AVSEEK_FLAG_BACKWARD when seeking

Gustav Grusell gustav.grusell at gmail.com
Tue May 25 15:07:57 EEST 2021


On Tue, May 25, 2021 at 4:24 AM Lingjiang Fang <vacingfang at foxmail.com>
wrote:

>
> only format change, maybe better to revert if you don't mean to do so
> :)
>
>
Thanks, will fix.

On Tue, May 25, 2021 at 10:30 AM 徐慧书 <javashu2012 at gmail.com> wrote:

> On Sat, May 15, 2021 at 4:11 AM Gustav Grusell <gustav.grusell at gmail.com>
> wrote:
>
> >
> >                      tb = get_timebase(pls);
> >                      ts_diff = av_rescale_rnd(pls->pkt->dts,
> AV_TIME_BASE,
> > -                                            tb.den, AV_ROUND_DOWN) -
> > -                            pls->seek_timestamp;
> > -                    if (ts_diff >= 0 && (pls->seek_flags  &
> AVSEEK_FLAG_ANY ||
> > -                                        pls->pkt->flags &
> AV_PKT_FLAG_KEY)) {
> > +                                             tb.den, AV_ROUND_DOWN) -
> > +                              pls->seek_timestamp;
> > +                    /* If AVSEEK_FLAG_BACKWARD set and not
> AVSEEK_FLAG_ANY,
> > +                     * we return the first keyframe encountered */
> > +                    if ((pls->seek_flags & AVSEEK_FLAG_BACKWARD &&
> > +                         !(pls->seek_flags & AVSEEK_FLAG_ANY) &&
> > +                         pls->pkt->flags & AV_PKT_FLAG_KEY) ||
> > +                        (ts_diff >= 0 && (pls->seek_flags  &
> AVSEEK_FLAG_ANY ||
> > +                                          pls->pkt->flags &
> AV_PKT_FLAG_KEY))) {
> >                          pls->seek_timestamp = AV_NOPTS_VALUE;
> >                          break;
> >                      }
>
> I think you can put your code above this line ( tb =
> get_timebase(pls). )  to avoid invalid code execution and keep the
> code aligned
>
> Good suggestion, I will do so and provide a new patch.

Regards,
Gustav


More information about the ffmpeg-devel mailing list