[FFmpeg-devel] [PATCH] matroskadec: Fix TTA duration calculation

James Almer jamrial at gmail.com
Thu Aug 15 11:22:47 CEST 2013


Still not perfect due to rounding errors, but several samples should
demux correctly now instead of none.

Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavformat/matroskadec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index d52877c..e4b11a2 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1738,7 +1738,7 @@ static int matroska_read_header(AVFormatContext *s)
             avio_wl16(&b, track->audio.channels);
             avio_wl16(&b, track->audio.bitdepth);
             avio_wl32(&b, track->audio.out_samplerate);
-            avio_wl32(&b, matroska->ctx->duration * track->audio.out_samplerate);
+            avio_wl32(&b, av_rescale(matroska->ctx->duration, track->audio.out_samplerate, AV_TIME_BASE));
         } else if (codec_id == AV_CODEC_ID_RV10 || codec_id == AV_CODEC_ID_RV20 ||
                    codec_id == AV_CODEC_ID_RV30 || codec_id == AV_CODEC_ID_RV40) {
             extradata_offset = 26;
-- 
1.8.1.5



More information about the ffmpeg-devel mailing list