Core Audio input: Fix channel config, and a leak
Channel config should not contain duplicate channels, or unsupported channels. Also fix a memory leak from not freeing the AudioChannelLayout structure allocated previously. Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
parent
22d8b8c132
commit
b2177fccbc
1 changed files with 13 additions and 1 deletions
|
@ -220,12 +220,24 @@ static SInt64 getSizeProc(void *clientData) {
|
||||||
uint32_t config = 0;
|
uint32_t config = 0;
|
||||||
for(uint32_t i = 0; i < acl->mNumberChannelDescriptions; ++i) {
|
for(uint32_t i = 0; i < acl->mNumberChannelDescriptions; ++i) {
|
||||||
int channelNumber = ffat_get_channel_id(acl->mChannelDescriptions[i].mChannelLabel);
|
int channelNumber = ffat_get_channel_id(acl->mChannelDescriptions[i].mChannelLabel);
|
||||||
if(channelNumber >= 0)
|
if(channelNumber >= 0) {
|
||||||
|
if(config & (1 << channelNumber)) {
|
||||||
|
free(acl);
|
||||||
|
err = ExtAudioFileDispose(_in);
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
config |= 1 << channelNumber;
|
config |= 1 << channelNumber;
|
||||||
|
} else {
|
||||||
|
free(acl);
|
||||||
|
err = ExtAudioFileDispose(_in);
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
channelConfig = config;
|
channelConfig = config;
|
||||||
|
|
||||||
|
free(acl);
|
||||||
|
|
||||||
bitrate = (_bitrate + 500) / 1000;
|
bitrate = (_bitrate + 500) / 1000;
|
||||||
|
|
||||||
CFStringRef formatName;
|
CFStringRef formatName;
|
||||||
|
|
Loading…
Reference in a new issue