Kodi Community Forum
[Windows] AudioEngine testers - Windows platform only - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Kodi Application (https://forum.kodi.tv/forumdisplay.php?fid=93)
+--- Thread: [Windows] AudioEngine testers - Windows platform only (/showthread.php?tid=124600)



RE: [Windows] AudioEngine testers - Windows platform only - jpsdr - 2012-05-16

Sigh... also...
First, thanks again for your patiente wich is put to hardship. I can fell the vibes from here Wink.

(2012-05-16, 20:09)DDDamian Wrote: I've told you to re-enable your VIA hw if you want.
Again, you totaly miss the point ! Sad

I know my english is bad, and i wasn't probably clear enough, so i'll try to explain again better :

==========================================================================
Issue N°1

The facts :
A : HDMI audio VSX-921 is selected as default audio device in windows.
B : No issue with chipset VIA highjacking VSX-921 with MPC-HC and VLC.
C : No issue with chipset VIA highjacking VSX-921 with XBMC just before AE merge. I select Wasapi VSX-921 and have audio.
D : No audio from non pass-through formats since AE merged because even selected Wasapi VSX-921 the device seems not be used and seems to be highjacked by the VIA device.

OK : You've provided me a workaround to bypass the issue. Yes, fine, even more perfect, big thanks !! I don't espacialy care enabling VIA for now, that's not the point.

According the facts A+B+C, my conclusion/analysis of the situation is that the problem D is more probably (not 100% sure of course) an issue from XBMC with the new AE than something else. So, if there is an issue, it need to be fixed. This is, of course, my point of view, according my interpretation of the facts.
This, the point i insist on : Fixing this issue => Improving XBMC.

Now :
- If your analysis of this situation is different from mine, and you think the issue D is absolutely not from XBMC+new AE tells/explain/demonstrate me why.
- If you're agree with the fact that there is maybe an issue with XBMC+new AE, in that case maybe we can try to dig for knowing the cause. As i've said, i can build specific version with more log trace or anything else and run them.
(2012-05-16, 20:09)DDDamian Wrote: Really - what exactly would you like me to do?
That was one thing.

Pleeeaaaase !!!! Tell me this time i've been clear enough, and you've understood what i'm trying to explain, and you'll not answer that i can enable VIA if i want..........

=====================================================================

Issue N°2

(2012-05-16, 20:09)DDDamian Wrote: We ping your driver - it reports 2ch - sorry, that's what it does.

Ok for this one also.

Only one little question, with only 2 answers :
Q : In the Windows property of audio device, it reports 8 channels supported. In case of wrong EDID, is it normal ?

Answer A : No, it's odd.
Answer B : Yes, because of X and/or Y reasons. [No need to be explained].

So, for question Q, the answer is A or B ?
If it's B, closed, period !
If it's A, in that case maybe we can try to dig for knowing the cause. As i've said, i can build specific version with more log trace or anything else and run them.
(2012-05-16, 20:09)DDDamian Wrote: Really - what exactly would you like me to do?
That was the second thing.


=====================================================================

Issue N°3

The audio FLAC 2.0.
I've not forgotten it, but for now i'm not including it in the talk.
More complicated, i've to get it back to my standard PC, where i've all my tools, but for now i've not enough place to do the manipulations (file is 10GB), and the PC where is the file, has only XBMC on it, without any tools, because it's not it's purpose... Well, my installation make that doing this will take a little time. I'll do it, on time, and keep it on standby for now.



RE: [Windows] AudioEngine testers - Windows platform only - DDDamian - 2012-05-16

Issue 1:
Re-enable your VIA hw in the BIOS, select it as a device, and post a clean log - restart XBMC and play one file. Then select the nVidia and post a log the same way, restarting first and playing the same file. For all I know you just didn't select the right device when all this started.

Issue 2:
A & B. A because it's very odd, I expect 8 channels, as I first pointed out. B because we ping the driver, it consults the EDID, that's missing and it reports the minimal 2 channels. If you wish to add in some custom tracing start at the for-loop at ln682 of AESinkWasapi.cpp - it's very straightforward.

Issue 3:
Whenever you like Wink


RE: [Windows] AudioEngine testers - Windows platform only - jpsdr - 2012-05-16

Thanks.

One step at a time, test issue 1 first.

If i understand properly, the steps are :
- Enable VIA in BIOS.
- Select it at default audio device in Windows.
- Start XBMC, enable debug log, selecte Wasapi VIA in audio device.
- Close XBMC, get the log.
- Start XBMC, start a file. Stop, exit, get the log.
- Select VSX-921 at default audio device in Windows.
- Start XBMC, select Wasapi VSX-921 in audio device.
- Close XBMC, get the log.
- Start XBMC, start a file. Stop, exit, get the log.

Am i correct ?

I'll try to use a video with 5.1 FLAC file, this way it will have PCM output with more than 2 channels.


RE: [Windows] AudioEngine testers - Windows platform only - DDDamian - 2012-05-16

You don't have to set it as default device, just select it in XBMC (we don't care about default device if one is selected).

