[FFmpeg-trac] #6695(avformat:new): avformat_new_stream() and cur_dts

FFmpeg trac at avcodec.org
Tue Sep 26 11:51:21 EEST 2017


#6695: avformat_new_stream() and cur_dts
------------------------------------+------------------------------------
             Reporter:  jonsmirl    |                    Owner:
                 Type:  defect      |                   Status:  new
             Priority:  important   |                Component:  avformat
              Version:  git-master  |               Resolution:
             Keywords:  regression  |               Blocked By:
             Blocking:              |  Reproduced by developer:  0
Analyzed by developer:  0           |
------------------------------------+------------------------------------
Changes (by cehoyos):

 * keywords:   => regression
 * priority:  normal => important
 * component:  undetermined => avformat


Old description:

> avformat_new_stream() is not initializing AVStream->cur_dts.  This causes
> problems down in av_interleaved_write_frame(), compute_muxer_pkt_fields()
> on this test since cur_dts is randomly set.
>
>     if (st->cur_dts && st->cur_dts != AV_NOPTS_VALUE &&
>         ((!(s->oformat->flags & AVFMT_TS_NONSTRICT) &&
>           st->codecpar->codec_type != AVMEDIA_TYPE_SUBTITLE &&
>           st->codecpar->codec_type != AVMEDIA_TYPE_DATA &&
>           st->cur_dts >= pkt->dts) || st->cur_dts > pkt->dts)) {
>         av_log(s, AV_LOG_ERROR,
>                "Application provided invalid, non monotonically
> increasing dts to muxer in stream %d: %s >= %s\n",
>                st->index, av_ts2str(st->cur_dts), av_ts2str(pkt->dts));
>         return AVERROR(EINVAL);
>     }
>
> Changing my code like this makes it work as expected.
>
>         out_stream = avformat_new_stream(ofmt_ctx, NULL);
>         out_stream->cur_dts = AV_NOPTS_VALUE;
>
> I'm using git head from 9/24. This is a recent change since my code
> worked on older versions of ffmpeg.

New description:

 avformat_new_stream() is not initializing AVStream->cur_dts.  This causes
 problems down in av_interleaved_write_frame(), compute_muxer_pkt_fields()
 on this test since cur_dts is randomly set.
 {{{
     if (st->cur_dts && st->cur_dts != AV_NOPTS_VALUE &&
         ((!(s->oformat->flags & AVFMT_TS_NONSTRICT) &&
           st->codecpar->codec_type != AVMEDIA_TYPE_SUBTITLE &&
           st->codecpar->codec_type != AVMEDIA_TYPE_DATA &&
           st->cur_dts >= pkt->dts) || st->cur_dts > pkt->dts)) {
         av_log(s, AV_LOG_ERROR,
                "Application provided invalid, non monotonically increasing
 dts to muxer in stream %d: %s >= %s\n",
                st->index, av_ts2str(st->cur_dts), av_ts2str(pkt->dts));
         return AVERROR(EINVAL);
     }
 }}}
 Changing my code like this makes it work as expected.
 {{{
         out_stream = avformat_new_stream(ofmt_ctx, NULL);
         out_stream->cur_dts = AV_NOPTS_VALUE;
 }}}
 I'm using git head from 9/24. This is a recent change since my code worked
 on older versions of ffmpeg.

--

Comment:

 Please send your patch - made with {{{git format-patch}}} - to the
 development mailing list.

--
Ticket URL: <https://trac.ffmpeg.org/ticket/6695#comment:1>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list