Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: 24 bit WMA Lossless decoding broken in Windows 10 1809 (Read 71314 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Re: 24 bit WMA Lossless decoding broken in Windows 10 1809

Reply #25
holy cow! sorry for my bad english, no question. :)
"WMA is likely to be depreciated in Windows before long, but it won't really matter since it has all been reverse engineered and implemented in ffmpeg."
I thought it was about encoding.

Re: 24 bit WMA Lossless decoding broken in Windows 10 1809

Reply #26
holy cow! sorry for my bad english, no question. :)
"WMA is likely to be depreciated in Windows before long, but it won't really matter since it has all been reverse engineered and implemented in ffmpeg."
I thought it was about encoding.

No, decoding so that people can play existing files.  WMA Lossless is a nearly dead format, so hopefully no one is making new files, only converting to something modern. 

Re: 24 bit WMA Lossless decoding broken in Windows 10 1809

Reply #27
Since I know my sole 24-bit WMA-LL doesn't work (in 1809, that is), if it's simple for you, how about uploading here a 24-bit WMA-LL that works for you.
Sorry for getting back at this only now! Here's a short sample created with GoldWave that plays fine in Groove and with my own MF decoder implementation. Neither foobar2000 nor GoldWave nor fre:ac can play this though.


Re: 24 bit WMA Lossless decoding broken in Windows 10 1809

Reply #29
This shows how it is here:  https://hydrogenaud.io/index.php/topic,117300.new.html
Sounds exactly like what I get in fre:ac with the Media Format SDK based decoder. I'll try to get a Media Foundation based decoder running in fre:ac probably this weekend to compare to the (working) one I built at my workplace.

Re: 24 bit WMA Lossless decoding broken in Windows 10 1809

Reply #30
Sounds exactly like what I get in fre:ac with the Media Format SDK based decoder. I'll try to get a Media Foundation based decoder running in fre:ac probably this weekend to compare to the (working) one I built at my workplace.
 
I should have taken the time to just look at the wav data.  This is wrong right from the very first m_IsrcReaderPtr->ReadSample().  The 1803*.wav -- correct in every way -- at

https://hydrogenaud.io/index.php/topic,117300.new.html

is from the same EXE that made the two 1809*.wav files.  Two 1809s because each run has different PCM data.  Wrong data, of course.  I tried this in Windows 10 19H1N1 and still a problem there.
BANNED

Re: 24 bit WMA Lossless decoding broken in Windows 10 1809

Reply #31
Looking at the only place that matters, these

 ConvertToContiguousBuffer(&ImediaBufferPtr);
 :
 Lock(&sampleBufferPtr, nullptr, &sampleBufferBytes);

show the data at sampleBufferPtr (for those bytes) are not decoded wma, but what look like unitialized process heap.  For example, the first 128 bits are obviously two 64-bit pointers with addresses close to the process followed by 00s (but I've seen other garbage at other times).  The same code decodes 16-bit wma lossless without a problem (and also fine for mp3, aac, all other wma, and adpcm; for flac, vorbis, opus, and alac I use xiph and apple source).  Just for the record, this same code works fine for this same 24-bit wma lossless file in 1803 and before.  And no, no reported errors along the way.  For now, I'll wait and see if this becomes a known problem, with a fix.
BANNED

Re: 24 bit WMA Lossless decoding broken in Windows 10 1809

Reply #32
WMA Lossless is a nearly dead format, so hopefully no one is making new files, only converting to something modern. 
Part of my processing bumps up the sample rate to 48kHz for more accuracy (in declipping). WMA doesn't have the option to store 48kHz in 16 bit.
I suppose I could join the free lossless audio codec bandwagon. I'm just not sure if I've forgiven some people for the attitude they had towards those who didn't use it soon after it came out. More so, I don't want my attitude to change into theirs, if I change.
Processed audio in java and python.


Re: 24 bit WMA Lossless decoding broken in Windows 10 1809

Reply #34
I'm just not sure if I've forgiven some people for the attitude they had towards those who didn't use it soon after it came out. More so, I don't want my attitude to change into theirs, if I change.

FWIW, this is a dumb reason to pick a format, but if you really don't like FLAC, just use one of the half dozen alternatives that are well supported and have actual documentation.  The problem with WMAL is not that it isn't "free", but rather that it isn't documented and that the vendor who produced it lost interest in it almost immediately after launching it. 

Re: 24 bit WMA Lossless decoding broken in Windows 10 1809

Reply #35
My Media Foundation based decoder that successfully decodes 24 bit WMA Lossless is now available in fre:ac's/BoCA's git repo. The next fre:ac 1.1 alpha release will include this.

@40th.com: Maybe you could have a look at this and compare it to your code. It would be interesting what's the difference that makes my code work and yours fail.

Re: 24 bit WMA Lossless decoding broken in Windows 10 1809

Reply #36
No real difference in the code.  My SWAG is, no manifest in yours.  See if adding this compatibility section breaks freac.  (Update: probably not; didn't fix anything when I did it to jb2112, but who knows).
Code: [Select]
    :
  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
    <application>
      <!-- Win10 supportedOS Id -->
      <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"></supportedOS>
    </application>
  </compatibility>
    :

I'd do it myself but, while I get everything to build for freac, or so it seems (tagidv2 or something failed to compile -- my guess that is not important; I'm using vs2019rc2), there are no decoders available.  wma comes up as, Error: unknown file type.  I have no idea what to do.  The exes, smooth, and boca dlls, including wma enc/dec/tag, are in the same directory.

BTW, my fix is to mark wma-ll 24-bit as unsupported in Windows 1809+.  The Easy Fix(tm).

P.S.  Saw you guessing at wma-ll file type -

Code: [Select]
from: components\decoder\wma\wma.cpp
/*Try to guess if this is a lossless file.*/

did I see that right?  This can do it:

Code: [Select]
        GUID stGuid = {0};
        hr = m_ImediaSourceTypePtr->GetGUID(MF_MT_SUBTYPE, &stGuid);
           :
            else if ((wavFormatTag == WAVE_FORMAT_WMAUDIO2) ||  // 9-Oct-2016 0415: 0x161 to 0x164
                    (wavFormatTag == WAVE_FORMAT_WMAUDIO3) ||
                    (wavFormatTag == WAVE_FORMAT_WMASPDIF) ||  // <-- not sure if this comes in a file
                    (wavFormatTag == WAVE_FORMAT_WMAUDIO_LOSSLESS)) {
              rc = 0;
              // the m_isWma* values are set at rdr_assignMetadata.cpp
              //m_isWma;      // 20-Jan-2016 0420: non-zero then is wma (if set one of the below is TRUE)
              //m_isWmaStd;    // WMMEDIASUBTYPE_WMAudioV8        00000161-0000-0010-8000-00AA00389B71  (also v2 and v7)
              //m_isWmaPro;    // WMMEDIASUBTYPE_WMAudioV9        00000162-0000-0010-8000-00AA00389B71
              //m_isWmaLL;    // WMMEDIASUBTYPE_WMAudio_Lossless  00000163-0000-0010-8000-00AA00389B71
            }
BANNED

Re: 24 bit WMA Lossless decoding broken in Windows 10 1809

Reply #37
Many popular applications like fre:ac, foobar2000, Winamp and GoldWave use this API and are now unable to decode or play 24 bit WMA Lossless files. This potentially affects lots of users.

I wonder if it would be a good thing if players would give a popup warning that you are using an obsolete codec that Microsoft is breaking, and offer to "Convert while it is still possible [y/n]"

I see a downside, besides the work to do it:
It does not take more than a handful of offended zealots to spam your inbox with hatemail.

Re: 24 bit WMA Lossless decoding broken in Windows 10 1809

Reply #38
...
or use ffplay or another "true" decoder.

Re: 24 bit WMA Lossless decoding broken in Windows 10 1809

Reply #39
See if adding this compatibility section breaks freac.
No, that didn't make a difference. Also tested 32 vs. 64 bit and GCC vs. MSVC build - no difference either.
I'd do it myself but, while I get everything to build for freac, or so it seems (tagidv2 or something failed to compile -- my guess that is not important; I'm using vs2019rc2), there are no decoders available.  wma comes up as, Error: unknown file type.  I have no idea what to do.  The exes, smooth, and boca dlls, including wma enc/dec/tag, are in the same directory.
All the BoCA DLLs should go to a boca subfolder. At least the WMA encoder and Media Foundation decoder should be usable then. Most other codec's need their own DLLs which need to be built separately.
P.S.  Saw you guessing at wma-ll file type -
Ah, yes, thanks for pointing me at this. Checking the sub-type is way better, of course. Will change it. I copied this over from the old WMFormat based decoder - it should probably be changed there as well.

Re: 24 bit WMA Lossless decoding broken in Windows 10 1809

Reply #40
My IMFByteStream does not implement the IMFAttributes interface, so I cannot quickly try setting the MF_BYTESTREAM_CONTENT_TYPE attribute instead.
Okay, one difference is that I call MFCreateFile and use its IMFByteStream.
BANNED

 

Re: 24 bit WMA Lossless decoding broken in Windows 10 1809

Reply #41
Quote
Okay, one difference is that I call MFCreateFile and...
That's not it.
BANNED

Re: 24 bit WMA Lossless decoding broken in Windows 10 1809

Reply #42
Attached is a list of modules loaded at various stages running freac, and another list for jb2112 (on 1809, and a short list for 1803).  Nothing stands out but since I assembled the list I may as well heap it in (attached .txt file).  I have no idea what it could be.  The calls to decode using MF are very simple.  It should work.  It does work in 1803.  Not in 1809.
BANNED

Re: 24 bit WMA Lossless decoding broken in Windows 10 1809

Reply #43
I'll try to get a Media Foundation based decoder running in fre:ac probably this weekend to compare to the (working) one I built at my workplace.
 
 Attached is a zip that includes a very simple MF program that shows the problem.  It includes the few-dozen line source file, the sample lossless 24-bit .wma, a pre-built exe (for those that want to try it without compiling), and a couple of images showing the good and the not good.  Attached separately, too.  If you can make THAT work in Windows 1809 you found the problem(s).
BANNED

Re: 24 bit WMA Lossless decoding broken in Windows 10 1809

Reply #44
Got it!

Inserting these lines when configuring the output media type fixes the decoding:
Code: [Select]
      hr = ImediaType_DecodeTo_comPtr->SetUINT32(MF_MT_AUDIO_BITS_PER_SAMPLE, bits32);
      if (FAILED(hr)) break;
      hr = ImediaType_DecodeTo_comPtr->SetUINT32(MF_MT_AUDIO_PREFER_WAVEFORMATEX, TRUE);
      if (FAILED(hr)) break;
So it looks like I was just lucky using MFInitMediaTypeFromWaveFormatEx. If I had done it another way, I would have run into the same issue and probably never found a way to successfully decode the files.

Documentation for MF_MT_AUDIO_PREFER_WAVEFORMATEX says "If the attribute is TRUE, the function converts the audio media type to a WAVEFORMATEX structure whenever possible, instead of converting it to a WAVEFORMATEXTENSIBLE structure.".

Looks like not setting this flag for the output media type might trigger a bug with some format descriptor conversion inside the Media Foundation or WMA decoder engine...

Re: 24 bit WMA Lossless decoding broken in Windows 10 1809

Reply #45
Thanks.
BANNED

Re: 24 bit WMA Lossless decoding broken in Windows 10 1809

Reply #46
Just did some more investigation and found that MF_MT_AUDIO_PREFER_WAVEFORMATEX does not need to be set. It's sufficient to set MF_MT_AUDIO_BLOCK_ALIGNMENT instead.

This page advises to set some more parameters when configuring the uncompressed audio type. It's probably a good idea to fill them all.

Re: 24 bit WMA Lossless decoding broken in Windows 10 1809

Reply #47
It's sufficient to set MF_MT_AUDIO_BLOCK_ALIGNMENT instead.
 
 That doesn't work here.  I get the same bad decode as before.  6 bytes for alignment?  I also did the sets suggested on the "Uncompressed Audio Media Types" page.  Same bad decode.

The only thing that works is MF_MT_AUDIO_PREFER_WAVEFORMATEX.  And setting the MF_MT_AUDIO_BITS_PER_SAMPLE to 24, otherwise it comes back as (valid) 16-bit samples.

Obvious question is, how does MF_MT_AUDIO_BLOCK_ALIGNMENT work there but not here?
BANNED

Re: 24 bit WMA Lossless decoding broken in Windows 10 1809

Reply #48
Indeed, MF_MT_AUDIO_BLOCK_ALIGNMENT with he correct 6 bytes alignment seems to work only when MF_MT_AUDIO_PREFER_WAVEFORMATEX is also set.

It works without that here when set to the actually wrong values of 1 or 2...

Re: 24 bit WMA Lossless decoding broken in Windows 10 1809

Reply #49
Has this issue been resolved? I was testing some 24 bit WMA lossless files yesterday and Foobar was the only program I have that had a problem with them. (Of the programs listed in the opening post, I tried GoldWave and it was fine.)
Processed audio in java and python.