fix(capture): handle partial writes in audio_thread FIFO write loop
This commit is contained in:
parent
67c071a0ee
commit
c7e07df515
1 changed files with 8 additions and 1 deletions
|
|
@ -141,7 +141,14 @@ static void *audio_thread(void *arg) {
|
|||
ai.pAudioGroups[0].pAudioChannels[0].DataSize = buf_sz;
|
||||
if (VHD_SlotExtractAudio(slot, &ai) == VHDERR_NOERROR) {
|
||||
ULONG sz = ai.pAudioGroups[0].pAudioChannels[0].DataSize;
|
||||
if (sz > 0) write(fd, buf, sz);
|
||||
if (sz > 0) {
|
||||
ULONG aw = 0;
|
||||
while (aw < sz) {
|
||||
ssize_t n = write(fd, buf + aw, sz - aw);
|
||||
if (n <= 0) { atomic_store(&g_stop, 1); break; }
|
||||
aw += (ULONG)n;
|
||||
}
|
||||
}
|
||||
}
|
||||
VHD_UnlockSlotHandle(slot);
|
||||
} else if (r != VHDERR_TIMEOUT) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue