Skip to content

Commit e78a52d

Browse files
authored
Add support for mono audio channel handling
Handle mono audio channels for ESP32-S3 and -P4 by duplicating samples.
1 parent 05538ef commit e78a52d

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/aac_decoder/aac_decoder.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* aac_decoder.cpp
33
* faad2 - ESP32 adaptation
44
* Created on: 12.09.2023
5-
* Updated on: 16.07.2026
5+
* Updated on: 18.07.2026
66
*/
77

88
#include "aac_decoder.h"
@@ -164,6 +164,14 @@ int32_t AACDecoder::decode(uint8_t* inbuf, int32_t* bytesLeft, int32_t* outbuf)
164164
if(getErrorMessage(abs(err)).level == AAC_VERBOSE) AAC_LOG_VERBOSE("{}", getErrorMessage(abs(err)).text);
165165
}
166166
} else {
167+
if (m_aacChannels == 1 && !m_frameInfo.isPS) { // ESP32-S3 and -P4 has ParametricStereo activated
168+
AAC_LOG_ERROR("1");
169+
for (int32_t i = m_validSamples - 1; i >= 0; i--) {
170+
int32_t sample = outbuf[i];
171+
outbuf[i * 2] = sample;
172+
outbuf[i * 2 + 1] = sample;
173+
}
174+
}
167175
}
168176
return err;
169177
}

0 commit comments

Comments
 (0)