[FFmpeg-devel] [PATCH] examples/muxing: set timestamps in output audio packet
Stefano Sabatini
stefasab at gmail.com
Thu Jan 9 11:00:41 CET 2014
On date Thursday 2014-01-09 02:32:11 +0100, Michael Niedermayer encoded:
> On Thu, Jan 09, 2014 at 01:08:57AM +0100, Stefano Sabatini wrote:
[...]
> > From: Stefano Sabatini <stefasab at gmail.com>
> > Date: Wed, 8 Jan 2014 15:43:25 +0100
> > Subject: [PATCH] examples/muxing: set timestamps in output audio packet
> >
> > In particular, fix trac ticket #3231.
> > ---
> > doc/examples/muxing.c | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git a/doc/examples/muxing.c b/doc/examples/muxing.c
> > index 8edef00..14913d0 100644
> > --- a/doc/examples/muxing.c
> > +++ b/doc/examples/muxing.c
> > @@ -148,6 +148,7 @@ static void open_audio(AVFormatContext *oc, AVCodec *codec, AVStream *st)
> > fprintf(stderr, "Could not allocate audio frame\n");
> > exit(1);
> > }
> > + audio_frame->pts = 0;
> >
> > /* open it */
> > ret = avcodec_open2(c, codec, NULL);
> > @@ -269,6 +270,7 @@ static void write_audio_frame(AVFormatContext *oc, AVStream *st)
> > }
> >
> > audio_frame->nb_samples = dst_nb_samples;
> > + audio_frame->pts += av_rescale_q(dst_nb_samples, (AVRational){1, c->sample_rate}, c->time_base);
>
> this looks like it would accumulate rounding errors (especially bad as
> this is a example other might base their code on)
> otherwise it should be ok
Fixed and applied, thanks for the reviews.
--
FFmpeg = Frenzy & Fiendish Maxi Powered Exxagerate Genius
More information about the ffmpeg-devel
mailing list