Skip to content

bugfix: fixing wma files not playing after ffmpeg7 upgrade#758

Open
xicalango wants to merge 3 commits into
clangen:masterfrom
xicalango:bugfix/720_wma_files_no_longer_work
Open

bugfix: fixing wma files not playing after ffmpeg7 upgrade#758
xicalango wants to merge 3 commits into
clangen:masterfrom
xicalango:bugfix/720_wma_files_no_longer_work

Conversation

@xicalango
Copy link
Copy Markdown

Summary

This fixes issue #720 (broken wma playback).
The issue seemed to be with the update on how channel_layouts were treated in ffmpeg 7.

Details

When debugging I saw that for wma files the codecContext and the decodedFrame's channel layout have the order set to AV_CHANNEL_ORDER_UNSPEC and u.mask set to 0.
When the resampler was initialized using swr_alloc_set_opts2 and the codecContext's channel layout would then return an instance where order was set to AV_CHANNEL_ORDER_NATIVE and u.mask set to 3, which then triggered an error with swr_convert_frame.

I fixed this by calling resolveChannelLayout in case the order is set to AV_CHANNEL_ORDER_UNSPEC in codecContext.

I'm not super sure if the fix is how ffmpeg wants things to be done, but when testing with a couple of file formats, none of them seemed to break. In fact wma was the only one that needed it's channel layout resolved. (I tested with mp3, ogg, opus, flac, wma, m4a, aac).

Testing

System I used for testing: Llinux (ubuntu 25.10) with ffmpeg 7.1.1.

I looked through my music library and tried playing all different formats I found and didn't find any issues. I also ran core_c_demo, but not sure if that did anything meaningful.

Alexander Weld and others added 2 commits March 25, 2026 13:19
This fixes decoding of files that were broken by the latest changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants