https://bugs.winehq.org/show_bug.cgi?id=42361
Bug ID: 42361 Summary: DX Library: PlaySoundFile() doesn't play MP3 files that are encoded by LAME in 320kbps Product: Wine Version: 2.0 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: kakurasan@gmail.com Distribution: ---
PlaySoundFile() in "DX Library" (http://dxlib.o.oo7.jp/) doesn't play MP3 files that are encoded by LAME in 320kbps (CBR).
PlaySoundFile() uses msacm32.dll to play MP3 files (DirectShow also can be used).
Native msacm32.dll doesn't work around the issue.
The test program for DirectShow (source at https://bugs.winehq.org/show_bug.cgi?id=41290 , binary at https://bugs.winehq.org/show_bug.cgi?id=41833) can play the MP3 files (with/without winegstreamer).
https://bugs.winehq.org/show_bug.cgi?id=42361
--- Comment #1 from kakurasan@gmail.com --- Created attachment 57138 --> https://bugs.winehq.org/attachment.cgi?id=57138 DX Library 3.17a source (partial) and a test program that uses PlaySoundFile()
If XAudio2 is used, the test program quits immediately. Otherwise (WINEDLLOVERRIDES="xaudio2_7=;xaudio2_8="), DirectSound is used but the playback doesn't start/finish.
https://bugs.winehq.org/show_bug.cgi?id=42361
--- Comment #2 from kakurasan@gmail.com --- Created attachment 57139 --> https://bugs.winehq.org/attachment.cgi?id=57139 Test sound files (WAV, MP3/320kbps/LAME, MP3/320kbps/gogo, MP3/256kbps/LAME)
The test program plays sine440-320kbps-gogo2.39.mp3 and sine440-256kbps-lame3.99.5.mp3, but doesn't play sine440-320kbps-lame3.99.5.mp3.
https://bugs.winehq.org/show_bug.cgi?id=42361
Bruno Jesus 00cpxxx@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Component|-unknown |winemp3.acm
--- Comment #3 from Bruno Jesus 00cpxxx@gmail.com --- Confirming in Wine 2.0. The problem seems to be inside winemp3.acm.
The function mpg123_read returns -10 meaning MPG123_NEED_MORE for the LAME file, while it returns -11 meaning MPG123_NEW_FORMAT for the gogo file. There is a loop there to keep reading data but something is not happening as it should.
http://source.winehq.org/source/dlls/winemp3.acm/mpegl3.c#0178
https://bugs.winehq.org/show_bug.cgi?id=42361
--- Comment #4 from Bruno Jesus 00cpxxx@gmail.com --- Current theory:
The lame encoded file starts later due to metadata added by the encoder so the 2048 bytes of input offered to acmStreamConvert are not enough for mpg123_read to reach the first mp3 block header. This results in error and cascades back and the program aborts.
I removed the first 1045 bytes of the 320kb lame mp3 and it played fine.
https://bugs.winehq.org/show_bug.cgi?id=42361
winetest@luukku.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |winetest@luukku.com
--- Comment #5 from winetest@luukku.com --- http://www.datavoyage.com/mpgscript/mpeghdr.htm http://id3.org/id3v2.4.0-structure
https://bugs.winehq.org/show_bug.cgi?id=42361
--- Comment #6 from kakurasan@gmail.com --- Created attachment 57168 --> https://bugs.winehq.org/attachment.cgi?id=57168 Experimental patch
https://bugs.winehq.org/show_bug.cgi?id=42361
--- Comment #7 from Bruno Jesus 00cpxxx@gmail.com --- Created attachment 57169 --> https://bugs.winehq.org/attachment.cgi?id=57169 another hack
The problem might be simpler than that. What the application can't cope with is that after acmStreamConvert the value of cbDstLengthUsed must not be zero, otherwise the app will give up.
Since we have the MP3 that has the problem we need to replicate the calls from the program (acmStreamOpen, acmStreamPrepareHeader and acmStreamConvert) and check what acmStreamConvert returns for cbDstLengthUsed when fed with cbSrcLengthUsed = 2048.
https://bugs.winehq.org/show_bug.cgi?id=42361
--- Comment #8 from winetest@luukku.com --- I would suggest to open the mp3 file with some mp3 editor that can give accurate info about headers and their file sizes and locations if possible.
https://bugs.winehq.org/show_bug.cgi?id=42361
kakurasan@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch
--- Comment #9 from kakurasan@gmail.com --- (In reply to Bruno Jesus from comment #7)
Created attachment 57169 [details] another hack
The patch looks good and works. Thanks for analyzing in detail and the patch.
https://bugs.winehq.org/show_bug.cgi?id=42361
--- Comment #10 from Bruno Jesus 00cpxxx@gmail.com --- Created attachment 57198 --> https://bugs.winehq.org/attachment.cgi?id=57198 proper fix
Please try the attached patch, it works for me.
https://bugs.winehq.org/show_bug.cgi?id=42361
--- Comment #11 from kakurasan@gmail.com --- (In reply to Bruno Jesus from comment #10)
Created attachment 57198 [details] proper fix
Please try the attached patch, it works for me.
Also works for me.
https://bugs.winehq.org/show_bug.cgi?id=42361
--- Comment #12 from winetest@luukku.com --- Patch went in.
http://source.winehq.org/git/wine.git/commit/2253d1a9d3a36bc3dcdc05acc8bf470...
https://bugs.winehq.org/show_bug.cgi?id=42361
Bruno Jesus 00cpxxx@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|DX Library: PlaySoundFile() |DX Library: PlaySoundFile() |doesn't play MP3 files that |doesn't play MP3 files with |are encoded by LAME in |specific extra headers |320kbps | Resolution|--- |FIXED Status|NEW |RESOLVED Fixed by SHA1| |2253d1a9d3a36bc3dcdc05acc8b | |f47085b739c6f
--- Comment #13 from Bruno Jesus 00cpxxx@gmail.com --- (In reply to winetest from comment #12)
Patch went in.
http://source.winehq.org/git/wine.git/commit/ 2253d1a9d3a36bc3dcdc05acc8bf47085b739c6f
Marking fixed.
https://bugs.winehq.org/show_bug.cgi?id=42361
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #14 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 2.2.
https://bugs.winehq.org/show_bug.cgi?id=42361
Michael Stefaniuc mstefani@redhat.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |2.0.x
https://bugs.winehq.org/show_bug.cgi?id=42361
Michael Stefaniuc mstefani@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|2.0.x |---
--- Comment #15 from Michael Stefaniuc mstefani@winehq.org --- Removing the 2.0.x milestone from bugs included in 2.0.1.