diff --git a/services/capture/deltacast-bridge/main.c b/services/capture/deltacast-bridge/main.c index 91635d0..d38e3e2 100644 --- a/services/capture/deltacast-bridge/main.c +++ b/services/capture/deltacast-bridge/main.c @@ -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) {