These blocks don't report audio stream parameters and they are not needed
for decoding.
Signed-off-by: Mans Rullgard <mans@mansr.com>
... | ... |
@@ -110,6 +110,9 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen |
110 | 110 |
size = wc->blksize; |
111 | 111 |
} |
112 | 112 |
wc->flags = AV_RL32(wc->extra + 4); |
113 |
+ // blocks with zero samples don't contain actual audio information and should be ignored |
|
114 |
+ if (!AV_RN32(wc->extra)) |
|
115 |
+ return 0; |
|
113 | 116 |
//parse flags |
114 | 117 |
bpp = ((wc->flags & 3) + 1) << 3; |
115 | 118 |
chan = 1 + !(wc->flags & WV_MONO); |
... | ... |
@@ -207,8 +210,14 @@ static int wv_read_header(AVFormatContext *s, |
207 | 207 |
AVStream *st; |
208 | 208 |
|
209 | 209 |
wc->block_parsed = 0; |
210 |
- if(wv_read_block_header(s, pb, 0) < 0) |
|
211 |
- return -1; |
|
210 |
+ for(;;){ |
|
211 |
+ if(wv_read_block_header(s, pb, 0) < 0) |
|
212 |
+ return -1; |
|
213 |
+ if(!AV_RN32(wc->extra)) |
|
214 |
+ avio_skip(pb, wc->blksize - 24); |
|
215 |
+ else |
|
216 |
+ break; |
|
217 |
+ } |
|
212 | 218 |
|
213 | 219 |
/* now we are ready: build format streams */ |
214 | 220 |
st = av_new_stream(s, 0); |