mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00

When a renderer is pre-enabled (while another playback is still ongoing), we pass mayRenderStartOfStream=false to Renderer.enable. This ensures we don't show any first frames while the previous media is still playing. Currently, we never tell the renderer when we actually stop playing the previous media so that it could render the start of the stream, because we allow this as soon as the renderer is in STATE_STARTED and we assume that we have to be in STATE_STARTED to make this stream transition. While this assumption is true, there are also cases where we can't start the renderers because they are not ready yet and the video renderer can't become ready because it didn't render its first frame. This effectively blocks playback forever. The most direct way of solving this, is to tell the renderer that playback has transitioned and that it is now allowed to render the start of the stream. This means it can never get blocked as described above. PiperOrigin-RevId: 547727347