I am currently working with FLAC encoder and I think I found a bug on pts
setted on AVPacket.
In  flac_encode_frame function the pts provided is frame's pts, if we feed
the encoder with small frames, an encoded packet will be valid after
several frames and the pts of the first packet won't be 0.

    avpkt->pts      = frame->pts;
    avpkt->duration = ff_samples_to_time_base(avctx, frame->nb_samples);
    avpkt->size     = out_bytes;

    s->next_pts = avpkt->pts + avpkt->duration;

I think a better code would be

    avpkt->pts      = s->next_pts;
    avpkt->duration = ff_samples_to_time_base(avctx, frame->nb_samples);
    avpkt->size     = out_bytes;

    s->next_pts = avpkt->pts + avpkt->duration;

I can push a patch if you agree with my analysis.

Olivier Ayache
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to