[FFmpeg-devel] [PATCH] fix pcm_read_seek with negative timestamp

Kamry Abdallah kamryco
Sat Mar 14 13:59:38 CET 2009



--- On Sat, 3/14/09, Reimar D?ffinger <Reimar.Doeffinger at gmx.de> wrote:

From: Reimar D?ffinger <Reimar.Doeffinger at gmx.de>
Subject: [FFmpeg-devel] [PATCH] fix pcm_read_seek with negative timestamp
To: ffmpeg-devel at mplayerhq.hu
Date: Saturday, March 14, 2009, 4:04 AM


-----Inline Attachment Follows-----

Hello,
currently pcm_read seek for negative timestamps either seeks somewhere
before data_offset (clearly broken) or fails (possibly broken).
This patch treats negative time stamps as 0, which would be
consistent with the behaviour of the generic index handling code.
I am not really sure which behaviour is right, but I am convinced that
1) we should never seek before data_offset and 2) behaviour of the
different seek functions should be consistent.
Attached is the diff of the seek regression test, except for the flac
part, the changes are a supersection of what the GENERIC_INDEX patch
changes.

diff --git a/libavformat/raw.c b/libavformat/raw.c
index 224c26f..ba73dca 100644
--- a/libavformat/raw.c
+++ b/libavformat/raw.c
@@ -232,6 +232,7 @@ int pcm_read_seek(AVFormatContext *s,
 
? ???if (block_align <= 0 || byte_rate <= 0)
? ? ? ???return -1;
+? ? if (timestamp < 0) timestamp = 0;
 
? ???/* compute the position by aligning it to block_align */
? ???pos = av_rescale_rnd(timestamp * byte_rate,


Greetings,
Reimar D?ffinger

-----Inline Attachment Follows-----

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel at mplayerhq.hu
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel


      



More information about the ffmpeg-devel mailing list