Commit 50efd866 by ibaker Committed by Ian Baker

Rollback of https://github.com/androidx/media/commit/d5482fe3432f0a2e034d4a8579cc05a5e229ea4d

*** Original commit ***

Don't call MediaDrm.setLogSessionId in FrameworkMediaDrm

This method throws an UnsupportedOperationException on some Android 12
devices.

***

PiperOrigin-RevId: 433708582
parent d0db1114
......@@ -15,6 +15,8 @@
*/
package androidx.media3.exoplayer.drm;
import static androidx.media3.common.util.Assertions.checkNotNull;
import android.annotation.SuppressLint;
import android.media.DeniedByServerException;
import android.media.MediaCrypto;
......@@ -23,6 +25,7 @@ import android.media.MediaDrm;
import android.media.MediaDrmException;
import android.media.NotProvisionedException;
import android.media.UnsupportedSchemeException;
import android.media.metrics.LogSessionId;
import android.os.PersistableBundle;
import android.text.TextUtils;
import androidx.annotation.DoNotInline;
......@@ -188,7 +191,13 @@ public final class FrameworkMediaDrm implements ExoMediaDrm {
@Override
public void setPlayerIdForSession(byte[] sessionId, PlayerId playerId) {
// TODO(b/221032172): Implement this when CDM compatibility issues are resolved.
if (Util.SDK_INT >= 31) {
try {
Api31.setLogSessionIdOnMediaDrmSession(mediaDrm, sessionId, playerId);
} catch (UnsupportedOperationException e) {
Log.w(TAG, "setLogSessionId failed.");
}
}
}
// Return values of MediaDrm.KeyRequest.getRequestType are equal to KeyRequest.RequestType.
......@@ -518,5 +527,16 @@ public final class FrameworkMediaDrm implements ExoMediaDrm {
public static boolean requiresSecureDecoder(MediaDrm mediaDrm, String mimeType) {
return mediaDrm.requiresSecureDecoder(mimeType);
}
@DoNotInline
public static void setLogSessionIdOnMediaDrmSession(
MediaDrm mediaDrm, byte[] drmSessionId, PlayerId playerId) {
LogSessionId logSessionId = playerId.getLogSessionId();
if (!logSessionId.equals(LogSessionId.LOG_SESSION_ID_NONE)) {
MediaDrm.PlaybackComponent playbackComponent =
checkNotNull(mediaDrm.getPlaybackComponent(drmSessionId));
playbackComponent.setLogSessionId(logSessionId);
}
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment