# HG changeset patch # User nicodvb # Date 1153606454 0 # Node ID 597866a6793d21fe4df49807d2b9988ad24027f5 # Parent 79e011974b0ddcdab64dfe3dd4c1adbbe2fdfa0c the value returned by decode_audio() must be the amount of _decoded_ bytes (finally it's beginning t work: no more toomanypackets... message) diff -r 79e011974b0d -r 597866a6793d libmpcodecs/ad_hwmpa.c --- a/libmpcodecs/ad_hwmpa.c Sat Jul 22 18:57:56 2006 +0000 +++ b/libmpcodecs/ad_hwmpa.c Sat Jul 22 22:14:14 2006 +0000 @@ -59,7 +59,7 @@ static int preinit(sh_audio_t *sh) { - sh->audio_out_minsize = 48;//check + sh->audio_out_minsize = 4608;//check sh->audio_in_minsize = 4608;//check sh->sample_format = AF_FORMAT_MPEG2; return 1; @@ -85,13 +85,14 @@ { int len, start, tot; int chans, srate, spf, mpa_layer, br; + int tot2; - tot = 0; + tot = tot2 = 0; - while(tot < minlen) + while(tot2 < maxlen) { start = mpa_sync(sh, 1, &len, &chans, &srate, &spf, &mpa_layer, &br); - if(start < 0 || tot + len > maxlen) + if(start < 0 || tot2 + spf * 2 * chans > maxlen) break; if(start + len > sh->a_in_buffer_len) @@ -110,9 +111,10 @@ sh->a_in_buffer_len -= start + len; memmove(sh->a_in_buffer, &(sh->a_in_buffer[start + len]), sh->a_in_buffer_len); + tot2 += spf * 2 * chans; } - return tot; + return tot2; }