-
Notifications
You must be signed in to change notification settings - Fork 556
Adds load info to DrmSessionEventListeneronDrmKeysLoaded()
#1134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
c1dd7b6
e21e4ca
99f76a1
d6514d5
d7d54f4
4a00318
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package androidx.media3.exoplayer.drm; | ||
|
||
import androidx.annotation.Nullable; | ||
import androidx.media3.common.DrmInitData.SchemeData; | ||
import androidx.media3.common.util.Assertions; | ||
import androidx.media3.exoplayer.source.LoadEventInfo; | ||
import com.google.common.collect.ImmutableList; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import org.checkerframework.checker.nullness.qual.MonotonicNonNull; | ||
|
||
/** | ||
* Encapsulates info for the sequence of load requests ({@link LoadEventInfo}, which were required | ||
* to complete loading a DRM key | ||
*/ | ||
public class KeyRequestInfo { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Refactor renamed, in prep for other license requests beside Key load. |
||
|
||
public static class Builder { | ||
@MonotonicNonNull private LoadEventInfo loadEventInfo; | ||
private final List<LoadEventInfo> retriedLoadRequests; | ||
@Nullable private final List<SchemeData> schemeDatas; | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Clean up the lint,
|
||
public Builder(@Nullable List<SchemeData> schemeDatas) { | ||
this.schemeDatas = schemeDatas; | ||
retriedLoadRequests = new ArrayList<>(); | ||
loadEventInfo = null; | ||
} | ||
|
||
public Builder setMainLoadRequest(LoadEventInfo loadEventInfo) { | ||
this.loadEventInfo = loadEventInfo; | ||
return this; | ||
} | ||
|
||
public Builder addRetryLoadRequest(LoadEventInfo loadEventInfo) { | ||
retriedLoadRequests.add(loadEventInfo); | ||
return this; | ||
} | ||
|
||
public KeyRequestInfo build() { | ||
Assertions.checkNotNull(loadEventInfo, "build() called before setMainLoadRequest()"); | ||
return new KeyRequestInfo(this); | ||
} | ||
} | ||
|
||
/** | ||
* The {@link LoadEventInfo} for the initial request to laod the key, or null if no load required | ||
*/ | ||
public final LoadEventInfo loadEventInfo; | ||
|
||
/** If the load required multiple retries, the {@link LoadEventInfo} for each retry */ | ||
public final ImmutableList<LoadEventInfo> retriedLoadRequests; | ||
|
||
/** | ||
* The DRM {@link SchemeData} that identifies the loaded key, or null if this session uses offline | ||
* keys. // TODO add sessionId to the KeyLoadInfo maybe? | ||
*/ | ||
@Nullable public final ImmutableList<SchemeData> schemeDatas; | ||
|
||
private KeyRequestInfo(Builder builder) { | ||
retriedLoadRequests = | ||
new ImmutableList.Builder<LoadEventInfo>().addAll(builder.retriedLoadRequests).build(); | ||
loadEventInfo = builder.loadEventInfo; | ||
schemeDatas = builder.schemeDatas == null ? null : ImmutableList.copyOf(builder.schemeDatas); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be useful if you want the trails of
LoadEventInfo
's including redirects in the path. The mainLoadEventInfo
should include all the time.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this will report all (most? any?) redirects - because at least some types of redirect will be 'silently' handled inside the
HttpDataSource
implementation underneathHttpMediaDrmCallback
, e.g.media/libraries/datasource/src/main/java/androidx/media3/datasource/DefaultHttpDataSource.java
Line 594 in 0480bc3
So I think we need to be quite careful we can usefully describe what this field holds, because i think it will only show retries that happened at this
DefaultDrmSession
layer.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is certainly true for
DefaultHttpDataSource
, not sure forCronet
. something we'll look into, as our servers are using this as a method to hold off clients when they are loaded. Also, the POST data is retained in theHttpMediaDrmCallback
so not sure if the POST redirect in the stack will do this correctly.We'll have a look and let you know, definitely preference would be to do it in the
HttpMediaDrmCallback
as the default redirect following code in lower layers usually is much higher than 5 tries.FWIW this is the same as how other
Loader
/Loadable
implementations handle this.Definitely something to look into.