Migrate usages of DrmConfiguration.sessionForClearTypes to new field

The new forcedSessionTrackTypes field was introduced in
<unknown commit>.

These usages are migrated in a follow-up change to add confidence that
the deprecated field continued to work correctly.

PiperOrigin-RevId: 403342893
This commit is contained in:
ibaker 2021-10-15 12:52:12 +01:00 committed by Oliver Woodman
parent 61c8f8c27e
commit 18b1f3d624
2 changed files with 8 additions and 6 deletions

View File

@ -226,13 +226,14 @@ public class IntentUtil {
}
intent.putExtra(DRM_KEY_REQUEST_PROPERTIES_EXTRA + extrasKeySuffix, drmKeyRequestProperties);
List<@C.TrackType Integer> drmSessionForClearTypes = drmConfiguration.sessionForClearTypes;
if (!drmSessionForClearTypes.isEmpty()) {
List<@C.TrackType Integer> forcedDrmSessionTrackTypes =
drmConfiguration.forcedSessionTrackTypes;
if (!forcedDrmSessionTrackTypes.isEmpty()) {
// Only video and audio together are supported.
Assertions.checkState(
drmSessionForClearTypes.size() == 2
&& drmSessionForClearTypes.contains(C.TRACK_TYPE_VIDEO)
&& drmSessionForClearTypes.contains(C.TRACK_TYPE_AUDIO));
forcedDrmSessionTrackTypes.size() == 2
&& forcedDrmSessionTrackTypes.contains(C.TRACK_TYPE_VIDEO)
&& forcedDrmSessionTrackTypes.contains(C.TRACK_TYPE_AUDIO));
intent.putExtra(DRM_SESSION_FOR_CLEAR_CONTENT + extrasKeySuffix, true);
}
}

View File

@ -110,7 +110,8 @@ public final class DefaultDrmSessionManagerProvider implements DrmSessionManager
drmConfiguration.scheme, FrameworkMediaDrm.DEFAULT_PROVIDER)
.setMultiSession(drmConfiguration.multiSession)
.setPlayClearSamplesWithoutKeys(drmConfiguration.playClearContentWithoutKey)
.setUseDrmSessionsForClearContent(Ints.toArray(drmConfiguration.sessionForClearTypes))
.setUseDrmSessionsForClearContent(
Ints.toArray(drmConfiguration.forcedSessionTrackTypes))
.build(httpDrmCallback);
drmSessionManager.setMode(MODE_PLAYBACK, drmConfiguration.getKeySetId());
return drmSessionManager;