coreaudio-encoder: Fix input buffer freeing in complex_input_data_proc

When the bitrate was set to 64 CoreAudio would call
complex_input_data_proc more than once, which in turn would cause
consumed bytes in the input buffer to be "freed" more than once (once
for every additional call of complex_input_data_proc and once in
aac_encode)
master
Palana 2015-06-07 05:33:12 +02:00
parent 4a75f79af3
commit f02db95d07
1 changed files with 3 additions and 1 deletions

View File

@ -366,8 +366,10 @@ static OSStatus complex_input_data_proc(AudioConverterRef inAudioConverter,
ca_encoder *ca = inUserData;
if (ca->bytes_read)
if (ca->bytes_read) {
da_erase_range(ca->input_buffer, 0, ca->bytes_read);
ca->bytes_read = 0;
}
if (ca->input_buffer.num < ca->in_bytes_required) {
*ioNumberDataPackets = 0;