Commit 04fe7201 authored by David Reid's avatar David Reid

Experimental fix for an hang when stopping devices.

Public issue https://github.com/mackron/miniaudio/issues/355
parent 5a5d523d
...@@ -12673,6 +12673,11 @@ static ma_result ma_device_audio_thread__default_read_write(ma_device* pDevice) ...@@ -12673,6 +12673,11 @@ static ma_result ma_device_audio_thread__default_read_write(ma_device* pDevice)
} }
} }
/* Make sure we don't get stuck in the inner loop. */
if (capturedDeviceFramesProcessed == 0) {
break;
}
totalCapturedDeviceFramesProcessed += capturedDeviceFramesProcessed; totalCapturedDeviceFramesProcessed += capturedDeviceFramesProcessed;
} }
} break; } break;
...@@ -12696,6 +12701,11 @@ static ma_result ma_device_audio_thread__default_read_write(ma_device* pDevice) ...@@ -12696,6 +12701,11 @@ static ma_result ma_device_audio_thread__default_read_write(ma_device* pDevice)
break; break;
} }
/* Make sure we don't get stuck in the inner loop. */
if (framesProcessed == 0) {
break;
}
ma_device__send_frames_to_client(pDevice, framesProcessed, capturedDeviceData); ma_device__send_frames_to_client(pDevice, framesProcessed, capturedDeviceData);
framesReadThisPeriod += framesProcessed; framesReadThisPeriod += framesProcessed;
...@@ -12723,6 +12733,11 @@ static ma_result ma_device_audio_thread__default_read_write(ma_device* pDevice) ...@@ -12723,6 +12733,11 @@ static ma_result ma_device_audio_thread__default_read_write(ma_device* pDevice)
break; break;
} }
/* Make sure we don't get stuck in the inner loop. */
if (framesProcessed == 0) {
break;
}
framesWrittenThisPeriod += framesProcessed; framesWrittenThisPeriod += framesProcessed;
} }
} break; } break;
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