Kodi Community Forum
Testing audio engine ActiveAE - 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: Testing audio engine ActiveAE (/showthread.php?tid=170338)



RE: Testing audio engine ActiveAE - fritsch - 2013-08-19

Nope, won't cry :-)

DTS-HD is transfered differently. What do you think is the problem - I like my calculation though :-)


RE: Testing audio engine ActiveAE - jjd-uk - 2013-08-19

Have investigated my music playback issue, here are my findings

1. Only happens with WASAPI sink, Directsound is ok
2. HDMI or SPDIF makes no difference
3. Knock XBMC volume down 1 notch and all is ok
4. Viz on or off makes no difference
5. None of the Replay Gain settings have any effect.
6. SoftAE WASAPI on Gotham also has slight distortation but barely noticably
7. SoftAE WASAPI on Frodo 12.0 has no problems at all

Debug Log - Gotham ActiveAE / WASAPI enabled / xbmc volume 100% - Very noticeably distortion

http://xbmclogs.com/show.php?id=47265

Debug log - Gotham ActiveAE / WASAPI enabled / xbmc volume down 1 notch - No distortion

http://xbmclogs.com/show.php?id=47278

Debug log - Gotham ActiveAE / Directsound enabled / xbmc volume 100% - No distortion

http://xbmclogs.com/show.php?id=47276

Debug log - Gotham SoftAE / WASAPI enabled / volume 100% - Barely noticeably distortion

http://xbmclogs.com/show.php?id=47284

Debug log - Frodo 12.0 SoftAE / WASAPI enabled / volume 100% - No distortion

http://xbmclogs.com/show.php?id=47285

Track used (distortion kicks in about the 1min 20 sec mark and is then at regular intervals during remiainder of track) https://docs.google.com/file/d/0B3xbB2gLTqoeajc3SGZGeXF2Tms/edit?usp=sharing

Very poor attempt at capturing distortion https://docs.google.com/file/d/0B3xbB2gLTqoeVWJzWFItZjl4QVU/edit?usp=sharing

Seems to me to be a clipping issue with the WASAPI sink.


RE: Testing audio engine ActiveAE - jjd-uk - 2013-08-19

(2013-08-19, 21:52)FernetMenta Wrote: check the comments on this commit: https://github.com/xbmc/xbmc/commit/e4fc0a51779709d1595c3a822d41b12ccb931889
i would be grateful if you could do the remaining work. should be clamped in this function.
Do you need anything more than I've just provided?

If so it'll have to wait, been at this 3 hours so off for some chill time now.


RE: Testing audio engine ActiveAE - jjd-uk - 2013-08-19

Btw FernetMenta/fritsch, if there's anything in particular either of you want testing on Windows then I should hopefully be able to oblige, the only thing I'm probably lacking is a full 7.1 speaker setup.


RE: Testing audio engine ActiveAE - da-anda - 2013-08-19

can confirm the wasapi crackle on maxed volume when playing a stereo MP3. my TV is also still having distorted sound via HDMI and wasapi for anything stereo. Will compile and test latest changes and if issue is still there file some logs.


RE: Testing audio engine ActiveAE - negge - 2013-08-19

I have two bug reports.

1. All 6-channel FLAC files (some 24-bit/96Khz, some 16-bit/96Khz, one 24-bit/88.2Khz) produce no sound.

debug log (magic starts at about line 1434)

The AVR switches rapidly between "no signal" and "PCM".

fritsches workarounds (changing speaker layout to 4.0 or disabling LPCM) are confirmed to work.

2. When playing AC3 or DTS using paplayer, then pressing Stop, the visualization (and XBMC in general) freezes inevitable, but the sound keeps on playing.

debug log (partial since I had to force kill XBMC)

I tried running XBMC through gdb but it produced nothing interesting (just the usual threading info). Please advice if there is any gdb magic I could do to get a more useful log.


RE: Testing audio engine ActiveAE - da-anda - 2013-08-20

ok, new tests with latest version (d3d5582). I turned on extended ffmpeg logging this time (just found that option)

- it still froze when I stopped FLAC 5.1 playback, but strangely only when Debug Log was disabled, at least on my test. Will try to reproduce, but using wasapi I've got a lot of freezes
- as reported by negge, no sound for 5.1 FLACs (regardless of wasapi or directsound using spdif), a speaker layout to 4.0 didn't help, still no sound via spdif (debug log)
- here I turned on stereo-upmix and played a stereo FLAC which played fine and upmix worked, but XBMC froze on "stop" (debug log)


RE: Testing audio engine ActiveAE - fritsch - 2013-08-20

@da-anda: The 4.0 workaround is only for LPCM.

