log audio device framing errors, copy as much data as we can, but don't assert

This commit is contained in:
Craig Hansen-Sturm 2014-09-10 16:48:35 -07:00
parent ca4d1375f5
commit 18975aef57

View file

@ -110,8 +110,16 @@ public:
if ( !_frameBuffer || !frames) {
return;
}
assert(channelCount <= _channelCountMax);
assert(frameCount <= _frameCountMax);
if (channelCount >_channelCountMax || frameCount >_frameCountMax) {
qDebug() << "Audio framing error: _channelCount=" << _channelCount << "channelCountMax=" << _channelCountMax;
qDebug() << "Audio framing error: _frameCount=" << _frameCount << "frameCountMax=" << _frameCountMax;
// This condition should never happen; however, we do our best to recover here copying as many frames
// as we have allocated
_channelCount = std::min(_channelCount,_channelCountMax);
_frameCount = std::min(_frameCount,_frameCountMax);
}
_frameCount = frameCount; // we allow copying fewer frames than we've allocated
_channelCount = channelCount; // we allow copying fewer channels that we've allocated