SRGSSR / srgletterbox-apple

The official SRG SSR media playback experience
https://srgssr.github.io/marketing/letterbox/
MIT License
14 stars 7 forks source link

Initial buffering when starting livestream playback on low-end Apple TV HD devices #320

Closed defagos closed 3 months ago

defagos commented 3 months ago

On low-end Apple TV HD devices and depending on the content bitrate and the network connection, some additional buffering can be observed when starting SRG SSR livestreams (most notably the new SRF Info livestream on AWS).

Issue type

Other: Annoyance

Environment information

Reproducibility

Easy to reproduce

Steps to reproduce

  1. Launch the Pillarbox demo app.
  2. Play SRF Info livestream.
defagos commented 3 months ago

Sample project

Here are two variants of a trivial sample project, one with support for DRM and the other without. Run these projects on an Apple TV HD with the Playback HUD developer option enabled to observe bandwidth changes. Stream URLs might need to be updated.

With Instruments we can observe additional activity at startup, associated with AVMediaRemoteManager, at which time quality switching and rebuffering occurs:

Screenshot 2024-05-31 at 08 41 31

This activity, the quality switch and the rebuffering disappear if we comment out navigationMarkers entirely.

Interpretation

It is likely that the additional activity generated by the presence of navigation markers associated with a livestream creates a brief initial CPU load, leading to bandwidth heuristics suddenly dropping, forcing a quality switch.

This also explains why Pillarbox is not affected, as it provides no navigation markers for livestreams.

This issue was discovered when delivering the new DRM-protected streams to production. These streams are encoded and packaged differently, with shorter segment size, which might explain why the issue is more visible with them.

What to do

We could of course remove navigation markers on low-end devices but Apple might solve these performance issues with tvOS 18. We also want to keep navigation markers for livestreams in Letterbox.

For this reason it is better to do nothing and to treat this as a minor issue. Once playback enters nominal behavior the situation is stable, it is only at startup that some rebuffering might be observed.