When I see it right, Wasapi disagrees on the number of channels. Cause the format is set to 2.0 and wasapi expects 5.1. But not an expert in the Wasapi sink.


RE: Testing audio engine ActiveAE - jjd-uk - 2013-08-20

Going back to GUI sounds I've some new observations from when I was investigating my music playback distortion.

WASAPI - HDMI does after all output GUI sounds with stream silence disabled, however it seems to queue up a load of sounds then plays out in a burst, so I never heard them on my 1st round of tests because I wasn't carrying out enough GUI actions before starting playback. Take a long list and start scrolling, I probably get about 15 items down then sound will suddenly kick in with a quick burst of about 2 sec of multiple clicks that seem to have been buffered, then it will go silent again until you gone down another 15 or so items and then you get another burst of clicks, and so on.

Directsound - HDMI outputs GUI sounds with no problems with or without stream silence.


RE: Testing audio engine ActiveAE - FernetMenta - 2013-08-20

(2013-08-20, 09:31)da-anda Wrote: ok, new tests with latest version (d3d5582). I turned on extended ffmpeg logging this time (just found that option)

- it still froze when I stopped FLAC 5.1 playback, but strangely only when debug log was disabled, at least on my test. Will try to reproduce, but using wasapi I've got a lot of freezes
- as reported by negge, no sound for 5.1 FLACs (regardless of wasapi or directsound using spdif), a speaker layout to 4.0 didn't help, still no sound via spdif (debug log)
- here I turned on stereo-upmix and played a stereo FLAC which played fine and upmix worked, but XBMC froze on "stop" (debug log)

here the WASAPI sink is wrong:

Code:
wfxex.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
    if (format.m_dataFormat == AE_FMT_AC3 || format.m_dataFormat == AE_FMT_DTS)
    {
      wfxex.dwChannelMask               = bool (format.m_channelLayout.Count() == 2) ? KSAUDIO_SPEAKER_STEREO : KSAUDIO_SPEAKER_5POINT1;
      wfxex.SubFormat                   = KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_DIGITAL;
      wfxex.Format.wBitsPerSample       = 16;
      wfxex.Samples.wValidBitsPerSample = 16;
      wfxex.Format.nChannels            = (WORD)format.m_channelLayout.Count();
      wfxex.Format.nSamplesPerSec       = format.m_sampleRate;
    }

it should set channelMask to KSAUDIO_SPEAKER_STEREO and number to 2 when AC3 or DTS is requested.

EDIT: iI will fix this in ActiveAE as well, only requesting two channels for AC3.


RE: Testing audio engine ActiveAE - FernetMenta - 2013-08-20

(2013-08-19, 22:41)fritsch Wrote: Nope, won't cry :-)

DTS-HD is transfered differently. What do you think is the problem - I like my calculation though :-)

Run the ALSA sink in non-blocking mode and it will play 5.1 96khz. So far I have no clue why.


RE: Testing audio engine ActiveAE - fritsch - 2013-08-20

Could be some buffer + pcm_wait problem. The sink waits periodSize time, during that time bufferSize should be free - if not, bad. The non-blocking sink seems to just push more often.

Could be a non matching m_sinkBuffer in the AEAlsaSink?


RE: Testing audio engine ActiveAE - FernetMenta - 2013-08-20

I think this is because period size is half entire buffer:
Got: periodSize 1360, bufferSize 2720

Consider this case:
snd_pcm_avail returns 1359
at the time snd_pcm_wait is called it may already be 1360+x
now waiting for a period results in an underrun.


RE: Testing audio engine ActiveAE - fritsch - 2013-08-20

When looking in the code - I wanted to make sure we have always Buffersize / periodsize is at least 4. Something is not working correctly on the way.


RE: Testing audio engine ActiveAE - FernetMenta - 2013-08-20

(2013-08-19, 23:52)negge Wrote: I have two bug reports.

1. All 6-channel FLAC files (some 24-bit/96Khz, some 16-bit/96Khz, one 24-bit/88.2Khz) produce no sound.

debug log (magic starts at about line 1434)

The AVR switches rapidly between "no signal" and "PCM".

fritsches workarounds (changing speaker layout to 4.0 or disabling LPCM) are confirmed to work.

2. When playing AC3 or DTS using paplayer, then pressing Stop, the visualization (and XBMC in general) freezes inevitable, but the sound keeps on playing.

debug log (partial since I had to force kill XBMC)

I tried running XBMC through gdb but it produced nothing interesting (just the usual threading info). Please advice if there is any gdb magic I could do to get a more useful log.

2) is fixed. paplayer requests fading on a raw stream which does not make any sense. I intercept this attempt in the engine now.