summaryrefslogtreecommitdiffstats
path: root/apps/codecs
diff options
context:
space:
mode:
authorAndree Buschmann <AndreeBuschmann@t-online.de>2011-04-26 21:30:51 +0000
committerAndree Buschmann <AndreeBuschmann@t-online.de>2011-04-26 21:30:51 +0000
commitdcf0f8de4a37ff1d2ea510aef75fa67977a8bdcc (patch)
tree70c20a923be952aaaade669db89b1e180a9c95f6 /apps/codecs
parent05c329060829f34d1e898a8761fe1e9114693a4f (diff)
downloadrockbox-dcf0f8de4a37ff1d2ea510aef75fa67977a8bdcc.tar.gz
rockbox-dcf0f8de4a37ff1d2ea510aef75fa67977a8bdcc.tar.bz2
rockbox-dcf0f8de4a37ff1d2ea510aef75fa67977a8bdcc.zip
Submit FS#12081. Check validity of channel configuration, comment unneeded code that is too inflexible to work with MAX_CHANNELS = 2. Fixes compiler warnings with GCC 4.6.0.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29784 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs')
-rw-r--r--apps/codecs/libfaad/decoder.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/apps/codecs/libfaad/decoder.c b/apps/codecs/libfaad/decoder.c
index c374ad3284..05d788597e 100644
--- a/apps/codecs/libfaad/decoder.c
+++ b/apps/codecs/libfaad/decoder.c
@@ -77,8 +77,9 @@ static int16_t s_lt_pred_stat[MAX_CHANNELS][4*FRAME_LEN] MEM_ALIGN_ATTR;
/* static function declarations */
static void* aac_frame_decode(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo,
uint8_t *buffer, uint32_t buffer_size);
+/* not used by rockbox
static void create_channel_config(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo);
-
+*/
char* NEAACDECAPI NeAACDecGetErrorMessage(uint8_t errcode)
{
@@ -305,6 +306,12 @@ int32_t NEAACDECAPI NeAACDecInit(NeAACDecHandle hDecoder, uint8_t *buffer,
}
#endif
+ /* A maximum of MAX_CHANNELS channels is supported. */
+ if (*channels > MAX_CHANNELS)
+ {
+ return -1;
+ }
+
#ifdef SBR_DEC
/* implicit signalling */
if (*samplerate <= 24000 && !(hDecoder->config.dontUpSampleImplicitSBR))
@@ -399,6 +406,13 @@ int8_t NEAACDECAPI NeAACDecInit2(NeAACDecHandle hDecoder, uint8_t *pBuffer,
*channels = 2;
}
#endif
+
+ /* A maximum of MAX_CHANNELS channels is supported. */
+ if (*channels > MAX_CHANNELS)
+ {
+ return -1;
+ }
+
hDecoder->sf_index = mp4ASC.samplingFrequencyIndex;
hDecoder->object_type = mp4ASC.objectTypeIndex;
#ifdef ERROR_RESILIENCE
@@ -520,6 +534,8 @@ void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hDecoder, int32_t frame)
}
}
+/* not used by rockbox */
+#if 0
static void create_channel_config(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo)
{
hInfo->num_front_channels = 0;
@@ -724,6 +740,7 @@ static void create_channel_config(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hI
}
}
}
+#endif
void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hDecoder,
NeAACDecFrameInfo *hInfo,
@@ -882,7 +899,9 @@ static void* aac_frame_decode(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo,
#endif
/* Make a channel configuration based on either a PCE or a channelConfiguration */
+ /* not used by rockbox
create_channel_config(hDecoder, hInfo);
+ */
/* number of samples in this frame */
hInfo->samples = frame_len*output_channels;