Commit e990244
committed
fix: audio decode against FFmpeg 6.x (channel count for layout stamping)
Frames decoded from PCM WAV carry an unspecified channel layout (RIFF has
no channel mask), so the layout is stamped with the default one for the
frame's channel count before the resampler is built. The count was read
back from the unspecified layout itself, which works on FFmpeg >= 7.0
(AVChannelLayout keeps nb_channels) but not on 6.x, where ffmpeg-next maps
ChannelLayout onto the legacy AVFrame.channel_layout bitmask: "unspecified"
is 0 there and reports 0 channels, the default layout for 0 channels is
empty again, and swr_init rejects it with EINVAL. Opus/Vorbis were
unaffected because their decoders report a native layout.
Take the channel count from the frame (falling back to the decoder), which
is populated on every FFmpeg version.
Verified on Ubuntu 24.04 with FFmpeg 6.1 system libs (the GitHub CI image)
and on FFmpeg 8.0.1 parent 969e672 commit e990244
1 file changed
Lines changed: 17 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
93 | 104 | | |
94 | | - | |
95 | | - | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
96 | 111 | | |
97 | 112 | | |
98 | 113 | | |
| |||
0 commit comments