Skip to content

Commit 38caec7

Browse files
author
Daniel Flores
committed
restore original torch_check
1 parent 4bed34b commit 38caec7

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

src/torchcodec/_core/SingleStreamDecoder.cpp

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,20 +1276,16 @@ void SingleStreamDecoder::convertAudioAVFrameToFrameOutputOnCPU(
12761276
int outSampleRate =
12771277
streamInfo.audioStreamOptions.sampleRate.value_or(srcSampleRate);
12781278

1279-
int srcNumChannels = getNumChannels(srcAVFrame);
1280-
int srcNumChannelsFromCodec = getNumChannels(streamInfo.codecContext);
1281-
// Use number of channels from codec if 0 returned from frame
1282-
if (srcNumChannels == 0 && srcNumChannelsFromCodec > 0) {
1283-
srcNumChannels = srcNumChannelsFromCodec;
1284-
} else {
1285-
// Check if the number of channels from the frame matches the codec
1286-
TORCH_CHECK(
1287-
srcNumChannels == srcNumChannelsFromCodec,
1288-
"The frame has ",
1289-
srcNumChannels,
1290-
" channels, expected ",
1291-
srcNumChannelsFromCodec);
1292-
};
1279+
int srcNumChannels = getNumChannels(streamInfo.codecContext);
1280+
TORCH_CHECK(
1281+
srcNumChannels == getNumChannels(srcAVFrame),
1282+
"The frame has ",
1283+
getNumChannels(srcAVFrame),
1284+
" channels, expected ",
1285+
srcNumChannels,
1286+
". If you are hitting this, it may be because you are using "
1287+
"a buggy FFmpeg version. FFmpeg4 is known to fail here in some "
1288+
"valid scenarios. Try to upgrade FFmpeg?");
12931289
int outNumChannels =
12941290
streamInfo.audioStreamOptions.numChannels.value_or(srcNumChannels);
12951291

0 commit comments

Comments
 (0)