Description
Use case description
The use case involves streaming a large linear channel list (>100 channels) consisting of Live HLS and DASH playlists, protected by Widevine. Playback is continuous, and "channel zapping" or "channel surfing" is a frequent activity. Channels may be licensed individually or in packages.
Most Android streaming hardware supports a significant number of open MediaDrm
session slots (e.g., Google TV Chromecast, based on AmLogic SoC, supports 100 active license slots).
Currently, ExoPlayer retains open sessions for MediaItem
s in a timed cache, however this cache is flushed whenever any MediaSource
that references it is released.
The Playlist avoids this as the MediaItem
's in it are associated with MediaSource
s are not fully released until the MediaSourceList
(playlist) is released.
In contrast, changing channels by calling Player.setMediaItems()
with a single channel's MediaItem
releases the current MediaSource
, effectively flushing the DRM session cache every time.
The use case precludes the use of a Playlist due to the following challenges:
- The Playlist API does not directly preclude multiple live items, however it makes little sense contextually
- Retaining a fully prepared live
MediaSource
consumes significant CPU, memory, and network bandwidth, as it retains source buffers and continues polling live playlist refreshes. - Linear channel provisioning often occurs on-the-fly, making it impractical to pre-create a playlist of 100+ channels before playback starts.
Related Requests
The issue #394 presented a very similar request, however it looked like the request was to persist licnese after process exit.
The Widevine CDM platform will not support this as the open MediaDrm sessions owned by a process are released on process exit. In fact it is not really valid to retain open MediaDrm sessions while the Activity is not in the foreground as they are a shared hardware resource.
Proposed solution
Pull request #2049
Alternatives considered
The Playlist could be made acceptable, but some mechanism for quiescing the Timeline.Window
live windows that are not currently playing. The quiesce would stop the playlist tracker and free cached media without fulling releasing the MediaSource
. This would be a much more significant change than what is proposed in the pull request.