media3/libraries
bachinger dee83cc7db Update session position info on timeline change
This fixes an inconsistent state of the `PlayerInfo` when the index of the playing
media item is changed by a playlist modification. In this inconsistent state,
calling `Playerinfo.getCurrentMediaItem` can produce an
`ArrayIndexOutOfBoundException` (see stack trace in GH issue).

This change takes the following measurements:

- always update sessionPosition and timeline of the PlayerInfo together in
  `MediaSessionImpl.PlayerListener` where the PlayerInfo originates from
- add an assertion to avoid building a `PlayerInfo` instance in an inconsistent
  state
- reduce the window of opportunity for concurrent access to
  `mediaSessionImpl.playerInfo` when dispatching player info changes in
  `MediaSessionImpl`

Issue: androidx/media#51
PiperOrigin-RevId: 444812661
2022-05-09 10:16:33 +01:00
..
2022-02-18 14:54:02 +00:00