From f87e61e782b65e09f6b8c3caa9e0f55aaf5208cb Mon Sep 17 00:00:00 2001 From: nicodvb Date: Sat, 22 Jul 2006 22:14:14 +0000 Subject: the value returned by decode_audio() must be the amount of _decoded_ bytes (finally it's beginning t work: no more toomanypackets... message) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@19162 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/ad_hwmpa.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'libmpcodecs') diff --git a/libmpcodecs/ad_hwmpa.c b/libmpcodecs/ad_hwmpa.c index 1057b0d2e4..b1dfe1a0a8 100644 --- a/libmpcodecs/ad_hwmpa.c +++ b/libmpcodecs/ad_hwmpa.c @@ -59,7 +59,7 @@ static int mpa_sync(sh_audio_t *sh, int no_frames, int *n, int *chans, int *srat 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 @@ static int decode_audio(sh_audio_t *sh,unsigned char *buf,int minlen,int maxlen) { 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 @@ static int decode_audio(sh_audio_t *sh,unsigned char *buf,int minlen,int maxlen) 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; } -- cgit v1.2.3