[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
Fri Nov 19 07:50:18 CET 2010


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.



More information about the ffmpeg-devel mailing list