Skip to content
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

[Android] 5.1 audio tracks cause buffering #757

Open
matthuisman opened this issue Jul 20, 2021 · 20 comments
Open

[Android] 5.1 audio tracks cause buffering #757

matthuisman opened this issue Jul 20, 2021 · 20 comments

Comments

@matthuisman
Copy link
Contributor

matthuisman commented Jul 20, 2021

i initially thought this was same issue as: #693
but it seems it is not, due to that issue being fixed with: #734

But even with that PR, this issue is still present.
Some streams with 5.1 audio will buffer. But if you change to 2.0 audio - they work fine.
Same if even using the lowest video resolution so not a bandwidth issue.

Going to try to gather logs and hopefully be able to create a test stream to reproduce.

https://forum.kodi.tv/showthread.php?tid=358484&pid=3038367#pid3038367
#693 (comment)

It may even be a bug in Kodi with it's audio down-sampling?
I guess a test on a 5.1 capable system with passthrough would tell us if that's the case

example manifest which has issues
example.mpd.txt

@matthuisman
Copy link
Contributor Author

ok, so I have logs.

AC3 test, Kodi-CPU sits around 160%
EAC3 test, Kodi-CPU sits around 250%
AAC test, Kodi-CPU sits around 80%

Here are the logs for each test:
HBO-Audio-Logs.zip

@matthuisman
Copy link
Contributor Author

matthuisman commented Aug 4, 2021

seems to be fixed with this pr: #732

Test versions:

AARCH64 (nvidia shield)
https://jenkins.kodi.tv/job/xbmc/job/inputstream.adaptive/job/PR-732/9/artifact/cmake/addons/build/zips/inputstream.adaptive+android-aarch64/inputstream.adaptive-2.6.17.zip

ARM7 (Mi box etc)
https://jenkins.kodi.tv/job/xbmc/job/inputstream.adaptive/job/PR-732/9/artifact/cmake/addons/build/zips/inputstream.adaptive+android-armv7/inputstream.adaptive-2.6.17.zip

Please note:
that is a very experimental work in progress build from this wip
it may probably break other stuff.
So just use it to test HBO Max 5.1 issues but then revert back to the version from repo if you have other problems

@matthuisman
Copy link
Contributor Author

matthuisman commented Aug 4, 2021

@Liqianyu @Enigma3000
Please see above comment for test IA versions
please report back on this issue

@Liqianyu
Copy link

Liqianyu commented Aug 4, 2021

@matthuisman
After testing, I don't think this solved the problem.
Audio is stuttering from the start of playback and video is blacked out 32 seconds after the start of playback.
Checking the OSD menu visible automatically switches to another video track and the original resolution disappears.

@matthuisman
Copy link
Contributor Author

just use quality control to force a quality.
Also make sure Kodi isn't automatically updating inputstream adaptive after you install the above test version

@Liqianyu
Copy link

Liqianyu commented Aug 4, 2021

@matthuisman
I tested it by playing 《Wonder Woman 1984》on Shield TV Pro 2019.

If force the quality, the video will not have a problem. Selecting DD+ 5.1ch when playing will lose the sound when it starts playing 32 seconds(but my AV amp shows it is still receiving DD+ 5.1ch). If I select DD+ Atmos, the sound will stutter. (but does not disappear at 32 seconds) Even switching from DD+ 5.1ch to Atmos will stutter.

IA 2.6.22 does not require forced quality and has no problem with DD+ 5.1ch. But DD+ Atmos will stutter. I need to switch from DD+ 5.1ch to DD+ Atmos instead of selecting Atmos when starting playback.
Atmos does not stutter (but seems to have a burr sound) if you turn off allow pass-through output This option cannot be toggled during playback. Otherwise it will mess up the video and audio. (color anomaly and play hearing impaired auxiliary track)

@matthuisman
Copy link
Contributor Author

matthuisman commented Aug 4, 2021

Please ready my comment about the test version.
Its not a fix for everything - trying to test fixing the audio issue ONLY.

actually, i think you have another issue that maybe related to Atmos.
I tried and get same behaviour - DD+ on Wonder Woman cuts at around 32s.

However, this is not what I've been trying to find a fix for

With non-atmos 5.1 tracks, I often get buffering almost immediately on other content.
eg. Sesame Street S51E35
Both with EAC3 or AC3 - itll buffer almost immediality.
But with the above new build - I don't get that issue

i've just added a new setting to HBO Max that allows turning on / off Atmos.
With it off, you still get the normal DD+.

with current IA, I get buffering with standard DD+ or AC3.
That new IA version fixes that for me.
i also see playback start faster. less loading time after selecting quality

Atmos i suspect is something different.
with latest HBO, you can turn off Atmos for now.
I dont even know if Kodi android can process atmos over EAC3 (i think just TrueHD)
And not sure if it can passthrough it either..
would need to ask in the forums probably.
Are you trying to passthrough it?

i wonder if that PR plus: 8a58fc1 will help

@glennguy
do you think you could rebase rework off latest Master?

@matthuisman
Copy link
Contributor Author

matthuisman commented Aug 5, 2021

@"Liqianyu"
Please test again. in HBO Max settings, make sure Atmos is disabled.
then force a video quality so this IA version doesn't try to adaptive switch.
Just testing for normal 5.1 AC3 or DD+ causing buffering.
Everyone else has confirmed that is fixed with this version.
One thing at a time

@Liqianyu
Copy link

Liqianyu commented Aug 5, 2021

