Prepare and release DrmSessionManager in Renderers
Issue: #6951 PiperOrigin-RevId: 294187695
This commit is contained in:
parent
7c85ca08cf
commit
ac8a2e80e1
@ -41,8 +41,8 @@
|
|||||||
* Upgrade Truth dependency from 0.44 to 1.0.
|
* Upgrade Truth dependency from 0.44 to 1.0.
|
||||||
* Upgrade to JUnit 4.13-rc-2.
|
* Upgrade to JUnit 4.13-rc-2.
|
||||||
* UI
|
* UI
|
||||||
* move logic of prev, next, fast forward and rewind to ControlDispatcher
|
* Move logic of prev, next, fast forward and rewind to ControlDispatcher
|
||||||
[#6926](https://github.com/google/ExoPlayer/issues/6926)).
|
([#6926](https://github.com/google/ExoPlayer/issues/6926)).
|
||||||
* Demo apps: Add
|
* Demo apps: Add
|
||||||
[GL demo app](https://github.com/google/ExoPlayer/tree/dev-v2/demos/gl) to
|
[GL demo app](https://github.com/google/ExoPlayer/tree/dev-v2/demos/gl) to
|
||||||
show how to render video to a `GLSurfaceView` while applying a GL shader.
|
show how to render video to a `GLSurfaceView` while applying a GL shader.
|
||||||
@ -101,6 +101,8 @@
|
|||||||
on earlier releases, but only when embedded in a non-FLAC container such as
|
on earlier releases, but only when embedded in a non-FLAC container such as
|
||||||
Matroska or MP4.
|
Matroska or MP4.
|
||||||
* Add support for ID3 genres added in Wimamp 5.6 (2010).
|
* Add support for ID3 genres added in Wimamp 5.6 (2010).
|
||||||
|
* DRM: Fix `NullPointerException` when playing DRM-protected content
|
||||||
|
([#6951](https://github.com/google/ExoPlayer/issues/6951)).
|
||||||
|
|
||||||
### 2.11.1 (2019-12-20) ###
|
### 2.11.1 (2019-12-20) ###
|
||||||
|
|
||||||
|
@ -3,9 +3,8 @@
|
|||||||
"name": "YouTube DASH",
|
"name": "YouTube DASH",
|
||||||
"samples": [
|
"samples": [
|
||||||
{
|
{
|
||||||
"name": "Google Glass (MP4,H264)",
|
"name": "6956",
|
||||||
"uri": "https://www.youtube.com/api/manifest/dash/id/bf5bb2419360daf1/source/youtube?as=fmp4_audio_clear,fmp4_sd_hd_clear&sparams=ip,ipbits,expire,source,id,as&ip=0.0.0.0&ipbits=0&expire=19000000000&signature=51AF5F39AB0CEC3E5497CD9C900EBFEAECCCB5C7.8506521BFC350652163895D4C26DEE124209AA9E&key=ik0",
|
"uri": "http://master255.org/res/%d0%9a%d0%bb%d0%b8%d0%bf%d1%8b/B/Billy%20Mack/Billy%20Mack%20-%20Christmas%20Is%20All%20Around.mpg"
|
||||||
"extension": "mpd"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Google Play (MP4,H264)",
|
"name": "Google Play (MP4,H264)",
|
||||||
|
@ -97,6 +97,7 @@ public abstract class SimpleDecoderAudioRenderer extends BaseRenderer implements
|
|||||||
private final AudioSink audioSink;
|
private final AudioSink audioSink;
|
||||||
private final DecoderInputBuffer flagsOnlyBuffer;
|
private final DecoderInputBuffer flagsOnlyBuffer;
|
||||||
|
|
||||||
|
private boolean drmResourcesAcquired;
|
||||||
private DecoderCounters decoderCounters;
|
private DecoderCounters decoderCounters;
|
||||||
private Format inputFormat;
|
private Format inputFormat;
|
||||||
private int encoderDelay;
|
private int encoderDelay;
|
||||||
@ -543,6 +544,10 @@ public abstract class SimpleDecoderAudioRenderer extends BaseRenderer implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEnabled(boolean joining) throws ExoPlaybackException {
|
protected void onEnabled(boolean joining) throws ExoPlaybackException {
|
||||||
|
if (drmSessionManager != null && !drmResourcesAcquired) {
|
||||||
|
drmResourcesAcquired = true;
|
||||||
|
drmSessionManager.prepare();
|
||||||
|
}
|
||||||
decoderCounters = new DecoderCounters();
|
decoderCounters = new DecoderCounters();
|
||||||
eventDispatcher.enabled(decoderCounters);
|
eventDispatcher.enabled(decoderCounters);
|
||||||
int tunnelingAudioSessionId = getConfiguration().tunnelingAudioSessionId;
|
int tunnelingAudioSessionId = getConfiguration().tunnelingAudioSessionId;
|
||||||
@ -591,6 +596,14 @@ public abstract class SimpleDecoderAudioRenderer extends BaseRenderer implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onReset() {
|
||||||
|
if (drmSessionManager != null && drmResourcesAcquired) {
|
||||||
|
drmResourcesAcquired = false;
|
||||||
|
drmSessionManager.release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(int messageType, @Nullable Object message) throws ExoPlaybackException {
|
public void handleMessage(int messageType, @Nullable Object message) throws ExoPlaybackException {
|
||||||
switch (messageType) {
|
switch (messageType) {
|
||||||
|
@ -371,6 +371,7 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
|||||||
private final ArrayList<Long> decodeOnlyPresentationTimestamps;
|
private final ArrayList<Long> decodeOnlyPresentationTimestamps;
|
||||||
private final MediaCodec.BufferInfo outputBufferInfo;
|
private final MediaCodec.BufferInfo outputBufferInfo;
|
||||||
|
|
||||||
|
private boolean drmResourcesAcquired;
|
||||||
@Nullable private Format inputFormat;
|
@Nullable private Format inputFormat;
|
||||||
private Format outputFormat;
|
private Format outputFormat;
|
||||||
@Nullable private DrmSession<FrameworkMediaCrypto> codecDrmSession;
|
@Nullable private DrmSession<FrameworkMediaCrypto> codecDrmSession;
|
||||||
@ -659,6 +660,10 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEnabled(boolean joining) throws ExoPlaybackException {
|
protected void onEnabled(boolean joining) throws ExoPlaybackException {
|
||||||
|
if (drmSessionManager != null && !drmResourcesAcquired) {
|
||||||
|
drmResourcesAcquired = true;
|
||||||
|
drmSessionManager.prepare();
|
||||||
|
}
|
||||||
decoderCounters = new DecoderCounters();
|
decoderCounters = new DecoderCounters();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -705,6 +710,10 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
|||||||
} finally {
|
} finally {
|
||||||
setSourceDrmSession(null);
|
setSourceDrmSession(null);
|
||||||
}
|
}
|
||||||
|
if (drmSessionManager != null && drmResourcesAcquired) {
|
||||||
|
drmResourcesAcquired = false;
|
||||||
|
drmSessionManager.release();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void releaseCodec() {
|
protected void releaseCodec() {
|
||||||
|
@ -77,6 +77,7 @@ public abstract class SimpleDecoderVideoRenderer extends BaseRenderer {
|
|||||||
private final DecoderInputBuffer flagsOnlyBuffer;
|
private final DecoderInputBuffer flagsOnlyBuffer;
|
||||||
private final DrmSessionManager<ExoMediaCrypto> drmSessionManager;
|
private final DrmSessionManager<ExoMediaCrypto> drmSessionManager;
|
||||||
|
|
||||||
|
private boolean drmResourcesAcquired;
|
||||||
private Format inputFormat;
|
private Format inputFormat;
|
||||||
private Format outputFormat;
|
private Format outputFormat;
|
||||||
private SimpleDecoder<
|
private SimpleDecoder<
|
||||||
@ -237,6 +238,10 @@ public abstract class SimpleDecoderVideoRenderer extends BaseRenderer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEnabled(boolean joining) throws ExoPlaybackException {
|
protected void onEnabled(boolean joining) throws ExoPlaybackException {
|
||||||
|
if (drmSessionManager != null && !drmResourcesAcquired) {
|
||||||
|
drmResourcesAcquired = true;
|
||||||
|
drmSessionManager.prepare();
|
||||||
|
}
|
||||||
decoderCounters = new DecoderCounters();
|
decoderCounters = new DecoderCounters();
|
||||||
eventDispatcher.enabled(decoderCounters);
|
eventDispatcher.enabled(decoderCounters);
|
||||||
}
|
}
|
||||||
@ -286,6 +291,14 @@ public abstract class SimpleDecoderVideoRenderer extends BaseRenderer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onReset() {
|
||||||
|
if (drmSessionManager != null && drmResourcesAcquired) {
|
||||||
|
drmResourcesAcquired = false;
|
||||||
|
drmSessionManager.release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStreamChanged(Format[] formats, long offsetUs) throws ExoPlaybackException {
|
protected void onStreamChanged(Format[] formats, long offsetUs) throws ExoPlaybackException {
|
||||||
outputStreamOffsetUs = offsetUs;
|
outputStreamOffsetUs = offsetUs;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user