-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(soundsources): fix FFMPEG MP3 playback #11923 #12034
base: 2.4
Are you sure you want to change the base?
Conversation
|
This is the failing test:
The new offset does no longer match the CoreAudio version, the proposed fix is probably not correct. |
FFmpeg documentation is scarce. The Chromium sources suggest that the start time depends on the codec: https://chromium.googlesource.com/chromium/src.git/+/master/media/filters/ffmpeg_demuxer.cc#104 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This just reverts the bugfix from #11879. We need a fix, which fixes both bugs.
What would that fix be then? |
72bf055
to
be695ef
Compare
I'm not terribly familiar with all the details of audio decoding so I'd appreciate some guidance here. Fact is that mp3 playback is currently broken for |
The issue is that the offset of lib123 and ffmpeg was anyway broken before. Maybe the additional failure is just a symptom of that original issue. If we want to offer a migration path to the floating point library that involves a bit less CPU during encoding, we need to fix that. If I remember correctly the ffmpeg implementation plays the initial Mp3 Info Frame that has no usable audio data. mixxx/src/sources/soundsourcemp3.cpp Line 329 in 0119d85
I am afraid this is not trivial and needs a good amount of testing. If we do it wrong the beats and cues are off. I am personally not interested to move to lib123, because even if the offset issue is fixed, it puts all my metadata on a risk in case of differently handled decoding issues. |
you're confusing me, what does
I understand that, but for people like me (and like @uklotzde too) that have been using ffmpeg as their only mp3 decoder, the current solution is even worse as we're unable to play mp3 files at all. Switching away from ffmpeg is not an option for the same reason as you're not interested in switching to ffmpeg. I'm not particularly keen on fixing the differences in decoder offset either, I'm only interested in restoring the previous (possibly "wrong" offset) behavior that didn't break ffmpeg. As far as I can tell, that behavior is just that the seekIndex was clamped to not be negative, right? |
fyi, I replaced the current commit on the branch with a different commit that just ensures all audio test files can be opened. Fortunately it succeeds on CI but is obviously broken for me (highlighting the issue I'm experiencing). |
Using a negative seek index that is not justified by the decoded packet/frame data is undefined behavior. It seems to work for decoding AAC files, but fails for MP3 (and maybe others). Unfortunately the negative seek offset cannot be obtained even when decoding the first packet. If you set The previous "fix" was wrong and slipped through unnoticed just because the tests were insufficient. |
I would like to emphasize that my intention is not to accuse anyone! Platform-independent decoding and portable offsets are still unsolved problems and I don't have any solution at hand. Extending the |
@@ -187,10 +190,13 @@ TEST_F(SoundSourceProxyTest, open) { | |||
// skip test file | |||
continue; | |||
} | |||
couldOpenFile = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MAD will open the file successfully and FFmpeg is skipped. No errors, unless you disable all other MP3 decoders that have a higher priority than FFmpeg.
FFmpeg has the lowest priority and is only ever used as a fallback if anything else fails. Although I personally consider it as the must reliable decoder for MP3, MP4, and ALAC (at least on Linux/Windows).
Unfortunately, the lazy test behavior was needed for the AAC/ALAC files that both share the same .m4a
file extension.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MAD will open the file successfully and FFmpeg is skipped. No errors, unless you disable all other MP3 decoders that have a higher priority than FFmpeg.
Yes, that was the intention here. It's not super important what decoder is used for what format, its only important that we can open the file with at least one. The other tests are care about the actual encoder and what offset it introduces/requires.
Although I personally consider it as the must reliable decoder for MP3, MP4, and ALAC (at least on Linux/Windows).
I agree, thats why I compile with ffmpeg and without MAD.
Unfortunately, the lazy test behavior was needed for the AAC/ALAC files that both share the same .m4a file extension.
What do you mean with "lazy test behavior"? The fallback approach?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most tests don't fail if opening fails. You don't notice if a file that could previously be opened can no longer be decoded. Otherwise you would need to explicitly which combinations are expected to fail and should be skipped. This would be preferable to detect regressions.
Ok, so I think we have an issue here with your private build, not with an official Mixxx build. The test per platform (not per encoding library) has been installed to exactly detect theses issues. If one is changing to ffmpeg the test should fail until the offset issue is fixed. This prevents us from package maintainers or other user building Mixxx with a shifted offset invalidating all their beats and cues. This also will detect if ffmpeg swithes to a different library for a certain audio format. This is unfortunately out of our control with ffmpeg. So you may apply a fix that restores the broken lib123 offset, that your cues and beats are still valid. |
Yes, thats true. That's also why I'm not looking for a perfect fix.
I assume you mean libmpg123 which I assume is used by ffmpeg in the background? As I said, I'm not super familiar with the encoder infrastructure but I assume clamping the seekIndex will be enough, right? |
Just test it. |
Breaking any decoder that is used as a fallback is not a "private issue". It does not work as before, even if only in rare cases that probably doesn't affect many users. |
Just clamping the seekIndex seems to work:
I don't have AACs to test against. What should I do about the failing test. While obviously biased, I agree with @uklotzde's point that we should probably properly fix this. |
The test should not fail in case of AACs and you should not see any moved first sound warning when playing mp3s. Than this bug can be considered as fixed. The failing mp3 test should continue to fail, because the ffmpeg mp3 implementation is still broken. Every user who is trying that should see that failed test. I suggest to just disable the test in your case. |
This PR is marked as stale because it has been open 90 days with no activity. |
This PR is marked as stale because it has been open 90 days with no activity. |
fixes #11923
fix adopted from uklotzde@e0f00c1
Thank you Uwe