This allows libavcodec to use the input packet pts when determining output
frame pts.
---
 avconv.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/avconv.c b/avconv.c
index 2f30ebc..3767198 100644
--- a/avconv.c
+++ b/avconv.c
@@ -1085,6 +1085,11 @@ static int decode_audio(InputStream *ist, AVPacket *pkt, 
int *got_output)
     int bps = av_get_bytes_per_sample(ist->st->codec->sample_fmt);
     int i, ret, resample_changed;
 
+    /* rescale pts to decoder time base */
+    if (pkt->pts != AV_NOPTS_VALUE)
+        pkt->pts = av_rescale_q(pkt->pts, ist->st->time_base,
+                                ist->st->codec->time_base);
+
     if (!ist->decoded_frame && !(ist->decoded_frame = avcodec_alloc_frame()))
         return AVERROR(ENOMEM);
     else
@@ -1210,10 +1215,6 @@ static int decode_audio(InputStream *ist, AVPacket *pkt, 
int *got_output)
             }
     }
 
-    if (decoded_frame->pts != AV_NOPTS_VALUE)
-        decoded_frame->pts = av_rescale_q(decoded_frame->pts,
-                                          ist->st->time_base,
-                                          (AVRational){1, 
ist->st->codec->sample_rate});
     for (i = 0; i < ist->nb_filters; i++)
         av_buffersrc_write_frame(ist->filters[i]->filter, decoded_frame);
 
-- 
1.7.1

_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to