[FFmpeg-devel] [PATCH]Fix bug in setting the pts when decoding or transcoding Dirac video wrapped in MPEG-TS using libschroedingerdec.c

Reimar Döffinger Reimar.Doeffinger
Tue Nov 23 08:04:48 CET 2010


On Tue, Nov 23, 2010 at 03:15:03PM +1100, Anuradha Suraparaju wrote:
> On Fri, Nov 19, 2010 at 5:50 PM, Reimar D?ffinger
> <Reimar.Doeffinger at gmx.de>wrote:
> > On Fri, Nov 19, 2010 at 02:05:38PM +1100, Anuradha Suraparaju wrote:
> > > +
> > > +            if (avpkt->pts != AV_NOPTS_VALUE) {
> > > +                FfmpegSchroPktTS *pktts =
> > av_mallocz(sizeof(FfmpegSchroPktTS));
> > > +                pktts->pts = avccontext->reordered_opaque;
> > > +                pktts->dts = avpkt->dts;
> > > +                enc_buf->tag = schro_tag_new(pktts, av_free);
> > > +            } else {
> > > +                if (SCHRO_PARSE_CODE_IS_PICTURE(enc_buf->data[4])) {
> > > +                    FfmpegSchroPktTS *pktts =
> > av_mallocz(sizeof(FfmpegSchroPktTS));
> > > +                    int frame_number = AV_RB32(enc_buf->data + 13);
> > > +                    if (p_schro_params->format->interlaced_coding)
> > > +                       frame_number >>= 1;
> > > +                    pktts->pts = av_rescale_q(frame_number,
> > avccontext->time_base, AV_TIME_BASE_Q);
> > > +                    pktts->dts = avpkt->dts;
> > > +                    enc_buf->tag = schro_tag_new(pktts, av_free);
> > > +                }
> > > +            }
> > >              state = schro_decoder_push(decoder, enc_buf);
> > >              if (state == SCHRO_DECODER_FIRST_ACCESS_UNIT)
> > >                  libschroedinger_handle_first_access_unit(avccontext);
> > [...]
> > > +        if (f->p_tag) {
> > > +            FfmpegSchroPktTS *pktts = f->p_tag->value;
> > > +            picture->reordered_opaque = pktts->pts;
> > > +        } else {
> > > +            picture->reordered_opaque = AV_NOPTS_VALUE;
> > > +        }
> >
> > You can't set reordered_opaque to arbitrary values either.
> > An application might e.g. have put an array index to additional
> > frame data (e.g. user data it needs to splice in), the encoder
> > making up its own values would cause such an application to crash.
> >
> 
> But this is in the decoder and not encoder. reordered_opaque is being set to
> the pts of the decoded frame and not an arbitrary value. If the objection is
> to setting reordered_opaque to AV_NOPTS_VALUE, I'll omit that.

According to the documentation you may only ever set it to a value
in AVCodecContext.reordered_opaque, never ever anything else.



More information about the ffmpeg-devel mailing list