@matthuisman
Reran the test, AC3 always loses audio briefly during playback, but DD+ has no problem at all.
As for buffering, it does not appear at all.

@matthuisman
Copy link
Contributor Author

matthuisman commented Aug 5, 2021

@Liqianyu
i think i may have just fixed Atmos :)
I did some "magic" in my Slyguy Proxy to separate the ATMOS out into it's own adapation set seperate from the standard EC3.
https://github.com/matthuisman/slyguy.addons/blob/b658e18e0813207cb41282b3a40ea0b0ac6ee2bb/script.module.slyguy/resources/lib/proxy.py#L417

This way it shows separately and I can add a label to identify it.
And after that - it seems to work good now!
So i suspect inputstream didn't like having the atmos and ec-3 representations in the same adaption set.

Please force update slyguy by following below, then test ATMOS.
(i think you still need the new experimental build of IA though)

I also can't replicate the AC3 issue you have...
I'm testing on Wonder Woman - i dont have passthrough though

@Liqianyu
Copy link

Liqianyu commented Aug 6, 2021

@matthuisman
I've noticed many version updates, nice job.
I tested it again.
I used HBO v0.4.3, slyguy v0.38.4 (I know the latest has reached v0.38.5, just after my testing), new experimental build of IA though
There is a problem with DD/DD+ Atmos. DD loses audio 40 seconds after playback starts, and then again at a minute or so. This is regular. And DD+ Atmos will stutter continuously.
DD+ 5.1ch has no problems at all. Also no buffering issues whatsoever.
I use audio passthrough and I need to keep testing.

@matthuisman
Copy link
Contributor Author

matthuisman commented Aug 6, 2021

double check you are using that experimental IA
It will try to auto update to latest due to it using older version

@Liqianyu
Copy link

Liqianyu commented Aug 6, 2021

@matthuisman
Copy link
Contributor Author

matthuisman commented Aug 6, 2021

you can disable update for IA by going into and config and turning off auto update

Oh, you probably need my PR to allow multiple sessions for Widevine in there too.
Thats what fixed some audio problems too.

Hopefully we have a build soon with both fixes

@glennguy
Copy link
Contributor

glennguy commented Aug 6, 2021

@Liqianyu @matthuisman
latest changes are here: https://jenkins.kodi.tv/blue/organizations/jenkins/xbmc%2Finputstream.adaptive/detail/PR-732/10/artifacts

I've disabled audio representation switching, that may solve the audio cutting out after 32 seconds.
Multiple drm sessions for Widevine fix included also (helps stop stuttering).

@Liqianyu
Copy link

Liqianyu commented Aug 6, 2021

@matthuisman @glennguy
https://forum.kodi.tv/showthread.php?tid=358484&pid=3053117#pid3053117
As Wagg said, The Suicide Squad didn't have any problems for me either. Including DD\DD+\DD+ Atmos, but Wonder Woman 1984 both in the new experimental build of IA though, and in the release version. DD+ Atmos will stutter consistently. And DD also had more serious problems, fixing to lose audio for the first time after 40 seconds, and then again for longer at 1 minute. The time of occurrence is fixed each time.
I'm wondering if this could be the reason for HBO Max?

@CastagnaIT
Copy link
Collaborator

not sure could be related to this, recently has been fixed in kodi core audio stuttering for most of DD audio formats
you can test with last Kodi 19 nightly if there are improvements

@CastagnaIT
Copy link
Collaborator

CastagnaIT commented Feb 27, 2023

its possible to have a feedback (with log if problem still occurs) with last kodi nightly (v21)?

and having a recap about this problem?
is only HBO related or general?
HBO use a particular audio format?
confirm only android affected?

@sh4k4
Copy link

sh4k4 commented Feb 28, 2023

@CastagnaIT
I think it's happenning just with DD+ Atmos (AUDIO_E_AC3_JOC) from HBO.

Logs:
MPD
Manifest.txt

Kodi 20
log.txt

on Chromecast with Google TV
I can test on Nvidia Shield too.

<Representation mimeType="audio/mp4" audioSamplingRate="48000" bandwidth="770415" codecs="ec-3" id="a18">
<SupplementalProperty schemeIdUri="tag:dolby.com,2018:dash:EC3_ExtensionType:2018" value="JOC"> </SupplementalProperty>
        <SupplementalProperty schemeIdUri="tag:dolby.com,2018:dash:EC3_ExtensionComplexityIndex:2018" value="16"></SupplementalProperty>
        <AudioChannelConfiguration schemeIdUri="urn:mpeg:mpegB:cicp:ChannelConfiguration" value="6"></AudioChannelConfiguration>
        <BaseURL>a/17_be9e8c/a18.mp4</BaseURL>
        <SegmentBase timescale="48000" indexRange="1516-11051">
          <Initialization range="0-1515"></Initialization>
        </SegmentBase>
      </Representation>

Samplerate keeps changing

CDVDDemuxClient::ParsePacket - (1005) samplerate changed from 48000 to 24000
CDVDDemuxClient::ParsePacket - (1005) samplerate changed from 24000 to 44100
CDVDDemuxClient::ParsePacket - (1005) samplerate changed from 44100 to 48000
CDVDDemuxClient::ParsePacket - (1005) samplerate changed from 48000 to 32000

When the same audio is decrypted manually with mp4 decrypt, it plays without problem on the same device.

@CastagnaIT
Copy link
Collaborator

can you test with last Kodi 21 nightly http://mirrors.kodi.tv/nightlies/
and with last ISA release 21.1.3 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants