diff --git a/services/capture/deltacast-bridge/main.c b/services/capture/deltacast-bridge/main.c index 829f4bf..7adfaa9 100644 --- a/services/capture/deltacast-bridge/main.c +++ b/services/capture/deltacast-bridge/main.c @@ -320,6 +320,13 @@ static void *video_thread(void *arg) { BYTE *buf = NULL; ULONG sz = 0; if (VHD_GetSlotBuffer(slot, VHD_SDI_BT_VIDEO, &buf, &sz) == VHDERR_NOERROR) { + ULONG expected = (ULONG)ps->vi.width * (ULONG)ps->vi.height * 2; + if (sz != expected) { + fprintf(stderr, "[video:%u] WARN: slot sz=%lu != expected %lu (w=%d h=%d) -- packing mismatch; skipping frame\n", + ps->port, sz, expected, ps->vi.width, ps->vi.height); + VHD_UnlockSlotHandle(slot); + continue; + } if (write_all(fd, buf, sz) < 0) { /* EPIPE: sidecar died (session stop/restart). * Break to outer loop — reopen for next session. */ @@ -568,6 +575,10 @@ int main(int argc, char *argv[]) { VHD_SetStreamProperty(vs, VHD_SDI_SP_CLOCK_SYSTEM, p->clock_div); VHD_SetStreamProperty(vs, VHD_CORE_SP_TRANSFER_SCHEME, VHD_TRANSFER_SLAVED); VHD_SetStreamProperty(vs, VHD_CORE_SP_BUFFERQUEUE_DEPTH, 8); + /* Pin to tightly-packed 8-bit UYVY. Relying on SDK default caused + * the board to deliver frames whose size != width*height*2, + * producing rolled/sheared ("bouncing and bending") video. */ + VHD_SetStreamProperty(vs, VHD_CORE_SP_BUFFER_PACKING, VHD_BUFPACK_VIDEO_YUV422_8); p->video_stream = vs; if (VHD_StartStream(vs) != VHDERR_NOERROR) {