Skip to content

Commit e12e466

Browse files
authored
Assert deviceInterface_ exists when it should (#875)
1 parent beeeb1c commit e12e466

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/torchcodec/_core/SingleStreamDecoder.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1246,7 +1246,11 @@ FrameOutput SingleStreamDecoder::convertAVFrameToFrameOutput(
12461246
formatContext_->streams[activeStreamIndex_]->time_base);
12471247
if (streamInfo.avMediaType == AVMEDIA_TYPE_AUDIO) {
12481248
convertAudioAVFrameToFrameOutputOnCPU(avFrame, frameOutput);
1249-
} else if (deviceInterface_) {
1249+
} else {
1250+
TORCH_CHECK(
1251+
deviceInterface_ != nullptr,
1252+
"No device interface available for video decoding. This ",
1253+
"shouldn't happen, please report.");
12501254
deviceInterface_->convertAVFrameToFrameOutput(
12511255
streamInfo.videoStreamOptions,
12521256
streamInfo.timeBase,

0 commit comments

Comments
 (0)