[FFmpeg-cvslog] af_aresample: Consider the swresample delay during calculating timestamps.

Michael Niedermayer git at videolan.org
Fri May 18 23:16:02 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri May 18 23:03:27 2012 +0200| [96ac8663deb71b5bff7a9f8ef45ccd361f698729] | committer: Michael Niedermayer

af_aresample: Consider the swresample delay during calculating timestamps.

The difference from this should be pretty small.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=96ac8663deb71b5bff7a9f8ef45ccd361f698729
---

 libavfilter/af_aresample.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavfilter/af_aresample.c b/libavfilter/af_aresample.c
index 91aee91..e33620a 100644
--- a/libavfilter/af_aresample.c
+++ b/libavfilter/af_aresample.c
@@ -184,7 +184,9 @@ static void filter_samples(AVFilterLink *inlink, AVFilterBufferRef *insamplesref
 
     if(insamplesref->pts != AV_NOPTS_VALUE) {
         aresample->next_pts =
-        outsamplesref->pts  = av_rescale_q(insamplesref->pts, inlink->time_base, outlink->time_base);
+        outsamplesref->pts  =  av_rescale_q(insamplesref->pts, inlink->time_base, outlink->time_base)
+                             - swr_get_delay(aresample->swr, outlink->time_base.den);
+        av_assert0(outlink->time_base.num == 1);
     } else{
         outsamplesref->pts  = AV_NOPTS_VALUE; //aresample->next_pts;
     }



More information about the ffmpeg-cvslog mailing list