- Enable VIA in BIOS.
- Start XBMC, enable debug log, select Wasapi VIA in audio device.
- Close XBMC
- Start XBMC, start a multichannel FLAC. Stop, exit, get the log.
- Select VSX-921 at default audio device in Windows.
- Start XBMC, select Wasapi VSX-921 in audio device.
- Close XBMC
- Start XBMC, start a multichannel FLAC. Stop, exit, get the log.

Please start another thread though, or go to the AE support thread stickied in General Help and Support - Windows - this is not helping development of AE, nor is it of much help to others here.



RE: [Windows] AudioEngine testers - Windows platform only - jpsdr - 2012-05-17

As it's question about the code, i'll stay here.
Code:
/* Test format for channels iteration */
      wfxex.Format.cbSize               = sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX);
      wfxex.dwChannelMask               = AE_CH_FL | AE_CH_FR;
      wfxex.Format.wFormatTag           = WAVE_FORMAT_EXTENSIBLE;
      wfxex.SubFormat                   = KSDATAFORMAT_SUBTYPE_PCM;
      wfxex.Format.nSamplesPerSec       = 48000;
      wfxex.Format.wBitsPerSample       = 16;
      wfxex.Samples.wValidBitsPerSample = 16;
      wfxex.Format.nChannels            = 2;
      wfxex.Format.nBlockAlign          = wfxex.Format.nChannels * (wfxex.Format.wBitsPerSample >> 3);
      wfxex.Format.nAvgBytesPerSec      = wfxex.Format.nSamplesPerSec * wfxex.Format.nBlockAlign;

      //bool mpcmFlagged                  = false;

      for (int k = AE_CH_LAYOUT_MAX; k > 0; k--)
      {
        wfxex.Format.nChannels          = k;
        wfxex.Format.nBlockAlign        = wfxex.Format.nChannels * (wfxex.Format.wBitsPerSample >> 3);
        hr = pClient->IsFormatSupported(AUDCLNT_SHAREMODE_EXCLUSIVE, &wfxex.Format, NULL);
        if (SUCCEEDED(hr))
        {
          deviceChannels                = layoutsByChCount[k];
          if (k > AE_CH_LAYOUT_2_1) // && !mpcmFlagged)
          {
            deviceInfo.m_dataFormats.push_back(AE_FMT_LPCM);
            //mpcmFlagged = true;
          }
          break;
        }
      }
Maybe my questions are stupids, as i don't know the audio interface, but :
- Can't the wfxex.dwChannelMask = AE_CH_FL | AE_CH_FR; prevent detection of more than FL & FR channels ?
- Shouldn't wfxex.Format.nAvgBytesPerSec also be updated to correct value in the loop ?


RE: [Windows] AudioEngine testers - Windows platform only - DDDamian - 2012-05-17

@jpsdr - no, neither of those values are actually used for pcm channel checks - they're just being reset from previous passthrough format checks where they are used.

As I asked in the other thread, you now say the VIA devices and the nVidia device are working, and DTS-MA and AAC, along with all the other formats you've tested are working? Is there anything not working?


