Mercurial > libavcodec.hg
comparison mpegaudiodec.c @ 143:35e3ced6cfd9 libavcodec
* fixed decoding busy loop
author | kabi |
---|---|
date | Wed, 31 Oct 2001 19:40:53 +0000 |
parents | 42a36eb08c8d |
children | 1e5f64be86fc |
comparison
equal
deleted
inserted
replaced
142:da4c751fc151 | 143:35e3ced6cfd9 |
---|---|
2268 /* no header seen : find one. We need at least HEADER_SIZE | 2268 /* no header seen : find one. We need at least HEADER_SIZE |
2269 bytes to parse it */ | 2269 bytes to parse it */ |
2270 len = HEADER_SIZE - len; | 2270 len = HEADER_SIZE - len; |
2271 if (len > buf_size) | 2271 if (len > buf_size) |
2272 len = buf_size; | 2272 len = buf_size; |
2273 else if (len > 0) { | 2273 if (len > 0) { |
2274 memcpy(s->inbuf_ptr, buf_ptr, len); | 2274 memcpy(s->inbuf_ptr, buf_ptr, len); |
2275 buf_ptr += len; | 2275 buf_ptr += len; |
2276 buf_size -= len; | 2276 buf_size -= len; |
2277 s->inbuf_ptr += len; | 2277 s->inbuf_ptr += len; |
2278 } | 2278 } |
2279 if ((s->inbuf_ptr - s->inbuf) >= HEADER_SIZE) { | 2279 if ((s->inbuf_ptr - s->inbuf) >= HEADER_SIZE) { |
2280 got_header: | 2280 got_header: |
2281 header = (s->inbuf[0] << 24) | (s->inbuf[1] << 16) | | 2281 header = (s->inbuf[0] << 24) | (s->inbuf[1] << 16) | |
2282 (s->inbuf[2] << 8) | s->inbuf[3]; | 2282 (s->inbuf[2] << 8) | s->inbuf[3]; |
2283 | |
2283 if (check_header(header) < 0) { | 2284 if (check_header(header) < 0) { |
2284 /* no sync found : move by one byte (inefficient, but simple!) */ | 2285 /* no sync found : move by one byte (inefficient, but simple!) */ |
2285 memcpy(s->inbuf, s->inbuf + 1, s->inbuf_ptr - s->inbuf - 1); | 2286 memcpy(s->inbuf, s->inbuf + 1, s->inbuf_ptr - s->inbuf - 1); |
2286 s->inbuf_ptr--; | 2287 s->inbuf_ptr--; |
2287 dprintf("skip %x\n", header); | 2288 dprintf("skip %x\n", header); |