Skip to content

Commit 73130b4

Browse files
author
Daniel Flores
committed
incorporate suggestions
1 parent 38caec7 commit 73130b4

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/torchcodec/_core/FFMPEGCommon.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ int getNumChannels(const UniqueAVFrame& avFrame) {
6767
// to allow successful initialization of SwrContext
6868
if (numChannels == 0 && avFrame->channels > 0) {
6969
avFrame->channel_layout = av_get_default_channel_layout(avFrame->channels);
70-
return avFrame->channels;
70+
numChannels = avFrame->channels;
7171
}
7272
return numChannels;
7373
#endif

test/test_decoders.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1692,14 +1692,14 @@ def test_decode_s16_ffmpeg4(self):
16921692
assert decoder.metadata.sample_rate == asset.sample_rate
16931693
assert decoder.metadata.sample_format == asset.sample_format
16941694

1695-
test_frames = decoder.get_samples_played_in_range()
1696-
assert test_frames.data.shape[0] == decoder.metadata.num_channels
1697-
assert test_frames.sample_rate == decoder.metadata.sample_rate
1695+
test_samples = decoder.get_samples_played_in_range()
1696+
assert test_samples.data.shape[0] == decoder.metadata.num_channels
1697+
assert test_samples.sample_rate == decoder.metadata.sample_rate
16981698
reference_frames = asset.get_frame_data_by_range(
16991699
start=0, stop=1, stream_index=0
17001700
)
17011701
torch.testing.assert_close(
1702-
test_frames.data[0], reference_frames, atol=0, rtol=0
1702+
test_samples.data[0], reference_frames, atol=0, rtol=0
17031703
)
17041704

17051705
@pytest.mark.parametrize("asset", (NASA_AUDIO, NASA_AUDIO_MP3))

0 commit comments

Comments
 (0)