diff --git a/nodes/videoin/main.cpp b/nodes/videoin/main.cpp index 0361a42..63f1d57 100644 --- a/nodes/videoin/main.cpp +++ b/nodes/videoin/main.cpp @@ -117,7 +117,7 @@ class VideoInNode : public dmf::NodeBase { if (has_video) { const uint64_t ns = mxlGetNsUntilIndex(video_index + 1, &video_rate); if (ns > 0 && ns < 2'000'000'000ULL) mxlSleepForNs(ns); - video_index++; + video_index = mxlGetCurrentIndex(&video_rate); } } else if (frame_kind == dmf::VideoReader::FrameKind::Audio) { if (has_video && vst == MXL_STATUS_OK) mxlFlowWriterCancelGrain(video_writer); @@ -159,6 +159,10 @@ class VideoInNode : public dmf::NodeBase { } mxlFlowWriterCommitSamples(audio_writer); audio_index += out_samples_written; + if (has_video) { + const uint64_t current = mxlGetCurrentIndex(&video_rate); + if (current > video_index) video_index = current; + } } }