af_aresample: Consider the swresample delay during calculating timestamps.
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 18 May 2012 21:03:27 +0000 (23:03 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 18 May 2012 21:03:27 +0000 (23:03 +0200)
The difference from this should be pretty small.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavfilter/af_aresample.c

index 91aee91..e33620a 100644 (file)
@@ -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;
     }