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

[Bug] audio buffer stuttering loop on stream underrun ("large audio sync error") #1645

Open
ge0rg opened this issue Aug 20, 2024 · 4 comments
Labels
Triage: Needed (managed by bot) issue that was just created and needs someone looking at it

Comments

@ge0rg
Copy link

ge0rg commented Aug 20, 2024

Describe the problem

After multiple failures to load the next segment from a streaming service, Kodi will keep playing back the last used audio buffer, causing a very loud and annoying stuttering sound (remember when old PC games crashed?). I thought this is related to #1629 but it's still happening with ISA 21.5.2.

I'm not asking you to fix the rotten backend, but when running out of audio data, Kodi should stop playback instead of just repeating the last sample buffer.

Unfortunately it's not possible to reproduce by merely disconnecting the running Kodi from the Internet, in that case it will properly pause playback, so a HTTP 502 response seems to trigger a different code path in ISA/Kodi.

Possible fix

No response

Steps to reproduce

  1. Run a video from a streaming service
  2. Wait for the streaming service backend to fail on a URL multiple times with HTTP 502
  3. Wake up from loud audio stuttering

Debug log

https://paste.kodi.tv/alagajalet.kodi
log.txt

Stream manifest file(s)

No response

Additional info

Relevant log timestamps:

  • 2024-08-20 00:21:13.722 T:21133 start of playback of the video
  • 2024-08-20 00:31:38.618 T:21143 first HTTP error 502
  • 2024-08-20 00:31:50.240 T:31275 stuttering begins
  • 2024-08-20 00:31:57.773 T:31266 I press the [stop] key, stuttering stops

Operating system(s)

Linux

Operating system version(s)

Arch Linux / ALARM

InputStream Adaptive version(s)

21.5.2

Kodi version(s)

21.0

@ge0rg ge0rg added the Triage: Needed (managed by bot) issue that was just created and needs someone looking at it label Aug 20, 2024
@CastagnaIT
Copy link
Collaborator

definitely there is no relation to #1629 because your manifest use mp4 containers manifest.mpd.txt

Unfortunately it's not possible to reproduce by merely disconnecting the running Kodi from the Internet, in that case it will properly pause playback, so a HTTP 502 response seems to trigger a different code path in ISA/Kodi.

same code path, we dont handle HTTP errors in different ways,
the difference is that when you cut the internet connection, all streaming buffer will be blocked then Kodi core stop all,
instead here only the audio stream is blocked/buffering

the HTTP error 502 is a server error, something on server was wrong, but idk the reason behind it
one thing to check is about that file:
https://vodnowusoawsdash-a.akamaihd.net/p112/manifest/rtlplushd/399244-10/10000.ism/dash/10000-audio=128000-30720000.dash

every time go in error when try to download this file, or each time there is a different file that raise 502?
if it is always the same file, if you try to play the video on webbrowser, that file is downloaded by the browser? (on browser F12 to open network flow)

one think to check if when audio stream is blocked the CSession::GetNextSample return waiting = stream.get(); correctly or not, atm i cant provide you an answer

@ge0rg
Copy link
Author

ge0rg commented Aug 20, 2024

the HTTP error 502 is a server error, something on server was wrong, but idk the reason behind it
one thing to check is about that file

HTTP 502 is "Bad Gateway", typically sent when a CDN frontend wasn't able to reach a backend server. I'm pretty sure those errors are intermittent, maybe only staying for a dozen seconds, or maybe related to a backend reconfiguration that's pushed to the manifest that Kodi doesn't see because it's using the initially cached version? The problem appears maybe once in 10h of streaming, and stopping and restarting the video (and seeking to the previous position) makes it work again.

However, if I don't manually intervene, Kodi will just stay there forever, showing a freeze frame and looping the last audio buffer, and this is what I'd like to not happen any more. I'm not sure if it's possible to re-download the manifest after six HTTP errors, and to try to re-sync, or at least to stop playback there.

@CastagnaIT
Copy link
Collaborator

I'm not sure if it's possible to re-download the manifest after six HTTP errors, and to try to re-sync, or at least to stop playback there.

has nothing to do with manifest its static then all data will be always the same, the only thing that a manifest could provide in this case is more BaseURL's to provide a CDN fallback, but there is no on the manifest just one

Things to check is:
-after 6 failed download attempts i would expect playback to stop
-check CSession::GetNextSample behaviour when the problem happens
atm i have no time so i cant give you an answer right now

@ge0rg
Copy link
Author

ge0rg commented Sep 4, 2024

I would also expect playback to stop after the failed downloads, but it's hanging in the annoying audio loop instead. Did you have a chance to look at the GetNextSample behavior? Do you need a run from a version with additional debugging?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Triage: Needed (managed by bot) issue that was just created and needs someone looking at it
Projects
None yet
Development

No branches or pull requests

2 participants