On Mon, Nov 17, 2014 at 12:22 AM, Vittorio Giovara <[email protected]> wrote: > CC: [email protected] > Bug-Id: CID 1250330 / CID 1250335 > --- > libavcodec/libtwolame.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/libavcodec/libtwolame.c b/libavcodec/libtwolame.c > index 400985a..ce7c788 100644 > --- a/libavcodec/libtwolame.c > +++ b/libavcodec/libtwolame.c > @@ -100,7 +100,7 @@ static int twolame_encode_frame(AVCodecContext *avctx, > AVPacket *avpkt, > const AVFrame *frame, int *got_packet_ptr) > { > TWOLAMEContext *s = avctx->priv_data; > - int ret; > + int ret, samples; > > if ((ret = ff_alloc_packet(avpkt, MPA_MAX_CODED_FRAME_SIZE)) < 0) > return ret; > @@ -148,13 +148,16 @@ static int twolame_encode_frame(AVCodecContext *avctx, > AVPacket *avpkt, > if (ret < 0) // twolame error > return AVERROR_UNKNOWN; > > - avpkt->duration = ff_samples_to_time_base(avctx, frame->nb_samples); > if (frame) { > if (frame->pts != AV_NOPTS_VALUE) > avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, > avctx->initial_padding); > + samples = frame->nb_samples; > } else { > avpkt->pts = s->next_pts; > + samples = 0; > } > + avpkt->duration = ff_samples_to_time_base(avctx, samples); > + > // this is for setting pts for flushed packet(s). > if (avpkt->pts != AV_NOPTS_VALUE) > s->next_pts = avpkt->pts + avpkt->duration; > -- > 1.9.3 (Apple Git-50) >
ping -- Vittorio _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