RE: [Windows] AudioEngine testers - Windows platform only - jpsdr - 2012-05-17

I'll answer other thread... in the other thread... Smile
But, i think i'll try to add wfxex.Format.nAvgBytesPerSec = wfxex.Format.nSamplesPerSec * wfxex.Format.nBlockAlign; in the loop, and doing tests tomorrow if i'm not having my usal 50% of time BSOD during ffmpeg compile... Sad
I have a big hunch for that, and it can explain everything.
In the current situation, if a driver and/or a receiver scrupulously check the consistancy of datas, only the 2 channels will pass the check, and in that case, it will only answer "supported" or "Ok" for 2 channels.
Nevertheless, when starting the play, i assume (i haven't search in the code) that all datas are computed properly, and in that case, it will answer "supported" or "Ok" for whatever channels realy supported.
Well, maybe as you seems to say, problem is not here, but it matches so perfectly, it's almost Angel.


RE: [Windows] AudioEngine testers - Windows platform only - DDDamian - 2012-05-17

(2012-05-17, 00:55)DDDamian Wrote: @jpsdr - no, neither of those values are actually used for pcm channel checks - they're just being reset from previous passthrough format checks where they are used.

As I asked in the other thread, you now say the VIA devices and the nVidia device are working, and DTS-MA and AAC, along with all the other formats you've tested are working? Is there anything not working?

^^^ so far we've not changed a single line of code, and all your devices and all your files but one are playing. If I had to make a very educated guess here, when all this started you simply had the wrong device selected. Using words like "magically" started working isn't exactly troubleshooting......


RE: [Windows] AudioEngine testers - Windows platform only - jpsdr - 2012-05-17

Ok, so, i've made the following changes in AESinkWasapi.cpp in the EnumerateDevicesEx function.

Code change 1 :
Code:
/* Test format AAC */
      wfxex.SubFormat                   = KSDATAFORMAT_SUBTYPE_IEC61937_AAC;
      hr = pClient->IsFormatSupported(AUDCLNT_SHAREMODE_EXCLUSIVE, &wfxex.Format, NULL);
      if (SUCCEEDED(hr))
      {
        deviceInfo.m_dataFormats.push_back(AEDataFormat(AE_FMT_AAC));
        CLog::Log(LOGDEBUG,__FUNCTION__": AAC is supported by device.");
      }
      else CLog::Log(LOGDEBUG,__FUNCTION__": AAC is not supported by device.");

Code change 2 :
Code:
/* Test format for channels iteration */
      wfxex.Format.cbSize               = sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX);
      wfxex.dwChannelMask               = AE_CH_FL | AE_CH_FR;
      wfxex.Format.wFormatTag           = WAVE_FORMAT_EXTENSIBLE;
      wfxex.SubFormat                   = KSDATAFORMAT_SUBTYPE_PCM;
      wfxex.Format.nSamplesPerSec       = 48000;
      wfxex.Format.wBitsPerSample       = 16;
      wfxex.Samples.wValidBitsPerSample = 16;
      wfxex.Format.nChannels            = 2;
      wfxex.Format.nBlockAlign          = wfxex.Format.nChannels * (wfxex.Format.wBitsPerSample >> 3);
      wfxex.Format.nAvgBytesPerSec      = wfxex.Format.nSamplesPerSec * wfxex.Format.nBlockAlign;

      //bool mpcmFlagged                  = false;

      for (int k = AE_CH_LAYOUT_MAX; k > 0; k--)
      {
        DWORD mask = 0;
        for (int c = 0; c < k; c++)
        {
          if (uiChannelMask & WASAPIChannelOrder[c])
            mask |= WASAPIChannelOrder[c];
        }
        wfxex.dwChannelMask          = mask;
        wfxex.Format.nChannels          = k;
        wfxex.Format.nBlockAlign        = wfxex.Format.nChannels * (wfxex.Format.wBitsPerSample >> 3);
        wfxex.Format.nAvgBytesPerSec      = wfxex.Format.nSamplesPerSec * wfxex.Format.nBlockAlign;
        hr = pClient->IsFormatSupported(AUDCLNT_SHAREMODE_EXCLUSIVE, &wfxex.Format, NULL);

And tadaaaa !!! Big Grin Big Grin
Code:
12:59:24 T:2096  NOTICE: Enumerated WASAPI devices:
12:59:24 T:2096  NOTICE:     Device 1
12:59:24 T:2096  NOTICE:         m_deviceName      : {40182C1F-23F5-4D64-B27E-0E47E44F71A0}
12:59:24 T:2096  NOTICE:         m_displayName     : HDMI - HD Audio HDMI out (VIA High Definition Audio)
12:59:24 T:2096  NOTICE:         m_displayNameExtra: WASAPI: HD Audio HDMI out (VIA High Definition Audio)
12:59:24 T:2096  NOTICE:         m_deviceType      : AE_DEVTYPE_HDMI
12:59:24 T:2096  NOTICE:         m_channels        : FL,FR
12:59:24 T:2096  NOTICE:         m_sampleRates     : 48000,44100
12:59:24 T:2096  NOTICE:         m_dataFormats     : AE_FMT_S16NE,AE_FMT_S16LE,AE_FMT_S16BE
12:59:24 T:2096  NOTICE:     Device 2
12:59:24 T:2096  NOTICE:         m_deviceName      : {6B6599F3-DF3D-4D08-8EC4-6A327023F29F}
12:59:24 T:2096  NOTICE:         m_displayName     : SPDIF - SPDIF Interface (TX1) (VIA High Definition Audio)
12:59:24 T:2096  NOTICE:         m_displayNameExtra: WASAPI: SPDIF Interface (TX1) (VIA High Definition Audio)
12:59:24 T:2096  NOTICE:         m_deviceType      : AE_DEVTYPE_IEC958
12:59:24 T:2096  NOTICE:         m_channels        : FL,FR
12:59:24 T:2096  NOTICE:         m_sampleRates     : 96000,48000,44100
12:59:24 T:2096  NOTICE:         m_dataFormats     : AE_FMT_DTS,AE_FMT_AC3,AE_FMT_S24NE4,AE_FMT_S24LE4,AE_FMT_S24BE4,AE_FMT_S16NE,AE_FMT_S16LE,AE_FMT_S16BE
12:59:24 T:2096  NOTICE:     Device 3
12:59:24 T:2096  NOTICE:         m_deviceName      : {7F59FF03-AE3F-4C2C-A164-FBBF33EAB278}
12:59:24 T:2096  NOTICE:         m_displayName     : HDMI - VSX-921-1 (NVIDIA High Definition Audio)
12:59:24 T:2096  NOTICE:         m_displayNameExtra: WASAPI: VSX-921-1 (NVIDIA High Definition Audio)
12:59:24 T:2096  NOTICE:         m_deviceType      : AE_DEVTYPE_HDMI
12:59:24 T:2096  NOTICE:         m_channels        : FL,FR,FC,LFE,BL,BR,SL,SR
12:59:24 T:2096  NOTICE:         m_sampleRates     : 192000,96000,48000,44100
12:59:24 T:2096  NOTICE:         m_dataFormats     : AE_FMT_DTSHD,AE_FMT_TRUEHD,AE_FMT_EAC3,AE_FMT_DTS,AE_FMT_AC3,AE_FMT_S24NE4,AE_FMT_S24LE4,AE_FMT_S24BE4,AE_FMT_S16NE,AE_FMT_S16LE,AE_FMT_S16BE
12:59:24 T:2096  NOTICE:     Device 4
12:59:24 T:2096  NOTICE:         m_deviceName      : {DB751CB1-4460-4CA3-B146-D5AC24E8A80B}
12:59:24 T:2096  NOTICE:         m_displayName     : Speakers - Haut-parleurs (VIA High Definition Audio)
12:59:24 T:2096  NOTICE:         m_displayNameExtra: WASAPI: Haut-parleurs (VIA High Definition Audio)
12:59:24 T:2096  NOTICE:         m_deviceType      : AE_DEVTYPE_PCM
12:59:24 T:2096  NOTICE:         m_channels        : FL,FR
12:59:24 T:2096  NOTICE:         m_sampleRates     : 192000,96000,48000,44100
12:59:24 T:2096  NOTICE:         m_dataFormats     : AE_FMT_S24NE4,AE_FMT_S24LE4,AE_FMT_S24BE4,AE_FMT_S16NE,AE_FMT_S16LE,AE_FMT_S16BE
12:59:24 T:2096  NOTICE: Enumerated DirectSound devices:
12:59:24 T:2096  NOTICE:     Device 1
Now that there is no more inconsistancy on the datas, receiver answer as expected.

The was one crucial information wich has not been given enough weigth, and because of that we insist on the wrong path : The fact that in Windows audio property informations were correct. It should have been a lighthouse telling that it can't be wrong EDID informations, otherwise Windows would have never been able to get the correct ones.

You have the full log here.

Can you commit (after testing on your side there is no regression) a patch of the Change code 2 for this fix ?

The test with Change Code 1 well, is half a faillure...
No idea why nothing has been logged...Confused





RE: [Windows] AudioEngine testers - Windows platform only - DDDamian - 2012-05-17

@jpsdr - now we're talking. The code 2 changes look good - it would appear that the new nVidia drivers are checking the channel mask, which was not the case during earlier testing, nor the current case with ATI as you can see from my earlier pastebin. But it causes no harm or regression, and I will certainly add that asap - good work. The avgBytesPerSec is only used for PT formats for the client's buffer duration calculations, so it isn't a factor per MS documents, but again, no harm done there.

For the AAC test, yes, I added the check for it when initially writing the device enumeration code, even though it's not currently "supported". Check your PM's for the issue with the code 1 logging you added - those additional lines for logging will not be added.

Okay, so you've got the right device selected now (whether VIA or nVidia) and with the original code you are getting all formats - good to hear! Smile


RE: [Windows] AudioEngine testers - Windows platform only - DDDamian - 2012-05-17

@jpsdr - commited your patch with one change - it can be viewed here

Here's the diff output:
Code:
xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp |    9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp
index 55c6be3..a70a5f0 100644
--- a/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp
+++ b/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp
@@ -681,8 +681,17 @@ void CAESinkWASAPI::EnumerateDevicesEx(AEDeviceInfoList &deviceInfoList)

       for (int k = AE_CH_LAYOUT_MAX; k > 0; k--)
       {
+        DWORD mask = 0;
+        for (int c = 0; c < WASAPI_SPEAKER_COUNT; c++)
+        {
+          if (uiChannelMask & WASAPIChannelOrder[c])
+            mask |= WASAPIChannelOrder[c];
+        }
+
+        wfxex.dwChannelMask             = mask;
         wfxex.Format.nChannels          = k;
         wfxex.Format.nBlockAlign        = wfxex.Format.nChannels * (wfxex.Format.wBitsPerSample >> 3);
+        wfxex.Format.nAvgBytesPerSec    = wfxex.Format.nSamplesPerSec * wfxex.Format.nBlockAlign;
         hr = pClient->IsFormatSupported(AUDCLNT_SHAREMODE_EXCLUSIVE, &wfxex.Format, NULL);
         if (SUCCEEDED(hr))
         {

Only change was to use c < WASAPI_SPEAKER_COUNT instead of c < k as the channel ordering in windows is not linear, i.e. 5.1 mask = 63 decimal = 111111 binary, whereas 7.1 = 1599 decimal = 11000111111 binary. Using the windows channel layouts we define in WASAPIChannelOrder[x] will work for the 21 channels defined by windows, so it's a little more correct and future-proof. Your code returned a channel mask of 111111 for 7.1 layouts which is incorrect. I'm still debating whether we use the windows speaker setting as set by the user for the enumeration code or the actual capabilites (currently used) reported by the driver, but that's a different question.

That said, nice catch and I've acknowledged your work there in the commit message.


RE: [Windows] AudioEngine testers - Windows platform only - jpsdr - 2012-05-18

I've reverted back to original file on my PC, update to Git, build and tested a new version : Things are fine.
Thanks.

Edit :
I think code can even be "cleaner".
Compute of mask was inside the k loop because it's value changed for each k.
Now, there is no need for it to be inside the loop, and something like this would be "cleaner" :
Code:
DWORD mask = 0;
     for (int c = 0; c < WASAPI_SPEAKER_COUNT; c++)
     {
       if (uiChannelMask & WASAPIChannelOrder[c])
         mask |= WASAPIChannelOrder[c];
     }
      /* Test format for channels iteration */
      wfxex.Format.cbSize               = sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX);
      wfxex.dwChannelMask               = mask;
      wfxex.Format.wFormatTag           = WAVE_FORMAT_EXTENSIBLE;
      wfxex.SubFormat                   = KSDATAFORMAT_SUBTYPE_PCM;
      wfxex.Format.nSamplesPerSec       = 48000;
      wfxex.Format.wBitsPerSample       = 16;
      wfxex.Samples.wValidBitsPerSample = 16;
      wfxex.Format.nChannels            = 2;
      wfxex.Format.nBlockAlign          = wfxex.Format.nChannels * (wfxex.Format.wBitsPerSample >> 3);
      wfxex.Format.nAvgBytesPerSec      = wfxex.Format.nSamplesPerSec * wfxex.Format.nBlockAlign;

      //bool mpcmFlagged                  = false;

      for (int k = AE_CH_LAYOUT_MAX; k > 0; k--)
      {
        wfxex.Format.nChannels          = k;
        wfxex.Format.nBlockAlign        = wfxex.Format.nChannels * (wfxex.Format.wBitsPerSample >> 3);
        wfxex.Format.nAvgBytesPerSec    = wfxex.Format.nSamplesPerSec * wfxex.Format.nBlockAlign;
        hr = pClient->IsFormatSupported(AUDCLNT_SHAREMODE_EXCLUSIVE, &wfxex.Format, NULL);

Even beter, would be something like that :
Code:
wfxex.dwChannelMask               = SpeakerMaskFromAEChannels(deviceChannels);
without even to have to compute mask, and using deviceChannels computed previously in the function. Unfortunately, this last one can't be compiled because of something related to class declaration : It's too much C++ specific for my knowledge.



RE: [Windows] AudioEngine testers - Windows platform only - JHTom - 2012-05-22

I recently upgraded from Eden to the May 20 nightly build and previous issues I had with playing DTS have been solved. However, when I play a movie with TrueHD (I am playing the core Dolby Digital only as I output via optical into a pre/pro that doesn't support HD) the video stutters quite a bit and the av sync is off. If I switch to the Dolby Digital stream only, the video plays back smoothly, but the av sync is still off.

Here is a log using the TrueHD stream:
http://pastebin.com/663L42Y9

Here is a log using the dedicated Dolby Digital stream:
http://pastebin.com/1HhPWY6r

Let me know what other information may be helpful.

Tom




RE: [Windows] AudioEngine testers - Windows platform only - DDDamian - 2012-05-22

@JHTom - trying to play TrueHD as multichannel PCM thru optical won't work, optical can't send decoded TrueHD>pcm multichannel - you're better off to stick to the DD track. There are multiple errors from ffmpeg in reading the track - not sure if that might be causing the sync issues.

I'd also use WASAPI for both the passthrough and non-passthrough devices. Try reading the TrueHD track with WASAPI as the output device - it should extract the AC3 (DD) okay. You also need to make sure the setting "Receiver accepts multichannel lpcm" is off.


RE: [Windows] AudioEngine testers - Windows platform only - JHTom - 2012-05-22

@DaMiaN. Thanks, I corrected the passthrough output device to wasapi (I don't have multichannel lpcm capable receiver checked-it is grayed out and can't be checked). Selecting the TrueHD track the DD is extracted and sounds good. However, the video still stutters a lot. No problems if I select the DD track.

http://pastebin.com/X1WarFqJ




This forum uses Lukasz Tkacz MyBB addons.