You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 MediaItems 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 MediaSources 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 liveMediaSource 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.
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.
The text was updated successfully, but these errors were encountered:
however this cache is flushed whenever any MediaSource that references it is released.
I'm not sure I completely agree with this statement.
I think a more precise statement would be:
The cache is flushed when the DefaultDrmSessionManager reference count (as incremented and decremented by DrmSessionManager.prepare() and DrmSessionManager.release() calls) reaches zero.
So if you only have a single MediaSource instance, and it's the only thing holding a reference to your DefaultDrmSessionManager, then I agree that when the MediaSource is released then the DefaultDrmSessionManager will be "fully" released too.
But it should work to do something like this:
Use MediaSource.Factory.setDrmSessionManagerProvider to wrap DefaultDrmSessionManagerProvider and hook the DefaultDrmSessionManager that is returned, and if it's one you haven't seen before then cache it and store your own reference to it using DrmSessionManager.acquire (and maybe release any previously cached instance).
When you release your ExoPlayer also release any cached DefaultDrmSessionManager instance
This should ensure that the DefaultDrmSessionManager instance is kept when you call Player.setMediaItem, and so you should benefit from sessionKeepAliveMs. The default value for this is 5mins, but you could set it much higher (e.g. 12hrs).
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 anyMediaSource
that references it is released.The Playlist avoids this as the
MediaItem
's in it are associated withMediaSource
s are not fully released until theMediaSourceList
(playlist) is released.In contrast, changing channels by calling
Player.setMediaItems()
with a single channel'sMediaItem
releases the currentMediaSource
, effectively flushing the DRM session cache every time.The use case precludes the use of a Playlist due to the following challenges:
MediaSource
consumes significant CPU, memory, and network bandwidth, as it retains source buffers and continues polling live playlist refreshes.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 theMediaSource
. This would be a much more significant change than what is proposed in the pull request.The text was updated successfully, but these errors were encountered: