mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Add MediaSource-provided-DRM support to Renderer implementations
PiperOrigin-RevId: 250719155
This commit is contained in:
parent
090f359895
commit
7e187283cd
3 changed files with 30 additions and 15 deletions
|
|
@ -489,6 +489,7 @@ public class LibvpxVideoRenderer extends BaseRenderer {
|
||||||
* @throws ExoPlaybackException If an error occurs (re-)initializing the decoder.
|
* @throws ExoPlaybackException If an error occurs (re-)initializing the decoder.
|
||||||
*/
|
*/
|
||||||
@CallSuper
|
@CallSuper
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
protected void onInputFormatChanged(Format newFormat) throws ExoPlaybackException {
|
protected void onInputFormatChanged(Format newFormat) throws ExoPlaybackException {
|
||||||
Format oldFormat = format;
|
Format oldFormat = format;
|
||||||
format = newFormat;
|
format = newFormat;
|
||||||
|
|
@ -502,12 +503,16 @@ public class LibvpxVideoRenderer extends BaseRenderer {
|
||||||
throw ExoPlaybackException.createForRenderer(
|
throw ExoPlaybackException.createForRenderer(
|
||||||
new IllegalStateException("Media requires a DrmSessionManager"), getIndex());
|
new IllegalStateException("Media requires a DrmSessionManager"), getIndex());
|
||||||
}
|
}
|
||||||
DrmSession<ExoMediaCrypto> session =
|
if (formatHolder.decryptionResourceIsProvided) {
|
||||||
drmSessionManager.acquireSession(Looper.myLooper(), newFormat.drmInitData);
|
setSourceDrmSession((DrmSession<ExoMediaCrypto>) formatHolder.drmSession);
|
||||||
if (sourceDrmSession != null) {
|
} else {
|
||||||
sourceDrmSession.releaseReference();
|
DrmSession<ExoMediaCrypto> session =
|
||||||
|
drmSessionManager.acquireSession(Looper.myLooper(), newFormat.drmInitData);
|
||||||
|
if (sourceDrmSession != null) {
|
||||||
|
sourceDrmSession.releaseReference();
|
||||||
|
}
|
||||||
|
sourceDrmSession = session;
|
||||||
}
|
}
|
||||||
sourceDrmSession = session;
|
|
||||||
} else {
|
} else {
|
||||||
setSourceDrmSession(null);
|
setSourceDrmSession(null);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -655,6 +655,7 @@ public abstract class SimpleDecoderAudioRenderer extends BaseRenderer implements
|
||||||
decoderDrmSession = session;
|
decoderDrmSession = session;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
private void onInputFormatChanged(Format newFormat) throws ExoPlaybackException {
|
private void onInputFormatChanged(Format newFormat) throws ExoPlaybackException {
|
||||||
Format oldFormat = inputFormat;
|
Format oldFormat = inputFormat;
|
||||||
inputFormat = newFormat;
|
inputFormat = newFormat;
|
||||||
|
|
@ -667,12 +668,16 @@ public abstract class SimpleDecoderAudioRenderer extends BaseRenderer implements
|
||||||
throw ExoPlaybackException.createForRenderer(
|
throw ExoPlaybackException.createForRenderer(
|
||||||
new IllegalStateException("Media requires a DrmSessionManager"), getIndex());
|
new IllegalStateException("Media requires a DrmSessionManager"), getIndex());
|
||||||
}
|
}
|
||||||
DrmSession<ExoMediaCrypto> session =
|
if (formatHolder.decryptionResourceIsProvided) {
|
||||||
drmSessionManager.acquireSession(Looper.myLooper(), newFormat.drmInitData);
|
setSourceDrmSession((DrmSession<ExoMediaCrypto>) formatHolder.drmSession);
|
||||||
if (sourceDrmSession != null) {
|
} else {
|
||||||
sourceDrmSession.releaseReference();
|
DrmSession<ExoMediaCrypto> session =
|
||||||
|
drmSessionManager.acquireSession(Looper.myLooper(), newFormat.drmInitData);
|
||||||
|
if (sourceDrmSession != null) {
|
||||||
|
sourceDrmSession.releaseReference();
|
||||||
|
}
|
||||||
|
sourceDrmSession = session;
|
||||||
}
|
}
|
||||||
sourceDrmSession = session;
|
|
||||||
} else {
|
} else {
|
||||||
setSourceDrmSession(null);
|
setSourceDrmSession(null);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1135,6 +1135,7 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
||||||
* @param formatHolder A {@link FormatHolder} that holds the new {@link Format}.
|
* @param formatHolder A {@link FormatHolder} that holds the new {@link Format}.
|
||||||
* @throws ExoPlaybackException If an error occurs re-initializing the {@link MediaCodec}.
|
* @throws ExoPlaybackException If an error occurs re-initializing the {@link MediaCodec}.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
protected void onInputFormatChanged(FormatHolder formatHolder) throws ExoPlaybackException {
|
protected void onInputFormatChanged(FormatHolder formatHolder) throws ExoPlaybackException {
|
||||||
Format oldFormat = inputFormat;
|
Format oldFormat = inputFormat;
|
||||||
Format newFormat = formatHolder.format;
|
Format newFormat = formatHolder.format;
|
||||||
|
|
@ -1149,12 +1150,16 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
||||||
throw ExoPlaybackException.createForRenderer(
|
throw ExoPlaybackException.createForRenderer(
|
||||||
new IllegalStateException("Media requires a DrmSessionManager"), getIndex());
|
new IllegalStateException("Media requires a DrmSessionManager"), getIndex());
|
||||||
}
|
}
|
||||||
DrmSession<FrameworkMediaCrypto> session =
|
if (formatHolder.decryptionResourceIsProvided) {
|
||||||
drmSessionManager.acquireSession(Looper.myLooper(), newFormat.drmInitData);
|
setSourceDrmSession((DrmSession<FrameworkMediaCrypto>) formatHolder.drmSession);
|
||||||
if (sourceDrmSession != null) {
|
} else {
|
||||||
sourceDrmSession.releaseReference();
|
DrmSession<FrameworkMediaCrypto> session =
|
||||||
|
drmSessionManager.acquireSession(Looper.myLooper(), newFormat.drmInitData);
|
||||||
|
if (sourceDrmSession != null) {
|
||||||
|
sourceDrmSession.releaseReference();
|
||||||
|
}
|
||||||
|
sourceDrmSession = session;
|
||||||
}
|
}
|
||||||
sourceDrmSession = session;
|
|
||||||
} else {
|
} else {
|
||||||
setSourceDrmSession(null);
|
setSourceDrmSession(null);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue