From b81e5c8f3e1f94a0d059874d4edb5e934dedf0a1 Mon Sep 17 00:00:00 2001 From: Nicolas Hug Date: Fri, 5 Sep 2025 21:37:49 +0100 Subject: [PATCH] Assert deviceInterface_ exists when it should --- src/torchcodec/_core/SingleStreamDecoder.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/torchcodec/_core/SingleStreamDecoder.cpp b/src/torchcodec/_core/SingleStreamDecoder.cpp index 865179a18..864e82d0a 100644 --- a/src/torchcodec/_core/SingleStreamDecoder.cpp +++ b/src/torchcodec/_core/SingleStreamDecoder.cpp @@ -1246,7 +1246,11 @@ FrameOutput SingleStreamDecoder::convertAVFrameToFrameOutput( formatContext_->streams[activeStreamIndex_]->time_base); if (streamInfo.avMediaType == AVMEDIA_TYPE_AUDIO) { convertAudioAVFrameToFrameOutputOnCPU(avFrame, frameOutput); - } else if (deviceInterface_) { + } else { + TORCH_CHECK( + deviceInterface_ != nullptr, + "No device interface available for video decoding. This ", + "shouldn't happen, please report."); deviceInterface_->convertAVFrameToFrameOutput( streamInfo.videoStreamOptions, streamInfo.timeBase,