xbmc / inputstream.adaptive

kodi inputstream addon for several manifest types
Other
452 stars 241 forks source link

[Android] 5.1 audio tracks cause buffering #757

Open matthuisman opened 3 years ago

matthuisman commented 3 years ago

i initially thought this was same issue as: https://github.com/xbmc/inputstream.adaptive/issues/693 but it seems it is not, due to that issue being fixed with: https://github.com/xbmc/inputstream.adaptive/pull/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 https://github.com/xbmc/inputstream.adaptive/issues/693#issuecomment-878962095

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 commented 3 years ago

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 commented 3 years ago

seems to be fixed with this pr: https://github.com/xbmc/inputstream.adaptive/pull/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 commented 3 years ago

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

Liqianyu commented 3 years ago

@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 commented 3 years ago

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 commented 3 years ago

@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 commented 3 years ago

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: https://github.com/xbmc/inputstream.adaptive/commit/8a58fc117cc589d416bb43b4c20e1f37d0e840da will help

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

matthuisman commented 3 years ago

@"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 commented 3 years ago

@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 commented 3 years ago

@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 commented 3 years ago

@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 commented 3 years ago

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

Liqianyu commented 3 years ago

@matthuisman I am using this build 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 It will try to update automatically and I will make sure to test before updating.

matthuisman commented 3 years ago

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 commented 3 years ago

@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 commented 3 years ago

@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 commented 2 years ago

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 commented 1 year ago

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 commented 1 year ago

@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 commented 1 year ago

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