diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-09-08 20:36:19 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-09-08 20:53:37 +0200 |
commit | 0b99e858d1ab8098b67a86c6fe27782ac2265cbe (patch) | |
tree | 2760c0dffe48b3dd8ae290dadd216c2f7cd519b4 | |
parent | 59810f8388ab4e746229b2e0048aa9eb4f36bdd7 (diff) | |
download | ffmpeg-0b99e858d1ab8098b67a86c6fe27782ac2265cbe.tar.gz |
ffmdec: fix seeking for non indexed files
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/ffmdec.c | 2 | ||||
-rw-r--r-- | tests/ref/seek/lavf_ffm | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c index 0747f8dbe0..42c1466e44 100644 --- a/libavformat/ffmdec.c +++ b/libavformat/ffmdec.c @@ -461,7 +461,7 @@ static int ffm_seek(AVFormatContext *s, int stream_index, int64_t wanted_pts, in av_dlog(s, "wanted_pts=%0.6f\n", wanted_pts / 1000000.0); /* find the position using linear interpolation (better than dichotomy in typical cases) */ - if (ffm->write_index < ffm->file_size) { + if (ffm->write_index && ffm->write_index < ffm->file_size) { if (get_dts(s, FFM_PACKET_SIZE) < wanted_pts) { pos_min = FFM_PACKET_SIZE; pos_max = ffm->write_index - FFM_PACKET_SIZE; diff --git a/tests/ref/seek/lavf_ffm b/tests/ref/seek/lavf_ffm index 46cf764c88..2218d4fd85 100644 --- a/tests/ref/seek/lavf_ffm +++ b/tests/ref/seek/lavf_ffm @@ -4,7 +4,7 @@ ret: 0 st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos: 8192 size: 24664 ret: 0 st:-1 flags:1 ts: 1.894167 ret: 0 st: 1 flags:1 dts: 0.940408 pts: 0.940408 pos: 376832 size: 209 ret: 0 st: 0 flags:0 ts: 0.788334 -ret: 0 st: 1 flags:1 dts: 0.783673 pts: 0.783673 pos: 315392 size: 209 +ret: 0 st: 1 flags:1 dts: 0.809796 pts: 0.809796 pos: 327680 size: 209 ret: 0 st: 0 flags:1 ts:-0.317499 ret: 0 st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos: 8192 size: 24664 ret: 0 st: 1 flags:0 ts: 2.576668 @@ -12,7 +12,7 @@ ret: 0 st: 1 flags:1 dts: 0.940408 pts: 0.940408 pos: 376832 size: 209 ret: 0 st: 1 flags:1 ts: 1.470835 ret: 0 st: 1 flags:1 dts: 0.940408 pts: 0.940408 pos: 376832 size: 209 ret: 0 st:-1 flags:0 ts: 0.365002 -ret: 0 st: 1 flags:1 dts: 0.339592 pts: 0.339592 pos: 155648 size: 209 +ret: 0 st: 1 flags:1 dts: 0.365714 pts: 0.365714 pos: 163840 size: 209 ret: 0 st:-1 flags:1 ts:-0.740831 ret: 0 st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos: 8192 size: 24664 ret: 0 st: 0 flags:0 ts: 2.153336 @@ -40,7 +40,7 @@ ret: 0 st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos: 8192 size: 24664 ret: 0 st:-1 flags:1 ts: 1.989173 ret: 0 st: 1 flags:1 dts: 0.940408 pts: 0.940408 pos: 376832 size: 209 ret: 0 st: 0 flags:0 ts: 0.883340 -ret: 0 st: 0 flags:0 dts: 0.880000 pts: 0.920000 pos: 339968 size: 12307 +ret: 0 st: 1 flags:1 dts: 0.888163 pts: 0.888163 pos: 352256 size: 209 ret: 0 st: 0 flags:1 ts:-0.222493 ret: 0 st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos: 8192 size: 24664 ret: 0 st: 1 flags:0 ts: 2.671674 @@ -48,6 +48,6 @@ ret: 0 st: 1 flags:1 dts: 0.940408 pts: 0.940408 pos: 376832 size: 209 ret: 0 st: 1 flags:1 ts: 1.565841 ret: 0 st: 1 flags:1 dts: 0.940408 pts: 0.940408 pos: 376832 size: 209 ret: 0 st:-1 flags:0 ts: 0.460008 -ret: 0 st: 1 flags:1 dts: 0.444082 pts: 0.444082 pos: 204800 size: 209 +ret: 0 st: 1 flags:1 dts: 0.496327 pts: 0.496327 pos: 221184 size: 209 ret: 0 st:-1 flags:1 ts:-0.645825 ret: 0 st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos: 8192 size: 24664 |