-
Notifications
You must be signed in to change notification settings - Fork 53
Open
Description
Checklist
- Checked the issue tracker for similar issues to ensure this is not a duplicate
- Read the documentation to confirm the issue is not addressed there and your configuration is set correctly
- Tested with the latest version to ensure the issue hasn't been fixed
How often does this bug occurs?
always
Expected behavior
esp_audio_enc_get_frame_size should output the right out_size and esp_audio_enc_process should never exceed this.
Actual behavior (suspected bug)
Some audio frames cause the AAC encoder behaviour where out_frame.encoded_bytes > out_frame.len and then overflows the out_frame.buffer.
assert(heap_caps_check_integrity_all(true)) shows this problem occurs when calling esp_audio_enc_process.
As a work-around I doubled the size of outframe.buffer. I've had some difficulties trying to pinpoint an audio frame that triggers the problem. Somehow the estimated time of the frame in my code is also wrong ?!?
Error logs or terminal output
Enter test for running.
5
Running AAC Encoder use Common API...
enc_info: sample_rate: 44100 channel:1 bits_per_sample:16 bitrate:90000 codec_spec_info:0x0 spec_info_len:0 in_size:2048 out_size:461
E (7218) DEC_TEST: frame_cnt:290 T=6.7s encoded_bytes:470 > len:461
E (7219) DEC_TEST: frame_cnt:290 written 8 bytes overflow of out_frame first 461 bytes!
I (7797) DEC_TEST: Finished. frame_cnt:469
MALLOC_CAP_8BIT usage: Free memory delta: 0 Leak threshold: -400
MALLOC_CAP_32BIT usage: Free memory delta: 0 Leak threshold: -400
./main/audio_encoder_test.c:244:AAC Encoder use Common API:PASS
Test ran in 1719msSteps to reproduce the behavior
git clone https://github.com/morgana2313/esp-adf-libs/tree/investigate-buffer-overflowidf.py.build flash- Choose menu option
5("AAC Encoder use Common API")
Project release version
master bddefe4
System architecture
ARM 64-bit (Apple M1/M2, Raspberry Pi 4/5)
Operating system
MacOS
Operating system version
MacOS 14.6.1 (23G93)
Shell
Bash
Additional context
No response
Metadata
Metadata
Assignees
Labels
No labels