[FFmpeg-devel] [PATCH]Stop demuxing wtv on eof

Carl Eugen Hoyos cehoyos at ag.or.at
Wed Oct 1 18:18:56 CEST 2014


Hi!

Attached patch fixes the wtv regression described in tickets #3991 and #3995 
for me.

Please review, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c
index 4cb3295..674ff6e 100644
--- a/libavformat/wtvdec.c
+++ b/libavformat/wtvdec.c
@@ -789,6 +789,8 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p
         len = avio_rl32(pb);
         if (len < 32) {
             int ret;
+            if (avio_feof(pb))
+                return AVERROR(EOF);
             av_log(s, AV_LOG_WARNING, "encountered broken chunk\n");
             if ((ret = recover(wtv, avio_tell(pb) - 20)) < 0)
                 return ret;
diff --git a/tests/ref/seek/lavf-wtv b/tests/ref/seek/lavf-wtv
index 355ab98..13c64a6 100644
--- a/tests/ref/seek/lavf-wtv
+++ b/tests/ref/seek/lavf-wtv
@@ -7,28 +7,32 @@ ret: 0         st: 0 flags:0  ts: 0.788334
 ret: 0         st: 1 flags:1 dts: 0.734399 pts: 0.734399 pos: 294672 size:   209
 ret: 0         st: 0 flags:1  ts:-0.317499
 ret: 0         st: 1 flags:1 dts: 0.029093 pts: 0.029093 pos:  26272 size:   208
-ret:-1         st: 1 flags:0  ts: 2.576668
+ret: 0         st: 1 flags:0  ts: 2.576668
+ret:-EOF
 ret: 0         st: 1 flags:1  ts: 1.470835
 ret: 0         st: 1 flags:1 dts: 0.734399 pts: 0.734399 pos: 294672 size:   209
 ret: 0         st:-1 flags:0  ts: 0.365002
 ret: 0         st: 1 flags:1 dts: 0.029093 pts: 0.029093 pos:  26272 size:   208
 ret: 0         st:-1 flags:1  ts:-0.740831
 ret: 0         st: 1 flags:1 dts: 0.029093 pts: 0.029093 pos:  26272 size:   208
-ret:-1         st: 0 flags:0  ts: 2.153336
+ret: 0         st: 0 flags:0  ts: 2.153336
+ret:-EOF
 ret: 0         st: 0 flags:1  ts: 1.047503
 ret: 0         st: 1 flags:1 dts: 0.029093 pts: 0.029093 pos:  26272 size:   208
 ret: 0         st: 1 flags:0  ts:-0.058330
 ret: 0         st: 1 flags:1 dts: 0.029093 pts: 0.029093 pos:  26272 size:   208
 ret: 0         st: 1 flags:1  ts: 2.835837
 ret: 0         st: 1 flags:1 dts: 0.734399 pts: 0.734399 pos: 294672 size:   209
-ret:-1         st:-1 flags:0  ts: 1.730004
+ret: 0         st:-1 flags:0  ts: 1.730004
+ret:-EOF
 ret: 0         st:-1 flags:1  ts: 0.624171
 ret: 0         st: 1 flags:1 dts: 0.029093 pts: 0.029093 pos:  26272 size:   208
 ret: 0         st: 0 flags:0  ts:-0.481662
 ret: 0         st: 1 flags:1 dts: 0.029093 pts: 0.029093 pos:  26272 size:   208
 ret: 0         st: 0 flags:1  ts: 2.412505
 ret: 0         st: 1 flags:1 dts: 0.734399 pts: 0.734399 pos: 294672 size:   209
-ret:-1         st: 1 flags:0  ts: 1.306672
+ret: 0         st: 1 flags:0  ts: 1.306672
+ret:-EOF
 ret: 0         st: 1 flags:1  ts: 0.200839
 ret: 0         st: 1 flags:1 dts: 0.211950 pts: 0.211950 pos:  99280 size:   209
 ret: 0         st:-1 flags:0  ts:-0.904994
@@ -39,7 +43,8 @@ ret: 0         st: 0 flags:0  ts: 0.883340
 ret: 0         st: 1 flags:1 dts: 0.734399 pts: 0.734399 pos: 294672 size:   209
 ret: 0         st: 0 flags:1  ts:-0.222493
 ret: 0         st: 1 flags:1 dts: 0.029093 pts: 0.029093 pos:  26272 size:   208
-ret:-1         st: 1 flags:0  ts: 2.671674
+ret: 0         st: 1 flags:0  ts: 2.671674
+ret:-EOF
 ret: 0         st: 1 flags:1  ts: 1.565841
 ret: 0         st: 1 flags:1 dts: 0.734399 pts: 0.734399 pos: 294672 size:   209
 ret: 0         st:-1 flags:0  ts: 0.460008


More information about the ffmpeg-devel mailing list