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,