From 876736b6deeba1576a4c7d9ccf1e05d883c0d244 Mon Sep 17 00:00:00 2001 From: waker Date: Sun, 20 Feb 2011 21:20:49 +0100 Subject: fixed samplerate bug in aac plugin --- plugins/aac/aac.c | 11 +++++------ plugins/aac/aac_parser.c | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'plugins') diff --git a/plugins/aac/aac.c b/plugins/aac/aac.c index fefb48ee..693678f5 100644 --- a/plugins/aac/aac.c +++ b/plugins/aac/aac.c @@ -186,7 +186,7 @@ parse_aac_stream(DB_FILE *fp, int *psamplerate, int *pchannels, float *pduration continue; } else { - trace ("aac: frame #%d sync: %d %d %d %d %d\n", frame, channels, samplerate, bitrate, samples, size); + trace ("aac: frame #%d sync: %dch %d %d %d %d\n", frame, channels, samplerate, bitrate, samples, size); frame++; nsamples += samples; if (!stream_sr) { @@ -563,8 +563,6 @@ aac_init (DB_fileinfo_t *_info, DB_playItem_t *it) { trace ("aac: parse_aac_stream failed\n"); return -1; } - _info->fmt.channels = channels; - _info->fmt.samplerate = samplerate*2; trace("parse_aac_stream returned %x\n", offs); } @@ -587,7 +585,7 @@ aac_init (DB_fileinfo_t *_info, DB_playItem_t *it) { info->remaining = deadbeef->fread (info->buffer, 1, AAC_BUFFER_SIZE, info->file); NeAACDecConfigurationPtr conf = NeAACDecGetCurrentConfiguration (info->dec); - conf->dontUpSampleImplicitSBR = 1; +// conf->dontUpSampleImplicitSBR = 1; NeAACDecSetConfiguration (info->dec, conf); unsigned long srate; unsigned char ch; @@ -610,6 +608,7 @@ aac_init (DB_fileinfo_t *_info, DB_playItem_t *it) { info->remaining -= consumed; } _info->fmt.channels = ch; + _info->fmt.samplerate = srate; } if (!info->file->vfs->is_streaming ()) { @@ -822,8 +821,8 @@ aac_read (DB_fileinfo_t *_info, char *bytes, int size) { samples = NeAACDecDecode (info->dec, &info->frame_info, info->buffer, info->remaining); if (!samples) { trace ("NeAACDecDecode failed, consumed=%d\n", info->frame_info.bytesconsumed); - if (info->num_errors > 10) { - trace ("NeAACDecDecode failed 10 times, interrupting\n"); + if (info->num_errors > 10 || info->frame_info.bytesconsumed == 0) { + trace ("NeAACDecDecode failed 3 times, interrupting\n"); break; } info->num_errors++; diff --git a/plugins/aac/aac_parser.c b/plugins/aac/aac_parser.c index 2a86974c..07c1ca6a 100644 --- a/plugins/aac/aac_parser.c +++ b/plugins/aac/aac_parser.c @@ -77,7 +77,7 @@ aac_sync(const uint8_t *buf, int *channels, int *sample_rate, int *bit_rate, int //trace ("invalid channels\n"); return 0; } - trace ("channels %d\n", aac_channels[channel_conf]); + trace ("channels %d (#%d)\n", aac_channels[channel_conf], channel_conf); int orig_copy = (buf[3] & 0x20) >> 5; int home = (buf[3] & 0x10) >> 4; int copyright_ident_bit = (buf[3] & 0x08) >> 3; -- cgit v1.2.3