Fix audio queue consume overrun (caused shutdown crash due to multiple buffers being queued)

This commit is contained in:
elasota
2020-01-19 19:25:36 -05:00
parent 1b5720c118
commit 3b11a457a3

View File

@@ -204,6 +204,13 @@ namespace PortabilityLayer
return;
case AudioCommandTypes::kCallback:
command.m_param.m_callback(this);
if (m_state != State_Idle)
{
// Child call changed state (i.e. callback called PushBuffer, which triggered a digest)
m_mutex->Unlock();
return;
}
break;
default:
assert(false);
@@ -215,6 +222,8 @@ namespace PortabilityLayer
void AudioChannelImpl::DigestBufferCommand(const void *dataPointer)
{
assert(m_state == State_Idle);
// At this point, the buffer should already be validated and converted, and the data pointer should point at the data tag
uint32_t length;
memcpy(&length, dataPointer, 4);