shaka-project / shaka-player-embedded

Shaka Player in a C++ Framework
Apache License 2.0
238 stars 63 forks source link

Video freezes during live content playback #129

Closed okycelt closed 4 years ago

okycelt commented 4 years ago

Issue description

When playing live content, the video freezes every few seconds for about a second or two while the audio keeps playing. After the freeze, the video mostly continues in a correct position. In a few cases, the audio and video were out of sync though.

I'm not sure if there's any connection, but the video freezes every time after the following message appears in the log [Info]: "Updating manifest...". Also, it seems that the main thread is blocked during the freeze.

We're using Widevine-encrypted DASH, but the issue also happens with clear DASH content. Our content is packaged by Shaka Packager.

Might be related to #91.

Reproduction steps

  1. Play live content
  2. The video should freeze every few seconds

Link to test content

We can provide a live stream for debugging, but not publically. Is there an email address we can send the link to?

Logs captured from the device

spe-live-clear-logs.txt spe-live-wv-logs.txt

Version of Shaka Player Embedded

3cbc8c1ea58877b20a3016407ebfaecc5bfaf524

Device(s) and version(s) of iOS being used

iPhone 8 with iOS 13.3.1 Simulator with iOS 13.3

TheModMaker commented 4 years ago

Do you have a large manifest? What may be happening is the main thread is blocked while parsing the manifest and that may take a while. We can't append new segments while parsing the manifest.

You can send the manifest to shaka-player-issues@google.com.

jakubvojacek commented 4 years ago

Hello @TheModMaker,

I have just sent the link to shaka-player-issues@google.com, the manifest is rather small, just about 80 lines.

Thank you Jakub

okycelt commented 4 years ago

Hello @TheModMaker,

Have you been able to reproduce the issue with our testing stream?

Thank you

TheModMaker commented 4 years ago

Yes, I was able to reproduce. What is happening is some of the top-level ShakaPlayer APIs call into JavaScript to query its state; this can only be done on the JS main thread, so they block until we can call into it. Since the manifest takes a while to update, the main thread blocks until the update is done.

I'm working on making these methods asynchronous to avoid blocking the main thread. Note that although your manifest has only a few lines, since you have a bunch of segments, it takes a while to create the segment index.

okycelt commented 4 years ago

Okay, I understand. That's what we somewhat suspected. Thanks for the update.