Commit 6b4473b8 authored by Pierre-Eric Pelloux-Prayer's avatar Pierre-Eric Pelloux-Prayer
Browse files

ios: fill sound buffer with 0s until filter startup

parent d1e35053
......@@ -243,31 +243,30 @@ static OSStatus au_render_cb (
ms_debug("render cb");
AUData *d=(AUData*)inRefCon;
if (d->write_started == TRUE) {
ioData->mBuffers[0].mDataByteSize=inNumberFrames*d->bits/8;
ioData->mNumberBuffers=1;
ioData->mBuffers[0].mDataByteSize=inNumberFrames*d->bits/8;
ioData->mNumberBuffers=1;
ms_mutex_lock(&d->mutex);
if(ms_bufferizer_get_avail(d->bufferizer) >= inNumberFrames*d->bits/8) {
ms_bufferizer_read(d->bufferizer, ioData->mBuffers[0].mData, inNumberFrames*d->bits/8);
ms_mutex_lock(&d->mutex);
if(d->write_started && ms_bufferizer_get_avail(d->bufferizer) >= inNumberFrames*d->bits/8) {
ms_bufferizer_read(d->bufferizer, ioData->mBuffers[0].mData, inNumberFrames*d->bits/8);
if (ms_bufferizer_get_avail(d->bufferizer) >10*inNumberFrames*d->bits/8) {
ms_debug("we are late, bufferizer sise is %i bytes in framezize is %i bytes",ms_bufferizer_get_avail(d->bufferizer),inNumberFrames*d->bits/8);
if (ms_bufferizer_get_avail(d->bufferizer) >10*inNumberFrames*d->bits/8) {
ms_debug("we are late, bufferizer sise is %i bytes in framezize is %i bytes",ms_bufferizer_get_avail(d->bufferizer),inNumberFrames*d->bits/8);
ms_bufferizer_flush(d->bufferizer);
}
ms_mutex_unlock(&d->mutex);
} else {
}
ms_mutex_unlock(&d->mutex);
ms_mutex_unlock(&d->mutex);
memset(ioData->mBuffers[0].mData, 0,ioData->mBuffers[0].mDataByteSize);
ms_debug("nothing to write, pushing silences, bufferizer size is %i bytes in framezize is %i bytes mDataByteSize %i"
,ms_bufferizer_get_avail(d->bufferizer)
,inNumberFrames*d->bits/8
,ioData->mBuffers[0].mDataByteSize);
d->n_lost_frame+=inNumberFrames;
}
} else {
ms_mutex_unlock(&d->mutex);
memset(ioData->mBuffers[0].mData, 0,ioData->mBuffers[0].mDataByteSize);
ms_debug("nothing to write (started=%d), pushing silences, bufferizer size is %i bytes in framezize is %i bytes mDataByteSize %i"
,d->write_started
,ms_bufferizer_get_avail(d->bufferizer)
,inNumberFrames*d->bits/8
,ioData->mBuffers[0].mDataByteSize);
d->n_lost_frame+=inNumberFrames;
}
if (!d->is_ringer) { // no need to read in ringer mode
AudioBufferList readAudioBufferList;
readAudioBufferList.mBuffers[0].mDataByteSize=inNumberFrames*d->bits/8;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment