Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
aa9eb5ab
authored
Mar 19, 2020
by
aquilescanta
Committed by
Oliver Woodman
Mar 20, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Remove generics from DRM components
PiperOrigin-RevId: 301798563
parent
077e7932
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
39 changed files
with
259 additions
and
276 deletions
RELEASENOTES.md
demos/gl/src/main/java/com/google/android/exoplayer2/gldemo/MainActivity.java
demos/surface/src/main/java/com/google/android/exoplayer2/surfacedemo/MainActivity.java
library/core/src/main/java/com/google/android/exoplayer2/FormatHolder.java
library/core/src/main/java/com/google/android/exoplayer2/audio/DecoderAudioRenderer.java
library/core/src/main/java/com/google/android/exoplayer2/audio/MediaCodecAudioRenderer.java
library/core/src/main/java/com/google/android/exoplayer2/drm/DefaultDrmSession.java
library/core/src/main/java/com/google/android/exoplayer2/drm/DefaultDrmSessionManager.java
library/core/src/main/java/com/google/android/exoplayer2/drm/DrmSession.java
library/core/src/main/java/com/google/android/exoplayer2/drm/DrmSessionManager.java
library/core/src/main/java/com/google/android/exoplayer2/drm/DummyExoMediaDrm.java
library/core/src/main/java/com/google/android/exoplayer2/drm/ErrorStateDrmSession.java
library/core/src/main/java/com/google/android/exoplayer2/drm/ExoMediaDrm.java
library/core/src/main/java/com/google/android/exoplayer2/drm/FrameworkMediaDrm.java
library/core/src/main/java/com/google/android/exoplayer2/drm/OfflineLicenseHelper.java
library/core/src/main/java/com/google/android/exoplayer2/drm/WidevineUtil.java
library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java
library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadHelper.java
library/core/src/main/java/com/google/android/exoplayer2/source/DefaultMediaSourceFactory.java
library/core/src/main/java/com/google/android/exoplayer2/source/ExtractorMediaSource.java
library/core/src/main/java/com/google/android/exoplayer2/source/MediaSourceFactory.java
library/core/src/main/java/com/google/android/exoplayer2/source/ProgressiveMediaPeriod.java
library/core/src/main/java/com/google/android/exoplayer2/source/ProgressiveMediaSource.java
library/core/src/main/java/com/google/android/exoplayer2/source/SampleQueue.java
library/core/src/main/java/com/google/android/exoplayer2/source/chunk/ChunkSampleStream.java
library/core/src/main/java/com/google/android/exoplayer2/video/DecoderVideoRenderer.java
library/core/src/main/java/com/google/android/exoplayer2/video/MediaCodecVideoRenderer.java
library/core/src/test/java/com/google/android/exoplayer2/drm/OfflineLicenseHelperTest.java
library/core/src/test/java/com/google/android/exoplayer2/source/SampleQueueTest.java
library/dash/src/main/java/com/google/android/exoplayer2/source/dash/DashMediaPeriod.java
library/dash/src/main/java/com/google/android/exoplayer2/source/dash/DashMediaSource.java
library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsMediaPeriod.java
library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsMediaSource.java
library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsSampleStreamWrapper.java
library/smoothstreaming/src/main/java/com/google/android/exoplayer2/source/smoothstreaming/SsMediaPeriod.java
library/smoothstreaming/src/main/java/com/google/android/exoplayer2/source/smoothstreaming/SsMediaSource.java
playbacktests/src/androidTest/java/com/google/android/exoplayer2/playbacktests/gts/DashTestRunner.java
playbacktests/src/androidTest/java/com/google/android/exoplayer2/playbacktests/gts/DashWidevineOfflineTest.java
testutils/src/main/java/com/google/android/exoplayer2/testutil/ExoHostedTest.java
RELEASENOTES.md
View file @
aa9eb5ab
...
@@ -83,6 +83,7 @@
...
@@ -83,6 +83,7 @@
*
Add option to inject a custom
`DefaultDrmSessionManager`
into
*
Add option to inject a custom
`DefaultDrmSessionManager`
into
`OfflineLicenseHelper`
`OfflineLicenseHelper`
(
[
#7078
](
https://github.com/google/ExoPlayer/issues/7078
)
).
(
[
#7078
](
https://github.com/google/ExoPlayer/issues/7078
)
).
*
Remove generics from DRM components.
*
Downloads: Merge downloads in
`SegmentDownloader`
to improve overall
*
Downloads: Merge downloads in
`SegmentDownloader`
to improve overall
download speed (
[
#5978
](
https://github.com/google/ExoPlayer/issues/5978
)
).
download speed (
[
#5978
](
https://github.com/google/ExoPlayer/issues/5978
)
).
*
DASH:
*
DASH:
...
...
demos/gl/src/main/java/com/google/android/exoplayer2/gldemo/MainActivity.java
View file @
aa9eb5ab
...
@@ -28,7 +28,6 @@ import com.google.android.exoplayer2.Player;
...
@@ -28,7 +28,6 @@ import com.google.android.exoplayer2.Player;
import
com.google.android.exoplayer2.SimpleExoPlayer
;
import
com.google.android.exoplayer2.SimpleExoPlayer
;
import
com.google.android.exoplayer2.drm.DefaultDrmSessionManager
;
import
com.google.android.exoplayer2.drm.DefaultDrmSessionManager
;
import
com.google.android.exoplayer2.drm.DrmSessionManager
;
import
com.google.android.exoplayer2.drm.DrmSessionManager
;
import
com.google.android.exoplayer2.drm.ExoMediaCrypto
;
import
com.google.android.exoplayer2.drm.FrameworkMediaDrm
;
import
com.google.android.exoplayer2.drm.FrameworkMediaDrm
;
import
com.google.android.exoplayer2.drm.HttpMediaDrmCallback
;
import
com.google.android.exoplayer2.drm.HttpMediaDrmCallback
;
import
com.google.android.exoplayer2.source.MediaSource
;
import
com.google.android.exoplayer2.source.MediaSource
;
...
@@ -140,7 +139,7 @@ public final class MainActivity extends Activity {
...
@@ -140,7 +139,7 @@ public final class MainActivity extends Activity {
?
Assertions
.
checkNotNull
(
intent
.
getData
())
?
Assertions
.
checkNotNull
(
intent
.
getData
())
:
Uri
.
parse
(
DEFAULT_MEDIA_URI
);
:
Uri
.
parse
(
DEFAULT_MEDIA_URI
);
String
userAgent
=
Util
.
getUserAgent
(
this
,
getString
(
R
.
string
.
application_name
));
String
userAgent
=
Util
.
getUserAgent
(
this
,
getString
(
R
.
string
.
application_name
));
DrmSessionManager
<
ExoMediaCrypto
>
drmSessionManager
;
DrmSessionManager
drmSessionManager
;
if
(
Util
.
SDK_INT
>=
18
&&
intent
.
hasExtra
(
DRM_SCHEME_EXTRA
))
{
if
(
Util
.
SDK_INT
>=
18
&&
intent
.
hasExtra
(
DRM_SCHEME_EXTRA
))
{
String
drmScheme
=
Assertions
.
checkNotNull
(
intent
.
getStringExtra
(
DRM_SCHEME_EXTRA
));
String
drmScheme
=
Assertions
.
checkNotNull
(
intent
.
getStringExtra
(
DRM_SCHEME_EXTRA
));
String
drmLicenseUrl
=
Assertions
.
checkNotNull
(
intent
.
getStringExtra
(
DRM_LICENSE_URL_EXTRA
));
String
drmLicenseUrl
=
Assertions
.
checkNotNull
(
intent
.
getStringExtra
(
DRM_LICENSE_URL_EXTRA
));
...
...
demos/surface/src/main/java/com/google/android/exoplayer2/surfacedemo/MainActivity.java
View file @
aa9eb5ab
...
@@ -32,7 +32,6 @@ import com.google.android.exoplayer2.Player;
...
@@ -32,7 +32,6 @@ import com.google.android.exoplayer2.Player;
import
com.google.android.exoplayer2.SimpleExoPlayer
;
import
com.google.android.exoplayer2.SimpleExoPlayer
;
import
com.google.android.exoplayer2.drm.DefaultDrmSessionManager
;
import
com.google.android.exoplayer2.drm.DefaultDrmSessionManager
;
import
com.google.android.exoplayer2.drm.DrmSessionManager
;
import
com.google.android.exoplayer2.drm.DrmSessionManager
;
import
com.google.android.exoplayer2.drm.ExoMediaCrypto
;
import
com.google.android.exoplayer2.drm.FrameworkMediaDrm
;
import
com.google.android.exoplayer2.drm.FrameworkMediaDrm
;
import
com.google.android.exoplayer2.drm.HttpMediaDrmCallback
;
import
com.google.android.exoplayer2.drm.HttpMediaDrmCallback
;
import
com.google.android.exoplayer2.source.MediaSource
;
import
com.google.android.exoplayer2.source.MediaSource
;
...
@@ -185,7 +184,7 @@ public final class MainActivity extends Activity {
...
@@ -185,7 +184,7 @@ public final class MainActivity extends Activity {
?
Assertions
.
checkNotNull
(
intent
.
getData
())
?
Assertions
.
checkNotNull
(
intent
.
getData
())
:
Uri
.
parse
(
DEFAULT_MEDIA_URI
);
:
Uri
.
parse
(
DEFAULT_MEDIA_URI
);
String
userAgent
=
Util
.
getUserAgent
(
this
,
getString
(
R
.
string
.
application_name
));
String
userAgent
=
Util
.
getUserAgent
(
this
,
getString
(
R
.
string
.
application_name
));
DrmSessionManager
<
ExoMediaCrypto
>
drmSessionManager
;
DrmSessionManager
drmSessionManager
;
if
(
intent
.
hasExtra
(
DRM_SCHEME_EXTRA
))
{
if
(
intent
.
hasExtra
(
DRM_SCHEME_EXTRA
))
{
String
drmScheme
=
Assertions
.
checkNotNull
(
intent
.
getStringExtra
(
DRM_SCHEME_EXTRA
));
String
drmScheme
=
Assertions
.
checkNotNull
(
intent
.
getStringExtra
(
DRM_SCHEME_EXTRA
));
String
drmLicenseUrl
=
Assertions
.
checkNotNull
(
intent
.
getStringExtra
(
DRM_LICENSE_URL_EXTRA
));
String
drmLicenseUrl
=
Assertions
.
checkNotNull
(
intent
.
getStringExtra
(
DRM_LICENSE_URL_EXTRA
));
...
...
library/core/src/main/java/com/google/android/exoplayer2/FormatHolder.java
View file @
aa9eb5ab
...
@@ -24,7 +24,7 @@ import com.google.android.exoplayer2.drm.DrmSession;
...
@@ -24,7 +24,7 @@ import com.google.android.exoplayer2.drm.DrmSession;
public
final
class
FormatHolder
{
public
final
class
FormatHolder
{
/** An accompanying context for decrypting samples in the format. */
/** An accompanying context for decrypting samples in the format. */
@Nullable
public
DrmSession
<?>
drmSession
;
@Nullable
public
DrmSession
drmSession
;
/** The held {@link Format}. */
/** The held {@link Format}. */
@Nullable
public
Format
format
;
@Nullable
public
Format
format
;
...
...
library/core/src/main/java/com/google/android/exoplayer2/audio/DecoderAudioRenderer.java
View file @
aa9eb5ab
...
@@ -111,8 +111,8 @@ public abstract class DecoderAudioRenderer extends BaseRenderer implements Media
...
@@ -111,8 +111,8 @@ public abstract class DecoderAudioRenderer extends BaseRenderer implements Media
@Nullable
private
DecoderInputBuffer
inputBuffer
;
@Nullable
private
DecoderInputBuffer
inputBuffer
;
@Nullable
private
SimpleOutputBuffer
outputBuffer
;
@Nullable
private
SimpleOutputBuffer
outputBuffer
;
@Nullable
private
DrmSession
<
ExoMediaCrypto
>
decoderDrmSession
;
@Nullable
private
DrmSession
decoderDrmSession
;
@Nullable
private
DrmSession
<
ExoMediaCrypto
>
sourceDrmSession
;
@Nullable
private
DrmSession
sourceDrmSession
;
@ReinitializationState
private
int
decoderReinitializationState
;
@ReinitializationState
private
int
decoderReinitializationState
;
private
boolean
decoderReceivedBuffers
;
private
boolean
decoderReceivedBuffers
;
...
@@ -627,12 +627,12 @@ public abstract class DecoderAudioRenderer extends BaseRenderer implements Media
...
@@ -627,12 +627,12 @@ public abstract class DecoderAudioRenderer extends BaseRenderer implements Media
setDecoderDrmSession
(
null
);
setDecoderDrmSession
(
null
);
}
}
private
void
setSourceDrmSession
(
@Nullable
DrmSession
<
ExoMediaCrypto
>
session
)
{
private
void
setSourceDrmSession
(
@Nullable
DrmSession
session
)
{
DrmSession
.
replaceSession
(
sourceDrmSession
,
session
);
DrmSession
.
replaceSession
(
sourceDrmSession
,
session
);
sourceDrmSession
=
session
;
sourceDrmSession
=
session
;
}
}
private
void
setDecoderDrmSession
(
@Nullable
DrmSession
<
ExoMediaCrypto
>
session
)
{
private
void
setDecoderDrmSession
(
@Nullable
DrmSession
session
)
{
DrmSession
.
replaceSession
(
decoderDrmSession
,
session
);
DrmSession
.
replaceSession
(
decoderDrmSession
,
session
);
decoderDrmSession
=
session
;
decoderDrmSession
=
session
;
}
}
...
@@ -640,7 +640,7 @@ public abstract class DecoderAudioRenderer extends BaseRenderer implements Media
...
@@ -640,7 +640,7 @@ public abstract class DecoderAudioRenderer extends BaseRenderer implements Media
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
private
void
onInputFormatChanged
(
FormatHolder
formatHolder
)
throws
ExoPlaybackException
{
private
void
onInputFormatChanged
(
FormatHolder
formatHolder
)
throws
ExoPlaybackException
{
Format
newFormat
=
Assertions
.
checkNotNull
(
formatHolder
.
format
);
Format
newFormat
=
Assertions
.
checkNotNull
(
formatHolder
.
format
);
setSourceDrmSession
(
(
DrmSession
<
ExoMediaCrypto
>)
formatHolder
.
drmSession
);
setSourceDrmSession
(
formatHolder
.
drmSession
);
Format
oldFormat
=
inputFormat
;
Format
oldFormat
=
inputFormat
;
inputFormat
=
newFormat
;
inputFormat
=
newFormat
;
...
...
library/core/src/main/java/com/google/android/exoplayer2/audio/MediaCodecAudioRenderer.java
View file @
aa9eb5ab
...
@@ -32,7 +32,6 @@ import com.google.android.exoplayer2.PlayerMessage.Target;
...
@@ -32,7 +32,6 @@ import com.google.android.exoplayer2.PlayerMessage.Target;
import
com.google.android.exoplayer2.RendererCapabilities
;
import
com.google.android.exoplayer2.RendererCapabilities
;
import
com.google.android.exoplayer2.audio.AudioRendererEventListener.EventDispatcher
;
import
com.google.android.exoplayer2.audio.AudioRendererEventListener.EventDispatcher
;
import
com.google.android.exoplayer2.decoder.DecoderInputBuffer
;
import
com.google.android.exoplayer2.decoder.DecoderInputBuffer
;
import
com.google.android.exoplayer2.drm.FrameworkMediaCrypto
;
import
com.google.android.exoplayer2.mediacodec.MediaCodecInfo
;
import
com.google.android.exoplayer2.mediacodec.MediaCodecInfo
;
import
com.google.android.exoplayer2.mediacodec.MediaCodecRenderer
;
import
com.google.android.exoplayer2.mediacodec.MediaCodecRenderer
;
import
com.google.android.exoplayer2.mediacodec.MediaCodecSelector
;
import
com.google.android.exoplayer2.mediacodec.MediaCodecSelector
;
...
@@ -214,8 +213,7 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
...
@@ -214,8 +213,7 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
}
}
@TunnelingSupport
@TunnelingSupport
int
tunnelingSupport
=
Util
.
SDK_INT
>=
21
?
TUNNELING_SUPPORTED
:
TUNNELING_NOT_SUPPORTED
;
int
tunnelingSupport
=
Util
.
SDK_INT
>=
21
?
TUNNELING_SUPPORTED
:
TUNNELING_NOT_SUPPORTED
;
boolean
supportsFormatDrm
=
boolean
supportsFormatDrm
=
supportsFormatDrm
(
format
);
format
.
drmInitData
==
null
||
FrameworkMediaCrypto
.
class
.
equals
(
format
.
exoMediaCryptoType
);
if
(
supportsFormatDrm
if
(
supportsFormatDrm
&&
allowPassthrough
(
format
.
channelCount
,
mimeType
)
&&
allowPassthrough
(
format
.
channelCount
,
mimeType
)
&&
mediaCodecSelector
.
getPassthroughDecoderInfo
()
!=
null
)
{
&&
mediaCodecSelector
.
getPassthroughDecoderInfo
()
!=
null
)
{
...
...
library/core/src/main/java/com/google/android/exoplayer2/drm/DefaultDrmSession.java
View file @
aa9eb5ab
...
@@ -48,7 +48,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
...
@@ -48,7 +48,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
/** A {@link DrmSession} that supports playbacks using {@link ExoMediaDrm}. */
/** A {@link DrmSession} that supports playbacks using {@link ExoMediaDrm}. */
@RequiresApi
(
18
)
@RequiresApi
(
18
)
/* package */
class
DefaultDrmSession
<
T
extends
ExoMediaCrypto
>
implements
DrmSession
<
T
>
{
/* package */
class
DefaultDrmSession
implements
DrmSession
{
/** Thrown when an unexpected exception or error is thrown during provisioning or key requests. */
/** Thrown when an unexpected exception or error is thrown during provisioning or key requests. */
public
static
final
class
UnexpectedDrmSessionException
extends
IOException
{
public
static
final
class
UnexpectedDrmSessionException
extends
IOException
{
...
@@ -59,7 +59,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
...
@@ -59,7 +59,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
}
}
/** Manages provisioning requests. */
/** Manages provisioning requests. */
public
interface
ProvisioningManager
<
T
extends
ExoMediaCrypto
>
{
public
interface
ProvisioningManager
{
/**
/**
* Called when a session requires provisioning. The manager <em>may</em> call {@link
* Called when a session requires provisioning. The manager <em>may</em> call {@link
...
@@ -69,7 +69,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
...
@@ -69,7 +69,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
*
*
* @param session The session.
* @param session The session.
*/
*/
void
provisionRequired
(
DefaultDrmSession
<
T
>
session
);
void
provisionRequired
(
DefaultDrmSession
session
);
/**
/**
* Called by a session when it fails to perform a provisioning operation.
* Called by a session when it fails to perform a provisioning operation.
...
@@ -83,14 +83,14 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
...
@@ -83,14 +83,14 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
}
}
/** Callback to be notified when the session is released. */
/** Callback to be notified when the session is released. */
public
interface
ReleaseCallback
<
T
extends
ExoMediaCrypto
>
{
public
interface
ReleaseCallback
{
/**
/**
* Called immediately after releasing session resources.
* Called immediately after releasing session resources.
*
*
* @param session The session.
* @param session The session.
*/
*/
void
onSessionReleased
(
DefaultDrmSession
<
T
>
session
);
void
onSessionReleased
(
DefaultDrmSession
session
);
}
}
private
static
final
String
TAG
=
"DefaultDrmSession"
;
private
static
final
String
TAG
=
"DefaultDrmSession"
;
...
@@ -102,9 +102,9 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
...
@@ -102,9 +102,9 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
/** The DRM scheme datas, or null if this session uses offline keys. */
/** The DRM scheme datas, or null if this session uses offline keys. */
@Nullable
public
final
List
<
SchemeData
>
schemeDatas
;
@Nullable
public
final
List
<
SchemeData
>
schemeDatas
;
private
final
ExoMediaDrm
<
T
>
mediaDrm
;
private
final
ExoMediaDrm
mediaDrm
;
private
final
ProvisioningManager
<
T
>
provisioningManager
;
private
final
ProvisioningManager
provisioningManager
;
private
final
ReleaseCallback
<
T
>
releaseCallback
;
private
final
ReleaseCallback
releaseCallback
;
private
final
@DefaultDrmSessionManager
.
Mode
int
mode
;
private
final
@DefaultDrmSessionManager
.
Mode
int
mode
;
private
final
boolean
playClearSamplesWithoutKeys
;
private
final
boolean
playClearSamplesWithoutKeys
;
private
final
boolean
isPlaceholderSession
;
private
final
boolean
isPlaceholderSession
;
...
@@ -120,7 +120,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
...
@@ -120,7 +120,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
private
int
referenceCount
;
private
int
referenceCount
;
@Nullable
private
HandlerThread
requestHandlerThread
;
@Nullable
private
HandlerThread
requestHandlerThread
;
@Nullable
private
RequestHandler
requestHandler
;
@Nullable
private
RequestHandler
requestHandler
;
@Nullable
private
T
mediaCrypto
;
@Nullable
private
ExoMediaCrypto
mediaCrypto
;
@Nullable
private
DrmSessionException
lastException
;
@Nullable
private
DrmSessionException
lastException
;
@Nullable
private
byte
[]
sessionId
;
@Nullable
private
byte
[]
sessionId
;
private
byte
@MonotonicNonNull
[]
offlineLicenseKeySetId
;
private
byte
@MonotonicNonNull
[]
offlineLicenseKeySetId
;
...
@@ -150,9 +150,9 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
...
@@ -150,9 +150,9 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
*/
*/
public
DefaultDrmSession
(
public
DefaultDrmSession
(
UUID
uuid
,
UUID
uuid
,
ExoMediaDrm
<
T
>
mediaDrm
,
ExoMediaDrm
mediaDrm
,
ProvisioningManager
<
T
>
provisioningManager
,
ProvisioningManager
provisioningManager
,
ReleaseCallback
<
T
>
releaseCallback
,
ReleaseCallback
releaseCallback
,
@Nullable
List
<
SchemeData
>
schemeDatas
,
@Nullable
List
<
SchemeData
>
schemeDatas
,
@DefaultDrmSessionManager
.
Mode
int
mode
,
@DefaultDrmSessionManager
.
Mode
int
mode
,
boolean
playClearSamplesWithoutKeys
,
boolean
playClearSamplesWithoutKeys
,
...
@@ -242,7 +242,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
...
@@ -242,7 +242,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
}
}
@Override
@Override
public
final
@Nullable
T
getMediaCrypto
()
{
public
final
@Nullable
ExoMediaCrypto
getMediaCrypto
()
{
return
mediaCrypto
;
return
mediaCrypto
;
}
}
...
...
library/core/src/main/java/com/google/android/exoplayer2/drm/DefaultDrmSessionManager.java
View file @
aa9eb5ab
This diff is collapsed.
Click to expand it.
library/core/src/main/java/com/google/android/exoplayer2/drm/DrmSession.java
View file @
aa9eb5ab
...
@@ -25,10 +25,8 @@ import java.lang.annotation.Retention;
...
@@ -25,10 +25,8 @@ import java.lang.annotation.Retention;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.RetentionPolicy
;
import
java.util.Map
;
import
java.util.Map
;
/**
/** A DRM session. */
* A DRM session.
public
interface
DrmSession
{
*/
public
interface
DrmSession
<
T
extends
ExoMediaCrypto
>
{
/**
/**
* Acquires {@code newSession} then releases {@code previousSession}.
* Acquires {@code newSession} then releases {@code previousSession}.
...
@@ -38,8 +36,8 @@ public interface DrmSession<T extends ExoMediaCrypto> {
...
@@ -38,8 +36,8 @@ public interface DrmSession<T extends ExoMediaCrypto> {
* eventDispatcher = null}). Null arguments are ignored. Does nothing if {@code previousSession}
* eventDispatcher = null}). Null arguments are ignored. Does nothing if {@code previousSession}
* and {@code newSession} are the same session.
* and {@code newSession} are the same session.
*/
*/
static
<
T
extends
ExoMediaCrypto
>
void
replaceSession
(
static
void
replaceSession
(
@Nullable
DrmSession
<
T
>
previousSession
,
@Nullable
DrmSession
<
T
>
newSession
)
{
@Nullable
DrmSession
previousSession
,
@Nullable
DrmSession
newSession
)
{
if
(
previousSession
==
newSession
)
{
if
(
previousSession
==
newSession
)
{
// Do nothing.
// Do nothing.
return
;
return
;
...
@@ -106,11 +104,11 @@ public interface DrmSession<T extends ExoMediaCrypto> {
...
@@ -106,11 +104,11 @@ public interface DrmSession<T extends ExoMediaCrypto> {
DrmSessionException
getError
();
DrmSessionException
getError
();
/**
/**
* Returns a
{@link ExoMediaCrypto} for the open session, or null if called before the session has
* Returns a
n {@link ExoMediaCrypto} for the open session, or null if called before the session
* been opened or after it's been released.
*
has
been opened or after it's been released.
*/
*/
@Nullable
@Nullable
T
getMediaCrypto
();
ExoMediaCrypto
getMediaCrypto
();
/**
/**
* Returns a map describing the key status for the session, or null if called before the session
* Returns a map describing the key status for the session, or null if called before the session
...
...
library/core/src/main/java/com/google/android/exoplayer2/drm/DrmSessionManager.java
View file @
aa9eb5ab
...
@@ -21,20 +21,18 @@ import com.google.android.exoplayer2.C;
...
@@ -21,20 +21,18 @@ import com.google.android.exoplayer2.C;
import
com.google.android.exoplayer2.drm.DrmInitData.SchemeData
;
import
com.google.android.exoplayer2.drm.DrmInitData.SchemeData
;
import
com.google.android.exoplayer2.util.MediaSourceEventDispatcher
;
import
com.google.android.exoplayer2.util.MediaSourceEventDispatcher
;
/**
/** Manages a DRM session. */
* Manages a DRM session.
public
interface
DrmSessionManager
{
*/
public
interface
DrmSessionManager
<
T
extends
ExoMediaCrypto
>
{
/** Returns {@link #DUMMY}. */
/** Returns {@link #DUMMY}. */
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
static
<
T
extends
ExoMediaCrypto
>
DrmSessionManager
<
T
>
getDummyDrmSessionManager
()
{
static
DrmSessionManager
getDummyDrmSessionManager
()
{
return
(
DrmSessionManager
<
T
>)
DUMMY
;
return
DUMMY
;
}
}
/** {@link DrmSessionManager} that supports no DRM schemes. */
/** {@link DrmSessionManager} that supports no DRM schemes. */
DrmSessionManager
<
ExoMediaCrypto
>
DUMMY
=
DrmSessionManager
DUMMY
=
new
DrmSessionManager
<
ExoMediaCrypto
>
()
{
new
DrmSessionManager
()
{
@Override
@Override
public
boolean
canAcquireSession
(
DrmInitData
drmInitData
)
{
public
boolean
canAcquireSession
(
DrmInitData
drmInitData
)
{
...
@@ -42,11 +40,11 @@ public interface DrmSessionManager<T extends ExoMediaCrypto> {
...
@@ -42,11 +40,11 @@ public interface DrmSessionManager<T extends ExoMediaCrypto> {
}
}
@Override
@Override
public
DrmSession
<
ExoMediaCrypto
>
acquireSession
(
public
DrmSession
acquireSession
(
Looper
playbackLooper
,
Looper
playbackLooper
,
@Nullable
MediaSourceEventDispatcher
eventDispatcher
,
@Nullable
MediaSourceEventDispatcher
eventDispatcher
,
DrmInitData
drmInitData
)
{
DrmInitData
drmInitData
)
{
return
new
ErrorStateDrmSession
<>
(
return
new
ErrorStateDrmSession
(
new
DrmSession
.
DrmSessionException
(
new
DrmSession
.
DrmSessionException
(
new
UnsupportedDrmException
(
UnsupportedDrmException
.
REASON_UNSUPPORTED_SCHEME
)));
new
UnsupportedDrmException
(
UnsupportedDrmException
.
REASON_UNSUPPORTED_SCHEME
)));
}
}
...
@@ -99,7 +97,7 @@ public interface DrmSessionManager<T extends ExoMediaCrypto> {
...
@@ -99,7 +97,7 @@ public interface DrmSessionManager<T extends ExoMediaCrypto> {
* placeholder sessions.
* placeholder sessions.
*/
*/
@Nullable
@Nullable
default
DrmSession
<
T
>
acquirePlaceholderSession
(
Looper
playbackLooper
,
int
trackType
)
{
default
DrmSession
acquirePlaceholderSession
(
Looper
playbackLooper
,
int
trackType
)
{
return
null
;
return
null
;
}
}
...
@@ -115,7 +113,7 @@ public interface DrmSessionManager<T extends ExoMediaCrypto> {
...
@@ -115,7 +113,7 @@ public interface DrmSessionManager<T extends ExoMediaCrypto> {
* non-null {@link SchemeData#data}.
* non-null {@link SchemeData#data}.
* @return The DRM session.
* @return The DRM session.
*/
*/
DrmSession
<
T
>
acquireSession
(
DrmSession
acquireSession
(
Looper
playbackLooper
,
Looper
playbackLooper
,
@Nullable
MediaSourceEventDispatcher
eventDispatcher
,
@Nullable
MediaSourceEventDispatcher
eventDispatcher
,
DrmInitData
drmInitData
);
DrmInitData
drmInitData
);
...
...
library/core/src/main/java/com/google/android/exoplayer2/drm/DummyExoMediaDrm.java
View file @
aa9eb5ab
...
@@ -26,26 +26,25 @@ import java.util.Map;
...
@@ -26,26 +26,25 @@ import java.util.Map;
/** An {@link ExoMediaDrm} that does not support any protection schemes. */
/** An {@link ExoMediaDrm} that does not support any protection schemes. */
@RequiresApi
(
18
)
@RequiresApi
(
18
)
public
final
class
DummyExoMediaDrm
<
T
extends
ExoMediaCrypto
>
implements
ExoMediaDrm
<
T
>
{
public
final
class
DummyExoMediaDrm
implements
ExoMediaDrm
{
/** Returns a new instance. */
/** Returns a new instance. */
@SuppressWarnings
(
"unchecked"
)
public
static
DummyExoMediaDrm
getInstance
()
{
public
static
<
T
extends
ExoMediaCrypto
>
DummyExoMediaDrm
<
T
>
getInstance
()
{
return
new
DummyExoMediaDrm
();
return
(
DummyExoMediaDrm
<
T
>)
new
DummyExoMediaDrm
<>();
}
}
@Override
@Override
public
void
setOnEventListener
(
OnEventListener
<?
super
T
>
listener
)
{
public
void
setOnEventListener
(
OnEventListener
listener
)
{
// Do nothing.
// Do nothing.
}
}
@Override
@Override
public
void
setOnKeyStatusChangeListener
(
OnKeyStatusChangeListener
<?
super
T
>
listener
)
{
public
void
setOnKeyStatusChangeListener
(
OnKeyStatusChangeListener
listener
)
{
// Do nothing.
// Do nothing.
}
}
@Override
@Override
public
void
setOnExpirationUpdateListener
(
OnExpirationUpdateListener
<?
super
T
>
listener
)
{
public
void
setOnExpirationUpdateListener
(
OnExpirationUpdateListener
listener
)
{
// Do nothing.
// Do nothing.
}
}
...
@@ -137,14 +136,14 @@ public final class DummyExoMediaDrm<T extends ExoMediaCrypto> implements ExoMedi
...
@@ -137,14 +136,14 @@ public final class DummyExoMediaDrm<T extends ExoMediaCrypto> implements ExoMedi
}
}
@Override
@Override
public
T
createMediaCrypto
(
byte
[]
sessionId
)
{
public
ExoMediaCrypto
createMediaCrypto
(
byte
[]
sessionId
)
{
// Should not be invoked. No session should exist.
// Should not be invoked. No session should exist.
throw
new
IllegalStateException
();
throw
new
IllegalStateException
();
}
}
@Override
@Override
@Nullable
@Nullable
public
Class
<
T
>
getExoMediaCryptoType
()
{
public
Class
<
ExoMediaCrypto
>
getExoMediaCryptoType
()
{
// No ExoMediaCrypto type is supported.
// No ExoMediaCrypto type is supported.
return
null
;
return
null
;
}
}
...
...
library/core/src/main/java/com/google/android/exoplayer2/drm/ErrorStateDrmSession.java
View file @
aa9eb5ab
...
@@ -21,7 +21,7 @@ import com.google.android.exoplayer2.util.MediaSourceEventDispatcher;
...
@@ -21,7 +21,7 @@ import com.google.android.exoplayer2.util.MediaSourceEventDispatcher;
import
java.util.Map
;
import
java.util.Map
;
/** A {@link DrmSession} that's in a terminal error state. */
/** A {@link DrmSession} that's in a terminal error state. */
public
final
class
ErrorStateDrmSession
<
T
extends
ExoMediaCrypto
>
implements
DrmSession
<
T
>
{
public
final
class
ErrorStateDrmSession
implements
DrmSession
{
private
final
DrmSessionException
error
;
private
final
DrmSessionException
error
;
...
@@ -47,7 +47,7 @@ public final class ErrorStateDrmSession<T extends ExoMediaCrypto> implements Drm
...
@@ -47,7 +47,7 @@ public final class ErrorStateDrmSession<T extends ExoMediaCrypto> implements Drm
@Override
@Override
@Nullable
@Nullable
public
T
getMediaCrypto
()
{
public
ExoMediaCrypto
getMediaCrypto
()
{
return
null
;
return
null
;
}
}
...
...
library/core/src/main/java/com/google/android/exoplayer2/drm/ExoMediaDrm.java
View file @
aa9eb5ab
...
@@ -42,17 +42,17 @@ import java.util.UUID;
...
@@ -42,17 +42,17 @@ import java.util.UUID;
* new instance does not normally need to call {@link #acquire()}, and must call {@link #release()}
* new instance does not normally need to call {@link #acquire()}, and must call {@link #release()}
* when the instance is no longer required.
* when the instance is no longer required.
*/
*/
public
interface
ExoMediaDrm
<
T
extends
ExoMediaCrypto
>
{
public
interface
ExoMediaDrm
{
/** {@link ExoMediaDrm} instances provider. */
/** {@link ExoMediaDrm} instances provider. */
interface
Provider
<
T
extends
ExoMediaCrypto
>
{
interface
Provider
{
/**
/**
* Returns an {@link ExoMediaDrm} instance with an incremented reference count. When the caller
* Returns an {@link ExoMediaDrm} instance with an incremented reference count. When the caller
* no longer needs to use the instance, it must call {@link ExoMediaDrm#release()} to decrement
* no longer needs to use the instance, it must call {@link ExoMediaDrm#release()} to decrement
* the reference count.
* the reference count.
*/
*/
ExoMediaDrm
<
T
>
acquireExoMediaDrm
(
UUID
uuid
);
ExoMediaDrm
acquireExoMediaDrm
(
UUID
uuid
);
}
}
/**
/**
...
@@ -62,17 +62,17 @@ public interface ExoMediaDrm<T extends ExoMediaCrypto> {
...
@@ -62,17 +62,17 @@ public interface ExoMediaDrm<T extends ExoMediaCrypto> {
* instance, and remains responsible for calling {@link ExoMediaDrm#release()} on the instance
* instance, and remains responsible for calling {@link ExoMediaDrm#release()} on the instance
* when it's no longer being used.
* when it's no longer being used.
*/
*/
final
class
AppManagedProvider
<
T
extends
ExoMediaCrypto
>
implements
Provider
<
T
>
{
final
class
AppManagedProvider
implements
Provider
{
private
final
ExoMediaDrm
<
T
>
exoMediaDrm
;
private
final
ExoMediaDrm
exoMediaDrm
;
/** Creates an instance that provides the given {@link ExoMediaDrm}. */
/** Creates an instance that provides the given {@link ExoMediaDrm}. */
public
AppManagedProvider
(
ExoMediaDrm
<
T
>
exoMediaDrm
)
{
public
AppManagedProvider
(
ExoMediaDrm
exoMediaDrm
)
{
this
.
exoMediaDrm
=
exoMediaDrm
;
this
.
exoMediaDrm
=
exoMediaDrm
;
}
}
@Override
@Override
public
ExoMediaDrm
<
T
>
acquireExoMediaDrm
(
UUID
uuid
)
{
public
ExoMediaDrm
acquireExoMediaDrm
(
UUID
uuid
)
{
exoMediaDrm
.
acquire
();
exoMediaDrm
.
acquire
();
return
exoMediaDrm
;
return
exoMediaDrm
;
}
}
...
@@ -108,10 +108,8 @@ public interface ExoMediaDrm<T extends ExoMediaCrypto> {
...
@@ -108,10 +108,8 @@ public interface ExoMediaDrm<T extends ExoMediaCrypto> {
@SuppressWarnings
(
"InlinedApi"
)
@SuppressWarnings
(
"InlinedApi"
)
int
KEY_TYPE_RELEASE
=
MediaDrm
.
KEY_TYPE_RELEASE
;
int
KEY_TYPE_RELEASE
=
MediaDrm
.
KEY_TYPE_RELEASE
;
/**
/** @see android.media.MediaDrm.OnEventListener */
* @see android.media.MediaDrm.OnEventListener
interface
OnEventListener
{
*/
interface
OnEventListener
<
T
extends
ExoMediaCrypto
>
{
/**
/**
* Called when an event occurs that requires the app to be notified
* Called when an event occurs that requires the app to be notified
*
*
...
@@ -122,17 +120,15 @@ public interface ExoMediaDrm<T extends ExoMediaCrypto> {
...
@@ -122,17 +120,15 @@ public interface ExoMediaDrm<T extends ExoMediaCrypto> {
* @param data Optional byte array of data that may be associated with the event.
* @param data Optional byte array of data that may be associated with the event.
*/
*/
void
onEvent
(
void
onEvent
(
ExoMediaDrm
<?
extends
T
>
mediaDrm
,
ExoMediaDrm
mediaDrm
,
@Nullable
byte
[]
sessionId
,
@Nullable
byte
[]
sessionId
,
int
event
,
int
event
,
int
extra
,
int
extra
,
@Nullable
byte
[]
data
);
@Nullable
byte
[]
data
);
}
}
/**
/** @see android.media.MediaDrm.OnKeyStatusChangeListener */
* @see android.media.MediaDrm.OnKeyStatusChangeListener
interface
OnKeyStatusChangeListener
{
*/
interface
OnKeyStatusChangeListener
<
T
extends
ExoMediaCrypto
>
{
/**
/**
* Called when the keys in a session change status, such as when the license is renewed or
* Called when the keys in a session change status, such as when the license is renewed or
* expires.
* expires.
...
@@ -143,14 +139,14 @@ public interface ExoMediaDrm<T extends ExoMediaCrypto> {
...
@@ -143,14 +139,14 @@ public interface ExoMediaDrm<T extends ExoMediaCrypto> {
* @param hasNewUsableKey Whether a new key became usable.
* @param hasNewUsableKey Whether a new key became usable.
*/
*/
void
onKeyStatusChange
(
void
onKeyStatusChange
(
ExoMediaDrm
<?
extends
T
>
mediaDrm
,
ExoMediaDrm
mediaDrm
,
byte
[]
sessionId
,
byte
[]
sessionId
,
List
<
KeyStatus
>
exoKeyInformation
,
List
<
KeyStatus
>
exoKeyInformation
,
boolean
hasNewUsableKey
);
boolean
hasNewUsableKey
);
}
}
/** @see android.media.MediaDrm.OnExpirationUpdateListener */
/** @see android.media.MediaDrm.OnExpirationUpdateListener */
interface
OnExpirationUpdateListener
<
T
extends
ExoMediaCrypto
>
{
interface
OnExpirationUpdateListener
{
/**
/**
* Called when a session expiration update occurs, to inform the app about the change in
* Called when a session expiration update occurs, to inform the app about the change in
...
@@ -162,8 +158,7 @@ public interface ExoMediaDrm<T extends ExoMediaCrypto> {
...
@@ -162,8 +158,7 @@ public interface ExoMediaDrm<T extends ExoMediaCrypto> {
* milliseconds, relative to the Unix epoch. A time of 0 indicates that the keys never
* milliseconds, relative to the Unix epoch. A time of 0 indicates that the keys never
* expire.
* expire.
*/
*/
void
onExpirationUpdate
(
void
onExpirationUpdate
(
ExoMediaDrm
mediaDrm
,
byte
[]
sessionId
,
long
expirationTimeMs
);
ExoMediaDrm
<?
extends
T
>
mediaDrm
,
byte
[]
sessionId
,
long
expirationTimeMs
);
}
}
/** @see android.media.MediaDrm.KeyStatus */
/** @see android.media.MediaDrm.KeyStatus */
...
@@ -229,18 +224,14 @@ public interface ExoMediaDrm<T extends ExoMediaCrypto> {
...
@@ -229,18 +224,14 @@ public interface ExoMediaDrm<T extends ExoMediaCrypto> {
}
}
/**
/** @see MediaDrm#setOnEventListener(MediaDrm.OnEventListener) */
* @see MediaDrm#setOnEventListener(MediaDrm.OnEventListener)
void
setOnEventListener
(
OnEventListener
listener
);
*/
void
setOnEventListener
(
OnEventListener
<?
super
T
>
listener
);
/**
/** @see MediaDrm#setOnKeyStatusChangeListener(MediaDrm.OnKeyStatusChangeListener, Handler) */
* @see MediaDrm#setOnKeyStatusChangeListener(MediaDrm.OnKeyStatusChangeListener, Handler)
void
setOnKeyStatusChangeListener
(
OnKeyStatusChangeListener
listener
);
*/
void
setOnKeyStatusChangeListener
(
OnKeyStatusChangeListener
<?
super
T
>
listener
);
/** @see MediaDrm#setOnExpirationUpdateListener(MediaDrm.OnExpirationUpdateListener, Handler) */
/** @see MediaDrm#setOnExpirationUpdateListener(MediaDrm.OnExpirationUpdateListener, Handler) */
void
setOnExpirationUpdateListener
(
OnExpirationUpdateListener
<?
super
T
>
listener
);
void
setOnExpirationUpdateListener
(
OnExpirationUpdateListener
listener
);
/** @see MediaDrm#openSession() */
/** @see MediaDrm#openSession() */
byte
[]
openSession
()
throws
MediaDrmException
;
byte
[]
openSession
()
throws
MediaDrmException
;
...
@@ -349,12 +340,12 @@ public interface ExoMediaDrm<T extends ExoMediaCrypto> {
...
@@ -349,12 +340,12 @@ public interface ExoMediaDrm<T extends ExoMediaCrypto> {
* @return An object extends {@link ExoMediaCrypto}, using opaque crypto scheme specific data.
* @return An object extends {@link ExoMediaCrypto}, using opaque crypto scheme specific data.
* @throws MediaCryptoException If the instance can't be created.
* @throws MediaCryptoException If the instance can't be created.
*/
*/
T
createMediaCrypto
(
byte
[]
sessionId
)
throws
MediaCryptoException
;
ExoMediaCrypto
createMediaCrypto
(
byte
[]
sessionId
)
throws
MediaCryptoException
;
/**
/**
* Returns the {@link ExoMediaCrypto} type created by {@link #createMediaCrypto(byte[])}, or null
* Returns the {@link ExoMediaCrypto} type created by {@link #createMediaCrypto(byte[])}, or null
* if this instance cannot create any {@link ExoMediaCrypto} instances.
* if this instance cannot create any {@link ExoMediaCrypto} instances.
*/
*/
@Nullable
@Nullable
Class
<
T
>
getExoMediaCryptoType
();
Class
<
?
extends
ExoMediaCrypto
>
getExoMediaCryptoType
();
}
}
library/core/src/main/java/com/google/android/exoplayer2/drm/FrameworkMediaDrm.java
View file @
aa9eb5ab
...
@@ -47,7 +47,7 @@ import java.util.UUID;
...
@@ -47,7 +47,7 @@ import java.util.UUID;
/** An {@link ExoMediaDrm} implementation that wraps the framework {@link MediaDrm}. */
/** An {@link ExoMediaDrm} implementation that wraps the framework {@link MediaDrm}. */
@TargetApi
(
23
)
@TargetApi
(
23
)
@RequiresApi
(
18
)
@RequiresApi
(
18
)
public
final
class
FrameworkMediaDrm
implements
ExoMediaDrm
<
FrameworkMediaCrypto
>
{
public
final
class
FrameworkMediaDrm
implements
ExoMediaDrm
{
private
static
final
String
TAG
=
"FrameworkMediaDrm"
;
private
static
final
String
TAG
=
"FrameworkMediaDrm"
;
...
@@ -56,13 +56,13 @@ public final class FrameworkMediaDrm implements ExoMediaDrm<FrameworkMediaCrypto
...
@@ -56,13 +56,13 @@ public final class FrameworkMediaDrm implements ExoMediaDrm<FrameworkMediaCrypto
* UUID. Returns a {@link DummyExoMediaDrm} if the protection scheme identified by the given UUID
* UUID. Returns a {@link DummyExoMediaDrm} if the protection scheme identified by the given UUID
* is not supported by the device.
* is not supported by the device.
*/
*/
public
static
final
Provider
<
FrameworkMediaCrypto
>
DEFAULT_PROVIDER
=
public
static
final
Provider
DEFAULT_PROVIDER
=
uuid
->
{
uuid
->
{
try
{
try
{
return
newInstance
(
uuid
);
return
newInstance
(
uuid
);
}
catch
(
UnsupportedDrmException
e
)
{
}
catch
(
UnsupportedDrmException
e
)
{
Log
.
e
(
TAG
,
"Failed to instantiate a FrameworkMediaDrm for uuid: "
+
uuid
+
"."
);
Log
.
e
(
TAG
,
"Failed to instantiate a FrameworkMediaDrm for uuid: "
+
uuid
+
"."
);
return
new
DummyExoMediaDrm
<>
();
return
new
DummyExoMediaDrm
();
}
}
};
};
...
@@ -106,8 +106,7 @@ public final class FrameworkMediaDrm implements ExoMediaDrm<FrameworkMediaCrypto
...
@@ -106,8 +106,7 @@ public final class FrameworkMediaDrm implements ExoMediaDrm<FrameworkMediaCrypto
}
}
@Override
@Override
public
void
setOnEventListener
(
public
void
setOnEventListener
(
ExoMediaDrm
.
OnEventListener
listener
)
{
ExoMediaDrm
.
OnEventListener
<?
super
FrameworkMediaCrypto
>
listener
)
{
mediaDrm
.
setOnEventListener
(
mediaDrm
.
setOnEventListener
(
listener
==
null
listener
==
null
?
null
?
null
...
@@ -116,8 +115,7 @@ public final class FrameworkMediaDrm implements ExoMediaDrm<FrameworkMediaCrypto
...
@@ -116,8 +115,7 @@ public final class FrameworkMediaDrm implements ExoMediaDrm<FrameworkMediaCrypto
}
}
@Override
@Override
public
void
setOnKeyStatusChangeListener
(
public
void
setOnKeyStatusChangeListener
(
ExoMediaDrm
.
OnKeyStatusChangeListener
listener
)
{
ExoMediaDrm
.
OnKeyStatusChangeListener
<?
super
FrameworkMediaCrypto
>
listener
)
{
if
(
Util
.
SDK_INT
<
23
)
{
if
(
Util
.
SDK_INT
<
23
)
{
throw
new
UnsupportedOperationException
();
throw
new
UnsupportedOperationException
();
}
}
...
@@ -137,8 +135,7 @@ public final class FrameworkMediaDrm implements ExoMediaDrm<FrameworkMediaCrypto
...
@@ -137,8 +135,7 @@ public final class FrameworkMediaDrm implements ExoMediaDrm<FrameworkMediaCrypto
}
}
@Override
@Override
public
void
setOnExpirationUpdateListener
(
public
void
setOnExpirationUpdateListener
(
OnExpirationUpdateListener
listener
)
{
OnExpirationUpdateListener
<?
super
FrameworkMediaCrypto
>
listener
)
{
if
(
Util
.
SDK_INT
<
23
)
{
if
(
Util
.
SDK_INT
<
23
)
{
throw
new
UnsupportedOperationException
();
throw
new
UnsupportedOperationException
();
}
}
...
...
library/core/src/main/java/com/google/android/exoplayer2/drm/OfflineLicenseHelper.java
View file @
aa9eb5ab
...
@@ -32,12 +32,12 @@ import java.util.UUID;
...
@@ -32,12 +32,12 @@ import java.util.UUID;
/** Helper class to download, renew and release offline licenses. */
/** Helper class to download, renew and release offline licenses. */
@RequiresApi
(
18
)
@RequiresApi
(
18
)
public
final
class
OfflineLicenseHelper
<
T
extends
ExoMediaCrypto
>
{
public
final
class
OfflineLicenseHelper
{
private
static
final
DrmInitData
DUMMY_DRM_INIT_DATA
=
new
DrmInitData
();
private
static
final
DrmInitData
DUMMY_DRM_INIT_DATA
=
new
DrmInitData
();
private
final
ConditionVariable
conditionVariable
;
private
final
ConditionVariable
conditionVariable
;
private
final
DefaultDrmSessionManager
<
T
>
drmSessionManager
;
private
final
DefaultDrmSessionManager
drmSessionManager
;
private
final
HandlerThread
handlerThread
;
private
final
HandlerThread
handlerThread
;
private
final
MediaSourceEventDispatcher
eventDispatcher
;
private
final
MediaSourceEventDispatcher
eventDispatcher
;
...
@@ -52,7 +52,7 @@ public final class OfflineLicenseHelper<T extends ExoMediaCrypto> {
...
@@ -52,7 +52,7 @@ public final class OfflineLicenseHelper<T extends ExoMediaCrypto> {
* events.
* events.
* @return A new instance which uses Widevine CDM.
* @return A new instance which uses Widevine CDM.
*/
*/
public
static
OfflineLicenseHelper
<
ExoMediaCrypto
>
newWidevineInstance
(
public
static
OfflineLicenseHelper
newWidevineInstance
(
String
defaultLicenseUrl
,
String
defaultLicenseUrl
,
HttpDataSource
.
Factory
httpDataSourceFactory
,
HttpDataSource
.
Factory
httpDataSourceFactory
,
MediaSourceEventDispatcher
eventDispatcher
)
{
MediaSourceEventDispatcher
eventDispatcher
)
{
...
@@ -76,7 +76,7 @@ public final class OfflineLicenseHelper<T extends ExoMediaCrypto> {
...
@@ -76,7 +76,7 @@ public final class OfflineLicenseHelper<T extends ExoMediaCrypto> {
* events.
* events.
* @return A new instance which uses Widevine CDM.
* @return A new instance which uses Widevine CDM.
*/
*/
public
static
OfflineLicenseHelper
<
ExoMediaCrypto
>
newWidevineInstance
(
public
static
OfflineLicenseHelper
newWidevineInstance
(
String
defaultLicenseUrl
,
String
defaultLicenseUrl
,
boolean
forceDefaultLicenseUrl
,
boolean
forceDefaultLicenseUrl
,
HttpDataSource
.
Factory
httpDataSourceFactory
,
HttpDataSource
.
Factory
httpDataSourceFactory
,
...
@@ -105,13 +105,13 @@ public final class OfflineLicenseHelper<T extends ExoMediaCrypto> {
...
@@ -105,13 +105,13 @@ public final class OfflineLicenseHelper<T extends ExoMediaCrypto> {
* @see DefaultDrmSessionManager.Builder
* @see DefaultDrmSessionManager.Builder
*/
*/
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
public
static
OfflineLicenseHelper
<
ExoMediaCrypto
>
newWidevineInstance
(
public
static
OfflineLicenseHelper
newWidevineInstance
(
String
defaultLicenseUrl
,
String
defaultLicenseUrl
,
boolean
forceDefaultLicenseUrl
,
boolean
forceDefaultLicenseUrl
,
HttpDataSource
.
Factory
httpDataSourceFactory
,
HttpDataSource
.
Factory
httpDataSourceFactory
,
@Nullable
Map
<
String
,
String
>
optionalKeyRequestParameters
,
@Nullable
Map
<
String
,
String
>
optionalKeyRequestParameters
,
MediaSourceEventDispatcher
eventDispatcher
)
{
MediaSourceEventDispatcher
eventDispatcher
)
{
return
new
OfflineLicenseHelper
<>
(
return
new
OfflineLicenseHelper
(
new
DefaultDrmSessionManager
.
Builder
()
new
DefaultDrmSessionManager
.
Builder
()
.
setKeyRequestParameters
(
optionalKeyRequestParameters
)
.
setKeyRequestParameters
(
optionalKeyRequestParameters
)
.
build
(
.
build
(
...
@@ -128,12 +128,11 @@ public final class OfflineLicenseHelper<T extends ExoMediaCrypto> {
...
@@ -128,12 +128,11 @@ public final class OfflineLicenseHelper<T extends ExoMediaCrypto> {
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
public
OfflineLicenseHelper
(
public
OfflineLicenseHelper
(
UUID
uuid
,
UUID
uuid
,
ExoMediaDrm
.
Provider
<
T
>
mediaDrmProvider
,
ExoMediaDrm
.
Provider
mediaDrmProvider
,
MediaDrmCallback
callback
,
MediaDrmCallback
callback
,
@Nullable
Map
<
String
,
String
>
optionalKeyRequestParameters
,
@Nullable
Map
<
String
,
String
>
optionalKeyRequestParameters
,
MediaSourceEventDispatcher
eventDispatcher
)
{
MediaSourceEventDispatcher
eventDispatcher
)
{
this
(
this
(
(
DefaultDrmSessionManager
<
T
>)
new
DefaultDrmSessionManager
.
Builder
()
new
DefaultDrmSessionManager
.
Builder
()
.
setUuidAndExoMediaDrmProvider
(
uuid
,
mediaDrmProvider
)
.
setUuidAndExoMediaDrmProvider
(
uuid
,
mediaDrmProvider
)
.
setKeyRequestParameters
(
optionalKeyRequestParameters
)
.
setKeyRequestParameters
(
optionalKeyRequestParameters
)
...
@@ -149,7 +148,7 @@ public final class OfflineLicenseHelper<T extends ExoMediaCrypto> {
...
@@ -149,7 +148,7 @@ public final class OfflineLicenseHelper<T extends ExoMediaCrypto> {
* events.
* events.
*/
*/
public
OfflineLicenseHelper
(
public
OfflineLicenseHelper
(
DefaultDrmSessionManager
<
T
>
defaultDrmSessionManager
,
DefaultDrmSessionManager
defaultDrmSessionManager
,
MediaSourceEventDispatcher
eventDispatcher
)
{
MediaSourceEventDispatcher
eventDispatcher
)
{
this
.
drmSessionManager
=
defaultDrmSessionManager
;
this
.
drmSessionManager
=
defaultDrmSessionManager
;
this
.
eventDispatcher
=
eventDispatcher
;
this
.
eventDispatcher
=
eventDispatcher
;
...
@@ -231,7 +230,7 @@ public final class OfflineLicenseHelper<T extends ExoMediaCrypto> {
...
@@ -231,7 +230,7 @@ public final class OfflineLicenseHelper<T extends ExoMediaCrypto> {
throws
DrmSessionException
{
throws
DrmSessionException
{
Assertions
.
checkNotNull
(
offlineLicenseKeySetId
);
Assertions
.
checkNotNull
(
offlineLicenseKeySetId
);
drmSessionManager
.
prepare
();
drmSessionManager
.
prepare
();
DrmSession
<
T
>
drmSession
=
DrmSession
drmSession
=
openBlockingKeyRequest
(
openBlockingKeyRequest
(
DefaultDrmSessionManager
.
MODE_QUERY
,
offlineLicenseKeySetId
,
DUMMY_DRM_INIT_DATA
);
DefaultDrmSessionManager
.
MODE_QUERY
,
offlineLicenseKeySetId
,
DUMMY_DRM_INIT_DATA
);
DrmSessionException
error
=
drmSession
.
getError
();
DrmSessionException
error
=
drmSession
.
getError
();
...
@@ -259,8 +258,8 @@ public final class OfflineLicenseHelper<T extends ExoMediaCrypto> {
...
@@ -259,8 +258,8 @@ public final class OfflineLicenseHelper<T extends ExoMediaCrypto> {
@Mode
int
licenseMode
,
@Nullable
byte
[]
offlineLicenseKeySetId
,
DrmInitData
drmInitData
)
@Mode
int
licenseMode
,
@Nullable
byte
[]
offlineLicenseKeySetId
,
DrmInitData
drmInitData
)
throws
DrmSessionException
{
throws
DrmSessionException
{
drmSessionManager
.
prepare
();
drmSessionManager
.
prepare
();
DrmSession
<
T
>
drmSession
=
openBlockingKeyRequest
(
licenseMode
,
offlineLicenseKeySetId
,
DrmSession
drmSession
=
drmInitData
);
openBlockingKeyRequest
(
licenseMode
,
offlineLicenseKeySetId
,
drmInitData
);
DrmSessionException
error
=
drmSession
.
getError
();
DrmSessionException
error
=
drmSession
.
getError
();
byte
[]
keySetId
=
drmSession
.
getOfflineLicenseKeySetId
();
byte
[]
keySetId
=
drmSession
.
getOfflineLicenseKeySetId
();
drmSession
.
release
(
eventDispatcher
);
drmSession
.
release
(
eventDispatcher
);
...
@@ -271,11 +270,11 @@ public final class OfflineLicenseHelper<T extends ExoMediaCrypto> {
...
@@ -271,11 +270,11 @@ public final class OfflineLicenseHelper<T extends ExoMediaCrypto> {
return
Assertions
.
checkNotNull
(
keySetId
);
return
Assertions
.
checkNotNull
(
keySetId
);
}
}
private
DrmSession
<
T
>
openBlockingKeyRequest
(
private
DrmSession
openBlockingKeyRequest
(
@Mode
int
licenseMode
,
@Nullable
byte
[]
offlineLicenseKeySetId
,
DrmInitData
drmInitData
)
{
@Mode
int
licenseMode
,
@Nullable
byte
[]
offlineLicenseKeySetId
,
DrmInitData
drmInitData
)
{
drmSessionManager
.
setMode
(
licenseMode
,
offlineLicenseKeySetId
);
drmSessionManager
.
setMode
(
licenseMode
,
offlineLicenseKeySetId
);
conditionVariable
.
close
();
conditionVariable
.
close
();
DrmSession
<
T
>
drmSession
=
DrmSession
drmSession
=
drmSessionManager
.
acquireSession
(
handlerThread
.
getLooper
(),
eventDispatcher
,
drmInitData
);
drmSessionManager
.
acquireSession
(
handlerThread
.
getLooper
(),
eventDispatcher
,
drmInitData
);
// Block current thread until key loading is finished
// Block current thread until key loading is finished
conditionVariable
.
block
();
conditionVariable
.
block
();
...
...
library/core/src/main/java/com/google/android/exoplayer2/drm/WidevineUtil.java
View file @
aa9eb5ab
...
@@ -39,8 +39,7 @@ public final class WidevineUtil {
...
@@ -39,8 +39,7 @@ public final class WidevineUtil {
* @return A {@link Pair} consisting of the remaining license and playback durations in seconds,
* @return A {@link Pair} consisting of the remaining license and playback durations in seconds,
* or null if called before the session has been opened or after it's been released.
* or null if called before the session has been opened or after it's been released.
*/
*/
public
static
@Nullable
Pair
<
Long
,
Long
>
getLicenseDurationRemainingSec
(
public
static
@Nullable
Pair
<
Long
,
Long
>
getLicenseDurationRemainingSec
(
DrmSession
drmSession
)
{
DrmSession
<?>
drmSession
)
{
Map
<
String
,
String
>
keyStatus
=
drmSession
.
queryKeyStatus
();
Map
<
String
,
String
>
keyStatus
=
drmSession
.
queryKeyStatus
();
if
(
keyStatus
==
null
)
{
if
(
keyStatus
==
null
)
{
return
null
;
return
null
;
...
...
library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java
View file @
aa9eb5ab
...
@@ -39,6 +39,7 @@ import com.google.android.exoplayer2.decoder.DecoderCounters;
...
@@ -39,6 +39,7 @@ import com.google.android.exoplayer2.decoder.DecoderCounters;
import
com.google.android.exoplayer2.decoder.DecoderInputBuffer
;
import
com.google.android.exoplayer2.decoder.DecoderInputBuffer
;
import
com.google.android.exoplayer2.drm.DrmSession
;
import
com.google.android.exoplayer2.drm.DrmSession
;
import
com.google.android.exoplayer2.drm.DrmSession.DrmSessionException
;
import
com.google.android.exoplayer2.drm.DrmSession.DrmSessionException
;
import
com.google.android.exoplayer2.drm.ExoMediaCrypto
;
import
com.google.android.exoplayer2.drm.FrameworkMediaCrypto
;
import
com.google.android.exoplayer2.drm.FrameworkMediaCrypto
;
import
com.google.android.exoplayer2.mediacodec.MediaCodecUtil.DecoderQueryException
;
import
com.google.android.exoplayer2.mediacodec.MediaCodecUtil.DecoderQueryException
;
import
com.google.android.exoplayer2.source.MediaPeriod
;
import
com.google.android.exoplayer2.source.MediaPeriod
;
...
@@ -368,8 +369,8 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
...
@@ -368,8 +369,8 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
@Nullable
private
Format
inputFormat
;
@Nullable
private
Format
inputFormat
;
private
Format
outputFormat
;
private
Format
outputFormat
;
@Nullable
private
DrmSession
<
FrameworkMediaCrypto
>
codecDrmSession
;
@Nullable
private
DrmSession
codecDrmSession
;
@Nullable
private
DrmSession
<
FrameworkMediaCrypto
>
sourceDrmSession
;
@Nullable
private
DrmSession
sourceDrmSession
;
@Nullable
private
MediaCrypto
mediaCrypto
;
@Nullable
private
MediaCrypto
mediaCrypto
;
private
boolean
mediaCryptoRequiresSecureDecoder
;
private
boolean
mediaCryptoRequiresSecureDecoder
;
private
long
renderTimeLimitMs
;
private
long
renderTimeLimitMs
;
...
@@ -574,9 +575,10 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
...
@@ -574,9 +575,10 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
String
mimeType
=
inputFormat
.
sampleMimeType
;
String
mimeType
=
inputFormat
.
sampleMimeType
;
if
(
codecDrmSession
!=
null
)
{
if
(
codecDrmSession
!=
null
)
{
if
(
mediaCrypto
==
null
)
{
if
(
mediaCrypto
==
null
)
{
FrameworkMediaCrypto
sessionMediaCrypto
=
codecDrmSession
.
getMediaCrypto
();
@Nullable
FrameworkMediaCrypto
sessionMediaCrypto
=
getFrameworkMediaCrypto
(
codecDrmSession
);
if
(
sessionMediaCrypto
==
null
)
{
if
(
sessionMediaCrypto
==
null
)
{
DrmSessionException
drmError
=
codecDrmSession
.
getError
();
@Nullable
DrmSessionException
drmError
=
codecDrmSession
.
getError
();
if
(
drmError
!=
null
)
{
if
(
drmError
!=
null
)
{
// Continue for now. We may be able to avoid failure if the session recovers, or if a
// Continue for now. We may be able to avoid failure if the session recovers, or if a
// new input format causes the session to be replaced before it's used.
// new input format causes the session to be replaced before it's used.
...
@@ -1146,12 +1148,12 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
...
@@ -1146,12 +1148,12 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
outputBuffer
=
null
;
outputBuffer
=
null
;
}
}
private
void
setSourceDrmSession
(
@Nullable
DrmSession
<
FrameworkMediaCrypto
>
session
)
{
private
void
setSourceDrmSession
(
@Nullable
DrmSession
session
)
{
DrmSession
.
replaceSession
(
sourceDrmSession
,
session
);
DrmSession
.
replaceSession
(
sourceDrmSession
,
session
);
sourceDrmSession
=
session
;
sourceDrmSession
=
session
;
}
}
private
void
setCodecDrmSession
(
@Nullable
DrmSession
<
FrameworkMediaCrypto
>
session
)
{
private
void
setCodecDrmSession
(
@Nullable
DrmSession
session
)
{
DrmSession
.
replaceSession
(
codecDrmSession
,
session
);
DrmSession
.
replaceSession
(
codecDrmSession
,
session
);
codecDrmSession
=
session
;
codecDrmSession
=
session
;
}
}
...
@@ -1357,7 +1359,7 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
...
@@ -1357,7 +1359,7 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
protected
void
onInputFormatChanged
(
FormatHolder
formatHolder
)
throws
ExoPlaybackException
{
protected
void
onInputFormatChanged
(
FormatHolder
formatHolder
)
throws
ExoPlaybackException
{
waitingForFirstSampleInFormat
=
true
;
waitingForFirstSampleInFormat
=
true
;
Format
newFormat
=
Assertions
.
checkNotNull
(
formatHolder
.
format
);
Format
newFormat
=
Assertions
.
checkNotNull
(
formatHolder
.
format
);
setSourceDrmSession
(
(
DrmSession
<
FrameworkMediaCrypto
>)
formatHolder
.
drmSession
);
setSourceDrmSession
(
formatHolder
.
drmSession
);
inputFormat
=
newFormat
;
inputFormat
=
newFormat
;
if
(
codec
==
null
)
{
if
(
codec
==
null
)
{
...
@@ -1865,6 +1867,47 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
...
@@ -1865,6 +1867,47 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
return
outputStreamOffsetUs
;
return
outputStreamOffsetUs
;
}
}
/** Returns whether this renderer supports the given {@link Format Format's} DRM scheme. */
protected
static
boolean
supportsFormatDrm
(
Format
format
)
{
return
format
.
drmInitData
==
null
||
FrameworkMediaCrypto
.
class
.
equals
(
format
.
exoMediaCryptoType
);
}
/**
* Returns whether a {@link DrmSession} may require a secure decoder for a given {@link Format}.
*
* @param drmSession The {@link DrmSession}.
* @param format The {@link Format}.
* @return Whether a secure decoder may be required.
*/
private
boolean
maybeRequiresSecureDecoder
(
DrmSession
drmSession
,
Format
format
)
throws
ExoPlaybackException
{
// MediaCrypto type is checked during track selection.
@Nullable
FrameworkMediaCrypto
sessionMediaCrypto
=
getFrameworkMediaCrypto
(
drmSession
);
if
(
sessionMediaCrypto
==
null
)
{
// We'd only expect this to happen if the CDM from which the pending session is obtained needs
// provisioning. This is unlikely to happen (it probably requires a switch from one DRM scheme
// to another, where the new CDM hasn't been used before and needs provisioning). Assume that
// a secure decoder may be required.
return
true
;
}
if
(
sessionMediaCrypto
.
forceAllowInsecureDecoderComponents
)
{
return
false
;
}
MediaCrypto
mediaCrypto
;
try
{
mediaCrypto
=
new
MediaCrypto
(
sessionMediaCrypto
.
uuid
,
sessionMediaCrypto
.
sessionId
);
}
catch
(
MediaCryptoException
e
)
{
// This shouldn't happen, but if it does then assume that a secure decoder may be required.
return
true
;
}
try
{
return
mediaCrypto
.
requiresSecureDecoderComponent
(
format
.
sampleMimeType
);
}
finally
{
mediaCrypto
.
release
();
}
}
private
void
reinitializeCodec
()
throws
ExoPlaybackException
{
private
void
reinitializeCodec
()
throws
ExoPlaybackException
{
releaseCodec
();
releaseCodec
();
maybeInitCodec
();
maybeInitCodec
();
...
@@ -1885,7 +1928,7 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
...
@@ -1885,7 +1928,7 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
@RequiresApi
(
23
)
@RequiresApi
(
23
)
private
void
updateDrmSessionOrReinitializeCodecV23
()
throws
ExoPlaybackException
{
private
void
updateDrmSessionOrReinitializeCodecV23
()
throws
ExoPlaybackException
{
@Nullable
FrameworkMediaCrypto
sessionMediaCrypto
=
sourceDrmSession
.
getMediaCrypto
(
);
@Nullable
FrameworkMediaCrypto
sessionMediaCrypto
=
getFrameworkMediaCrypto
(
sourceDrmSession
);
if
(
sessionMediaCrypto
==
null
)
{
if
(
sessionMediaCrypto
==
null
)
{
// We'd only expect this to happen if the CDM from which the pending session is obtained needs
// We'd only expect this to happen if the CDM from which the pending session is obtained needs
// provisioning. This is unlikely to happen (it probably requires a switch from one DRM scheme
// provisioning. This is unlikely to happen (it probably requires a switch from one DRM scheme
...
@@ -1919,38 +1962,18 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
...
@@ -1919,38 +1962,18 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
codecDrainAction
=
DRAIN_ACTION_NONE
;
codecDrainAction
=
DRAIN_ACTION_NONE
;
}
}
/**
@Nullable
* Returns whether a {@link DrmSession} may require a secure decoder for a given {@link Format}.
private
FrameworkMediaCrypto
getFrameworkMediaCrypto
(
DrmSession
drmSession
)
*
throws
ExoPlaybackException
{
* @param drmSession The {@link DrmSession}.
@Nullable
ExoMediaCrypto
mediaCrypto
=
drmSession
.
getMediaCrypto
();
* @param format The {@link Format}.
if
(
mediaCrypto
!=
null
&&
!(
mediaCrypto
instanceof
FrameworkMediaCrypto
))
{
* @return Whether a secure decoder may be required.
// This should not happen if the track went through a supportsFormatDrm() check, during track
*/
// selection.
private
static
boolean
maybeRequiresSecureDecoder
(
throw
createRendererException
(
DrmSession
<
FrameworkMediaCrypto
>
drmSession
,
Format
format
)
{
new
IllegalArgumentException
(
"Expecting FrameworkMediaCrypto but found: "
+
mediaCrypto
),
@Nullable
FrameworkMediaCrypto
sessionMediaCrypto
=
drmSession
.
getMediaCrypto
();
inputFormat
);
if
(
sessionMediaCrypto
==
null
)
{
}
// We'd only expect this to happen if the CDM from which the pending session is obtained needs
return
(
FrameworkMediaCrypto
)
mediaCrypto
;
// provisioning. This is unlikely to happen (it probably requires a switch from one DRM scheme
// to another, where the new CDM hasn't been used before and needs provisioning). Assume that
// a secure decoder may be required.
return
true
;
}
if
(
sessionMediaCrypto
.
forceAllowInsecureDecoderComponents
)
{
return
false
;
}
MediaCrypto
mediaCrypto
;
try
{
mediaCrypto
=
new
MediaCrypto
(
sessionMediaCrypto
.
uuid
,
sessionMediaCrypto
.
sessionId
);
}
catch
(
MediaCryptoException
e
)
{
// This shouldn't happen, but if it does then assume that a secure decoder may be required.
return
true
;
}
try
{
return
mediaCrypto
.
requiresSecureDecoderComponent
(
format
.
sampleMimeType
);
}
finally
{
mediaCrypto
.
release
();
}
}
}
private
static
boolean
isMediaCodecException
(
IllegalStateException
error
)
{
private
static
boolean
isMediaCodecException
(
IllegalStateException
error
)
{
...
...
library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadHelper.java
View file @
aa9eb5ab
...
@@ -30,7 +30,6 @@ import com.google.android.exoplayer2.RenderersFactory;
...
@@ -30,7 +30,6 @@ import com.google.android.exoplayer2.RenderersFactory;
import
com.google.android.exoplayer2.Timeline
;
import
com.google.android.exoplayer2.Timeline
;
import
com.google.android.exoplayer2.audio.AudioRendererEventListener
;
import
com.google.android.exoplayer2.audio.AudioRendererEventListener
;
import
com.google.android.exoplayer2.drm.DrmSessionManager
;
import
com.google.android.exoplayer2.drm.DrmSessionManager
;
import
com.google.android.exoplayer2.drm.FrameworkMediaCrypto
;
import
com.google.android.exoplayer2.source.MediaPeriod
;
import
com.google.android.exoplayer2.source.MediaPeriod
;
import
com.google.android.exoplayer2.source.MediaSource
;
import
com.google.android.exoplayer2.source.MediaSource
;
import
com.google.android.exoplayer2.source.MediaSource.MediaPeriodId
;
import
com.google.android.exoplayer2.source.MediaSource.MediaPeriodId
;
...
@@ -281,7 +280,7 @@ public final class DownloadHelper {
...
@@ -281,7 +280,7 @@ public final class DownloadHelper {
Uri
uri
,
Uri
uri
,
DataSource
.
Factory
dataSourceFactory
,
DataSource
.
Factory
dataSourceFactory
,
RenderersFactory
renderersFactory
,
RenderersFactory
renderersFactory
,
@Nullable
DrmSessionManager
<
FrameworkMediaCrypto
>
drmSessionManager
,
@Nullable
DrmSessionManager
drmSessionManager
,
DefaultTrackSelector
.
Parameters
trackSelectorParameters
)
{
DefaultTrackSelector
.
Parameters
trackSelectorParameters
)
{
return
new
DownloadHelper
(
return
new
DownloadHelper
(
DownloadRequest
.
TYPE_DASH
,
DownloadRequest
.
TYPE_DASH
,
...
@@ -351,7 +350,7 @@ public final class DownloadHelper {
...
@@ -351,7 +350,7 @@ public final class DownloadHelper {
Uri
uri
,
Uri
uri
,
DataSource
.
Factory
dataSourceFactory
,
DataSource
.
Factory
dataSourceFactory
,
RenderersFactory
renderersFactory
,
RenderersFactory
renderersFactory
,
@Nullable
DrmSessionManager
<
FrameworkMediaCrypto
>
drmSessionManager
,
@Nullable
DrmSessionManager
drmSessionManager
,
DefaultTrackSelector
.
Parameters
trackSelectorParameters
)
{
DefaultTrackSelector
.
Parameters
trackSelectorParameters
)
{
return
new
DownloadHelper
(
return
new
DownloadHelper
(
DownloadRequest
.
TYPE_HLS
,
DownloadRequest
.
TYPE_HLS
,
...
@@ -421,7 +420,7 @@ public final class DownloadHelper {
...
@@ -421,7 +420,7 @@ public final class DownloadHelper {
Uri
uri
,
Uri
uri
,
DataSource
.
Factory
dataSourceFactory
,
DataSource
.
Factory
dataSourceFactory
,
RenderersFactory
renderersFactory
,
RenderersFactory
renderersFactory
,
@Nullable
DrmSessionManager
<
FrameworkMediaCrypto
>
drmSessionManager
,
@Nullable
DrmSessionManager
drmSessionManager
,
DefaultTrackSelector
.
Parameters
trackSelectorParameters
)
{
DefaultTrackSelector
.
Parameters
trackSelectorParameters
)
{
return
new
DownloadHelper
(
return
new
DownloadHelper
(
DownloadRequest
.
TYPE_SS
,
DownloadRequest
.
TYPE_SS
,
...
@@ -459,7 +458,7 @@ public final class DownloadHelper {
...
@@ -459,7 +458,7 @@ public final class DownloadHelper {
public
static
MediaSource
createMediaSource
(
public
static
MediaSource
createMediaSource
(
DownloadRequest
downloadRequest
,
DownloadRequest
downloadRequest
,
DataSource
.
Factory
dataSourceFactory
,
DataSource
.
Factory
dataSourceFactory
,
@Nullable
DrmSessionManager
<?>
drmSessionManager
)
{
@Nullable
DrmSessionManager
drmSessionManager
)
{
@Nullable
Constructor
<?
extends
MediaSourceFactory
>
constructor
;
@Nullable
Constructor
<?
extends
MediaSourceFactory
>
constructor
;
switch
(
downloadRequest
.
type
)
{
switch
(
downloadRequest
.
type
)
{
case
DownloadRequest
.
TYPE_DASH
:
case
DownloadRequest
.
TYPE_DASH
:
...
@@ -943,7 +942,7 @@ public final class DownloadHelper {
...
@@ -943,7 +942,7 @@ public final class DownloadHelper {
@Nullable
Constructor
<?
extends
MediaSourceFactory
>
constructor
,
@Nullable
Constructor
<?
extends
MediaSourceFactory
>
constructor
,
Uri
uri
,
Uri
uri
,
Factory
dataSourceFactory
,
Factory
dataSourceFactory
,
@Nullable
DrmSessionManager
<?>
drmSessionManager
,
@Nullable
DrmSessionManager
drmSessionManager
,
@Nullable
List
<
StreamKey
>
streamKeys
)
{
@Nullable
List
<
StreamKey
>
streamKeys
)
{
if
(
constructor
==
null
)
{
if
(
constructor
==
null
)
{
throw
new
IllegalStateException
(
"Module missing to create media source."
);
throw
new
IllegalStateException
(
"Module missing to create media source."
);
...
...
library/core/src/main/java/com/google/android/exoplayer2/source/DefaultMediaSourceFactory.java
View file @
aa9eb5ab
...
@@ -126,7 +126,7 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory {
...
@@ -126,7 +126,7 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory {
@C
.
ContentType
private
final
int
[]
supportedTypes
;
@C
.
ContentType
private
final
int
[]
supportedTypes
;
private
final
String
userAgent
;
private
final
String
userAgent
;
private
DrmSessionManager
<?>
drmSessionManager
;
private
DrmSessionManager
drmSessionManager
;
private
HttpDataSource
.
Factory
drmHttpDataSourceFactory
;
private
HttpDataSource
.
Factory
drmHttpDataSourceFactory
;
private
boolean
playClearContentWithoutKey
;
private
boolean
playClearContentWithoutKey
;
private
int
[]
useDrmSessionsForClearContentTrackTypes
;
private
int
[]
useDrmSessionsForClearContentTrackTypes
;
...
@@ -191,7 +191,7 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory {
...
@@ -191,7 +191,7 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory {
@Override
@Override
public
DefaultMediaSourceFactory
setDrmSessionManager
(
public
DefaultMediaSourceFactory
setDrmSessionManager
(
@Nullable
DrmSessionManager
<?>
drmSessionManager
)
{
@Nullable
DrmSessionManager
drmSessionManager
)
{
this
.
drmSessionManager
=
this
.
drmSessionManager
=
drmSessionManager
!=
null
drmSessionManager
!=
null
?
drmSessionManager
?
drmSessionManager
...
@@ -249,7 +249,7 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory {
...
@@ -249,7 +249,7 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory {
// internal methods
// internal methods
private
DrmSessionManager
<?>
createDrmSessionManager
(
MediaItem
mediaItem
)
{
private
DrmSessionManager
createDrmSessionManager
(
MediaItem
mediaItem
)
{
Assertions
.
checkNotNull
(
mediaItem
.
playbackProperties
);
Assertions
.
checkNotNull
(
mediaItem
.
playbackProperties
);
if
(
mediaItem
.
playbackProperties
.
drmConfiguration
==
null
if
(
mediaItem
.
playbackProperties
.
drmConfiguration
==
null
||
mediaItem
.
playbackProperties
.
drmConfiguration
.
licenseUri
==
null
||
mediaItem
.
playbackProperties
.
drmConfiguration
.
licenseUri
==
null
...
...
library/core/src/main/java/com/google/android/exoplayer2/source/ExtractorMediaSource.java
View file @
aa9eb5ab
...
@@ -164,7 +164,7 @@ public final class ExtractorMediaSource extends CompositeMediaSource<Void> {
...
@@ -164,7 +164,7 @@ public final class ExtractorMediaSource extends CompositeMediaSource<Void> {
/** @deprecated Use {@link ProgressiveMediaSource.Factory#setDrmSessionManager} instead. */
/** @deprecated Use {@link ProgressiveMediaSource.Factory#setDrmSessionManager} instead. */
@Deprecated
@Deprecated
@Override
@Override
public
Factory
setDrmSessionManager
(
@Nullable
DrmSessionManager
<?>
drmSessionManager
)
{
public
Factory
setDrmSessionManager
(
@Nullable
DrmSessionManager
drmSessionManager
)
{
throw
new
UnsupportedOperationException
();
throw
new
UnsupportedOperationException
();
}
}
...
...
library/core/src/main/java/com/google/android/exoplayer2/source/MediaSourceFactory.java
View file @
aa9eb5ab
...
@@ -40,7 +40,7 @@ public interface MediaSourceFactory {
...
@@ -40,7 +40,7 @@ public interface MediaSourceFactory {
* @param drmSessionManager The {@link DrmSessionManager}.
* @param drmSessionManager The {@link DrmSessionManager}.
* @return This factory, for convenience.
* @return This factory, for convenience.
*/
*/
MediaSourceFactory
setDrmSessionManager
(
@Nullable
DrmSessionManager
<?>
drmSessionManager
);
MediaSourceFactory
setDrmSessionManager
(
@Nullable
DrmSessionManager
drmSessionManager
);
/**
/**
* Sets an optional {@link LoadErrorHandlingPolicy}.
* Sets an optional {@link LoadErrorHandlingPolicy}.
...
...
library/core/src/main/java/com/google/android/exoplayer2/source/ProgressiveMediaPeriod.java
View file @
aa9eb5ab
...
@@ -97,7 +97,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
...
@@ -97,7 +97,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
private
final
Uri
uri
;
private
final
Uri
uri
;
private
final
DataSource
dataSource
;
private
final
DataSource
dataSource
;
private
final
DrmSessionManager
<?>
drmSessionManager
;
private
final
DrmSessionManager
drmSessionManager
;
private
final
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
;
private
final
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
;
private
final
EventDispatcher
eventDispatcher
;
private
final
EventDispatcher
eventDispatcher
;
private
final
Listener
listener
;
private
final
Listener
listener
;
...
@@ -161,7 +161,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
...
@@ -161,7 +161,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
Uri
uri
,
Uri
uri
,
DataSource
dataSource
,
DataSource
dataSource
,
Extractor
[]
extractors
,
Extractor
[]
extractors
,
DrmSessionManager
<?>
drmSessionManager
,
DrmSessionManager
drmSessionManager
,
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
,
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
,
EventDispatcher
eventDispatcher
,
EventDispatcher
eventDispatcher
,
Listener
listener
,
Listener
listener
,
...
...
library/core/src/main/java/com/google/android/exoplayer2/source/ProgressiveMediaSource.java
View file @
aa9eb5ab
...
@@ -52,7 +52,7 @@ public final class ProgressiveMediaSource extends BaseMediaSource
...
@@ -52,7 +52,7 @@ public final class ProgressiveMediaSource extends BaseMediaSource
private
final
DataSource
.
Factory
dataSourceFactory
;
private
final
DataSource
.
Factory
dataSourceFactory
;
private
ExtractorsFactory
extractorsFactory
;
private
ExtractorsFactory
extractorsFactory
;
private
DrmSessionManager
<?>
drmSessionManager
;
private
DrmSessionManager
drmSessionManager
;
private
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
;
private
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
;
private
int
continueLoadingCheckIntervalBytes
;
private
int
continueLoadingCheckIntervalBytes
;
@Nullable
private
String
customCacheKey
;
@Nullable
private
String
customCacheKey
;
...
@@ -156,7 +156,7 @@ public final class ProgressiveMediaSource extends BaseMediaSource
...
@@ -156,7 +156,7 @@ public final class ProgressiveMediaSource extends BaseMediaSource
* @return This factory, for convenience.
* @return This factory, for convenience.
*/
*/
@Override
@Override
public
Factory
setDrmSessionManager
(
@Nullable
DrmSessionManager
<?>
drmSessionManager
)
{
public
Factory
setDrmSessionManager
(
@Nullable
DrmSessionManager
drmSessionManager
)
{
this
.
drmSessionManager
=
this
.
drmSessionManager
=
drmSessionManager
!=
null
drmSessionManager
!=
null
?
drmSessionManager
?
drmSessionManager
...
@@ -211,7 +211,7 @@ public final class ProgressiveMediaSource extends BaseMediaSource
...
@@ -211,7 +211,7 @@ public final class ProgressiveMediaSource extends BaseMediaSource
private
final
Uri
uri
;
private
final
Uri
uri
;
private
final
DataSource
.
Factory
dataSourceFactory
;
private
final
DataSource
.
Factory
dataSourceFactory
;
private
final
ExtractorsFactory
extractorsFactory
;
private
final
ExtractorsFactory
extractorsFactory
;
private
final
DrmSessionManager
<?>
drmSessionManager
;
private
final
DrmSessionManager
drmSessionManager
;
private
final
LoadErrorHandlingPolicy
loadableLoadErrorHandlingPolicy
;
private
final
LoadErrorHandlingPolicy
loadableLoadErrorHandlingPolicy
;
@Nullable
private
final
String
customCacheKey
;
@Nullable
private
final
String
customCacheKey
;
private
final
int
continueLoadingCheckIntervalBytes
;
private
final
int
continueLoadingCheckIntervalBytes
;
...
@@ -228,7 +228,7 @@ public final class ProgressiveMediaSource extends BaseMediaSource
...
@@ -228,7 +228,7 @@ public final class ProgressiveMediaSource extends BaseMediaSource
Uri
uri
,
Uri
uri
,
DataSource
.
Factory
dataSourceFactory
,
DataSource
.
Factory
dataSourceFactory
,
ExtractorsFactory
extractorsFactory
,
ExtractorsFactory
extractorsFactory
,
DrmSessionManager
<?>
drmSessionManager
,
DrmSessionManager
drmSessionManager
,
LoadErrorHandlingPolicy
loadableLoadErrorHandlingPolicy
,
LoadErrorHandlingPolicy
loadableLoadErrorHandlingPolicy
,
@Nullable
String
customCacheKey
,
@Nullable
String
customCacheKey
,
int
continueLoadingCheckIntervalBytes
,
int
continueLoadingCheckIntervalBytes
,
...
...
library/core/src/main/java/com/google/android/exoplayer2/source/SampleQueue.java
View file @
aa9eb5ab
...
@@ -55,12 +55,12 @@ public class SampleQueue implements TrackOutput {
...
@@ -55,12 +55,12 @@ public class SampleQueue implements TrackOutput {
private
final
SampleDataQueue
sampleDataQueue
;
private
final
SampleDataQueue
sampleDataQueue
;
private
final
SampleExtrasHolder
extrasHolder
;
private
final
SampleExtrasHolder
extrasHolder
;
private
final
DrmSessionManager
<?>
drmSessionManager
;
private
final
DrmSessionManager
drmSessionManager
;
private
final
MediaSourceEventDispatcher
eventDispatcher
;
private
final
MediaSourceEventDispatcher
eventDispatcher
;
@Nullable
private
UpstreamFormatChangedListener
upstreamFormatChangeListener
;
@Nullable
private
UpstreamFormatChangedListener
upstreamFormatChangeListener
;
@Nullable
private
Format
downstreamFormat
;
@Nullable
private
Format
downstreamFormat
;
@Nullable
private
DrmSession
<?>
currentDrmSession
;
@Nullable
private
DrmSession
currentDrmSession
;
private
int
capacity
;
private
int
capacity
;
private
int
[]
sourceIds
;
private
int
[]
sourceIds
;
...
@@ -101,7 +101,7 @@ public class SampleQueue implements TrackOutput {
...
@@ -101,7 +101,7 @@ public class SampleQueue implements TrackOutput {
*/
*/
public
SampleQueue
(
public
SampleQueue
(
Allocator
allocator
,
Allocator
allocator
,
DrmSessionManager
<?>
drmSessionManager
,
DrmSessionManager
drmSessionManager
,
MediaSourceEventDispatcher
eventDispatcher
)
{
MediaSourceEventDispatcher
eventDispatcher
)
{
sampleDataQueue
=
new
SampleDataQueue
(
allocator
);
sampleDataQueue
=
new
SampleDataQueue
(
allocator
);
this
.
drmSessionManager
=
drmSessionManager
;
this
.
drmSessionManager
=
drmSessionManager
;
...
@@ -795,7 +795,7 @@ public class SampleQueue implements TrackOutput {
...
@@ -795,7 +795,7 @@ public class SampleQueue implements TrackOutput {
}
}
// Ensure we acquire the new session before releasing the previous one in case the same session
// Ensure we acquire the new session before releasing the previous one in case the same session
// is being used for both DrmInitData.
// is being used for both DrmInitData.
@Nullable
DrmSession
<?>
previousSession
=
currentDrmSession
;
@Nullable
DrmSession
previousSession
=
currentDrmSession
;
Looper
playbackLooper
=
Assertions
.
checkNotNull
(
Looper
.
myLooper
());
Looper
playbackLooper
=
Assertions
.
checkNotNull
(
Looper
.
myLooper
());
currentDrmSession
=
currentDrmSession
=
newDrmInitData
!=
null
newDrmInitData
!=
null
...
...
library/core/src/main/java/com/google/android/exoplayer2/source/chunk/ChunkSampleStream.java
View file @
aa9eb5ab
...
@@ -110,7 +110,7 @@ public class ChunkSampleStream<T extends ChunkSource> implements SampleStream, S
...
@@ -110,7 +110,7 @@ public class ChunkSampleStream<T extends ChunkSource> implements SampleStream, S
Callback
<
ChunkSampleStream
<
T
>>
callback
,
Callback
<
ChunkSampleStream
<
T
>>
callback
,
Allocator
allocator
,
Allocator
allocator
,
long
positionUs
,
long
positionUs
,
DrmSessionManager
<?>
drmSessionManager
,
DrmSessionManager
drmSessionManager
,
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
,
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
,
EventDispatcher
eventDispatcher
)
{
EventDispatcher
eventDispatcher
)
{
this
.
primaryTrackType
=
primaryTrackType
;
this
.
primaryTrackType
=
primaryTrackType
;
...
...
library/core/src/main/java/com/google/android/exoplayer2/video/DecoderVideoRenderer.java
View file @
aa9eb5ab
...
@@ -105,8 +105,8 @@ public abstract class DecoderVideoRenderer extends BaseRenderer {
...
@@ -105,8 +105,8 @@ public abstract class DecoderVideoRenderer extends BaseRenderer {
@Nullable
private
VideoFrameMetadataListener
frameMetadataListener
;
@Nullable
private
VideoFrameMetadataListener
frameMetadataListener
;
@C
.
VideoOutputMode
private
int
outputMode
;
@C
.
VideoOutputMode
private
int
outputMode
;
@Nullable
private
DrmSession
<
ExoMediaCrypto
>
decoderDrmSession
;
@Nullable
private
DrmSession
decoderDrmSession
;
@Nullable
private
DrmSession
<
ExoMediaCrypto
>
sourceDrmSession
;
@Nullable
private
DrmSession
sourceDrmSession
;
@ReinitializationState
private
int
decoderReinitializationState
;
@ReinitializationState
private
int
decoderReinitializationState
;
private
boolean
decoderReceivedBuffers
;
private
boolean
decoderReceivedBuffers
;
...
@@ -379,7 +379,7 @@ public abstract class DecoderVideoRenderer extends BaseRenderer {
...
@@ -379,7 +379,7 @@ public abstract class DecoderVideoRenderer extends BaseRenderer {
protected
void
onInputFormatChanged
(
FormatHolder
formatHolder
)
throws
ExoPlaybackException
{
protected
void
onInputFormatChanged
(
FormatHolder
formatHolder
)
throws
ExoPlaybackException
{
waitingForFirstSampleInFormat
=
true
;
waitingForFirstSampleInFormat
=
true
;
Format
newFormat
=
Assertions
.
checkNotNull
(
formatHolder
.
format
);
Format
newFormat
=
Assertions
.
checkNotNull
(
formatHolder
.
format
);
setSourceDrmSession
(
(
DrmSession
<
ExoMediaCrypto
>)
formatHolder
.
drmSession
);
setSourceDrmSession
(
formatHolder
.
drmSession
);
inputFormat
=
newFormat
;
inputFormat
=
newFormat
;
if
(
sourceDrmSession
!=
decoderDrmSession
)
{
if
(
sourceDrmSession
!=
decoderDrmSession
)
{
...
@@ -643,12 +643,12 @@ public abstract class DecoderVideoRenderer extends BaseRenderer {
...
@@ -643,12 +643,12 @@ public abstract class DecoderVideoRenderer extends BaseRenderer {
// Internal methods.
// Internal methods.
private
void
setSourceDrmSession
(
@Nullable
DrmSession
<
ExoMediaCrypto
>
session
)
{
private
void
setSourceDrmSession
(
@Nullable
DrmSession
session
)
{
DrmSession
.
replaceSession
(
sourceDrmSession
,
session
);
DrmSession
.
replaceSession
(
sourceDrmSession
,
session
);
sourceDrmSession
=
session
;
sourceDrmSession
=
session
;
}
}
private
void
setDecoderDrmSession
(
@Nullable
DrmSession
<
ExoMediaCrypto
>
session
)
{
private
void
setDecoderDrmSession
(
@Nullable
DrmSession
session
)
{
DrmSession
.
replaceSession
(
decoderDrmSession
,
session
);
DrmSession
.
replaceSession
(
decoderDrmSession
,
session
);
decoderDrmSession
=
session
;
decoderDrmSession
=
session
;
}
}
...
@@ -891,7 +891,7 @@ public abstract class DecoderVideoRenderer extends BaseRenderer {
...
@@ -891,7 +891,7 @@ public abstract class DecoderVideoRenderer extends BaseRenderer {
}
}
private
boolean
shouldWaitForKeys
(
boolean
bufferEncrypted
)
throws
ExoPlaybackException
{
private
boolean
shouldWaitForKeys
(
boolean
bufferEncrypted
)
throws
ExoPlaybackException
{
DrmSession
<
ExoMediaCrypto
>
decoderDrmSession
=
this
.
decoderDrmSession
;
DrmSession
decoderDrmSession
=
this
.
decoderDrmSession
;
if
(
decoderDrmSession
==
null
if
(
decoderDrmSession
==
null
||
(!
bufferEncrypted
&&
decoderDrmSession
.
playClearSamplesWithoutKeys
()))
{
||
(!
bufferEncrypted
&&
decoderDrmSession
.
playClearSamplesWithoutKeys
()))
{
return
false
;
return
false
;
...
...
library/core/src/main/java/com/google/android/exoplayer2/video/MediaCodecVideoRenderer.java
View file @
aa9eb5ab
...
@@ -42,7 +42,6 @@ import com.google.android.exoplayer2.PlayerMessage.Target;
...
@@ -42,7 +42,6 @@ import com.google.android.exoplayer2.PlayerMessage.Target;
import
com.google.android.exoplayer2.RendererCapabilities
;
import
com.google.android.exoplayer2.RendererCapabilities
;
import
com.google.android.exoplayer2.decoder.DecoderInputBuffer
;
import
com.google.android.exoplayer2.decoder.DecoderInputBuffer
;
import
com.google.android.exoplayer2.drm.DrmInitData
;
import
com.google.android.exoplayer2.drm.DrmInitData
;
import
com.google.android.exoplayer2.drm.FrameworkMediaCrypto
;
import
com.google.android.exoplayer2.mediacodec.MediaCodecDecoderException
;
import
com.google.android.exoplayer2.mediacodec.MediaCodecDecoderException
;
import
com.google.android.exoplayer2.mediacodec.MediaCodecInfo
;
import
com.google.android.exoplayer2.mediacodec.MediaCodecInfo
;
import
com.google.android.exoplayer2.mediacodec.MediaCodecRenderer
;
import
com.google.android.exoplayer2.mediacodec.MediaCodecRenderer
;
...
@@ -272,9 +271,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
...
@@ -272,9 +271,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
if
(
decoderInfos
.
isEmpty
())
{
if
(
decoderInfos
.
isEmpty
())
{
return
RendererCapabilities
.
create
(
FORMAT_UNSUPPORTED_SUBTYPE
);
return
RendererCapabilities
.
create
(
FORMAT_UNSUPPORTED_SUBTYPE
);
}
}
boolean
supportsFormatDrm
=
if
(!
supportsFormatDrm
(
format
))
{
drmInitData
==
null
||
FrameworkMediaCrypto
.
class
.
equals
(
format
.
exoMediaCryptoType
);
if
(!
supportsFormatDrm
)
{
return
RendererCapabilities
.
create
(
FORMAT_UNSUPPORTED_DRM
);
return
RendererCapabilities
.
create
(
FORMAT_UNSUPPORTED_DRM
);
}
}
// Check capabilities for the first decoder in the list, which takes priority.
// Check capabilities for the first decoder in the list, which takes priority.
...
...
library/core/src/test/java/com/google/android/exoplayer2/drm/OfflineLicenseHelperTest.java
View file @
aa9eb5ab
...
@@ -40,9 +40,9 @@ import org.robolectric.annotation.LooperMode;
...
@@ -40,9 +40,9 @@ import org.robolectric.annotation.LooperMode;
@LooperMode
(
LooperMode
.
Mode
.
PAUSED
)
@LooperMode
(
LooperMode
.
Mode
.
PAUSED
)
public
class
OfflineLicenseHelperTest
{
public
class
OfflineLicenseHelperTest
{
private
OfflineLicenseHelper
<?>
offlineLicenseHelper
;
private
OfflineLicenseHelper
offlineLicenseHelper
;
@Mock
private
MediaDrmCallback
mediaDrmCallback
;
@Mock
private
MediaDrmCallback
mediaDrmCallback
;
@Mock
private
ExoMediaDrm
<
ExoMediaCrypto
>
mediaDrm
;
@Mock
private
ExoMediaDrm
mediaDrm
;
@Before
@Before
public
void
setUp
()
throws
Exception
{
public
void
setUp
()
throws
Exception
{
...
@@ -52,9 +52,9 @@ public class OfflineLicenseHelperTest {
...
@@ -52,9 +52,9 @@ public class OfflineLicenseHelperTest {
.
thenReturn
(
.
thenReturn
(
new
ExoMediaDrm
.
KeyRequest
(
/* data= */
new
byte
[
0
],
/* licenseServerUrl= */
""
));
new
ExoMediaDrm
.
KeyRequest
(
/* data= */
new
byte
[
0
],
/* licenseServerUrl= */
""
));
offlineLicenseHelper
=
offlineLicenseHelper
=
new
OfflineLicenseHelper
<>
(
new
OfflineLicenseHelper
(
C
.
WIDEVINE_UUID
,
C
.
WIDEVINE_UUID
,
new
ExoMediaDrm
.
AppManagedProvider
<>
(
mediaDrm
),
new
ExoMediaDrm
.
AppManagedProvider
(
mediaDrm
),
mediaDrmCallback
,
mediaDrmCallback
,
/* optionalKeyRequestParameters= */
null
,
/* optionalKeyRequestParameters= */
null
,
new
MediaSourceEventDispatcher
());
new
MediaSourceEventDispatcher
());
...
...
library/core/src/test/java/com/google/android/exoplayer2/source/SampleQueueTest.java
View file @
aa9eb5ab
...
@@ -35,7 +35,6 @@ import com.google.android.exoplayer2.decoder.DecoderInputBuffer;
...
@@ -35,7 +35,6 @@ import com.google.android.exoplayer2.decoder.DecoderInputBuffer;
import
com.google.android.exoplayer2.drm.DrmInitData
;
import
com.google.android.exoplayer2.drm.DrmInitData
;
import
com.google.android.exoplayer2.drm.DrmSession
;
import
com.google.android.exoplayer2.drm.DrmSession
;
import
com.google.android.exoplayer2.drm.DrmSessionManager
;
import
com.google.android.exoplayer2.drm.DrmSessionManager
;
import
com.google.android.exoplayer2.drm.ExoMediaCrypto
;
import
com.google.android.exoplayer2.extractor.TrackOutput
;
import
com.google.android.exoplayer2.extractor.TrackOutput
;
import
com.google.android.exoplayer2.testutil.TestUtil
;
import
com.google.android.exoplayer2.testutil.TestUtil
;
import
com.google.android.exoplayer2.upstream.Allocator
;
import
com.google.android.exoplayer2.upstream.Allocator
;
...
@@ -124,8 +123,8 @@ public final class SampleQueueTest {
...
@@ -124,8 +123,8 @@ public final class SampleQueueTest {
new
TrackOutput
.
CryptoData
(
C
.
CRYPTO_MODE_AES_CTR
,
new
byte
[
16
],
0
,
0
);
new
TrackOutput
.
CryptoData
(
C
.
CRYPTO_MODE_AES_CTR
,
new
byte
[
16
],
0
,
0
);
private
Allocator
allocator
;
private
Allocator
allocator
;
private
DrmSessionManager
<
ExoMediaCrypto
>
mockDrmSessionManager
;
private
DrmSessionManager
mockDrmSessionManager
;
private
DrmSession
<
ExoMediaCrypto
>
mockDrmSession
;
private
DrmSession
mockDrmSession
;
private
MediaSourceEventDispatcher
eventDispatcher
;
private
MediaSourceEventDispatcher
eventDispatcher
;
private
SampleQueue
sampleQueue
;
private
SampleQueue
sampleQueue
;
private
FormatHolder
formatHolder
;
private
FormatHolder
formatHolder
;
...
@@ -135,9 +134,8 @@ public final class SampleQueueTest {
...
@@ -135,9 +134,8 @@ public final class SampleQueueTest {
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
public
void
setUp
()
{
public
void
setUp
()
{
allocator
=
new
DefaultAllocator
(
false
,
ALLOCATION_SIZE
);
allocator
=
new
DefaultAllocator
(
false
,
ALLOCATION_SIZE
);
mockDrmSessionManager
=
mockDrmSessionManager
=
Mockito
.
mock
(
DrmSessionManager
.
class
);
(
DrmSessionManager
<
ExoMediaCrypto
>)
Mockito
.
mock
(
DrmSessionManager
.
class
);
mockDrmSession
=
Mockito
.
mock
(
DrmSession
.
class
);
mockDrmSession
=
(
DrmSession
<
ExoMediaCrypto
>)
Mockito
.
mock
(
DrmSession
.
class
);
when
(
mockDrmSessionManager
.
acquireSession
(
when
(
mockDrmSessionManager
.
acquireSession
(
ArgumentMatchers
.
any
(),
ArgumentMatchers
.
any
(),
ArgumentMatchers
.
any
()))
ArgumentMatchers
.
any
(),
ArgumentMatchers
.
any
(),
ArgumentMatchers
.
any
()))
.
thenReturn
(
mockDrmSession
);
.
thenReturn
(
mockDrmSession
);
...
@@ -418,8 +416,7 @@ public final class SampleQueueTest {
...
@@ -418,8 +416,7 @@ public final class SampleQueueTest {
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
public
void
allowPlaceholderSessionPopulatesDrmSession
()
{
public
void
allowPlaceholderSessionPopulatesDrmSession
()
{
when
(
mockDrmSession
.
getState
()).
thenReturn
(
DrmSession
.
STATE_OPENED_WITH_KEYS
);
when
(
mockDrmSession
.
getState
()).
thenReturn
(
DrmSession
.
STATE_OPENED_WITH_KEYS
);
DrmSession
<
ExoMediaCrypto
>
mockPlaceholderDrmSession
=
DrmSession
mockPlaceholderDrmSession
=
Mockito
.
mock
(
DrmSession
.
class
);
(
DrmSession
<
ExoMediaCrypto
>)
Mockito
.
mock
(
DrmSession
.
class
);
when
(
mockPlaceholderDrmSession
.
getState
()).
thenReturn
(
DrmSession
.
STATE_OPENED_WITH_KEYS
);
when
(
mockPlaceholderDrmSession
.
getState
()).
thenReturn
(
DrmSession
.
STATE_OPENED_WITH_KEYS
);
when
(
mockDrmSessionManager
.
acquirePlaceholderSession
(
when
(
mockDrmSessionManager
.
acquirePlaceholderSession
(
ArgumentMatchers
.
any
(),
ArgumentMatchers
.
anyInt
()))
ArgumentMatchers
.
any
(),
ArgumentMatchers
.
anyInt
()))
...
@@ -465,8 +462,7 @@ public final class SampleQueueTest {
...
@@ -465,8 +462,7 @@ public final class SampleQueueTest {
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
public
void
trailingCryptoInfoInitializationVectorBytesZeroed
()
{
public
void
trailingCryptoInfoInitializationVectorBytesZeroed
()
{
when
(
mockDrmSession
.
getState
()).
thenReturn
(
DrmSession
.
STATE_OPENED_WITH_KEYS
);
when
(
mockDrmSession
.
getState
()).
thenReturn
(
DrmSession
.
STATE_OPENED_WITH_KEYS
);
DrmSession
<
ExoMediaCrypto
>
mockPlaceholderDrmSession
=
DrmSession
mockPlaceholderDrmSession
=
Mockito
.
mock
(
DrmSession
.
class
);
(
DrmSession
<
ExoMediaCrypto
>)
Mockito
.
mock
(
DrmSession
.
class
);
when
(
mockPlaceholderDrmSession
.
getState
()).
thenReturn
(
DrmSession
.
STATE_OPENED_WITH_KEYS
);
when
(
mockPlaceholderDrmSession
.
getState
()).
thenReturn
(
DrmSession
.
STATE_OPENED_WITH_KEYS
);
when
(
mockDrmSessionManager
.
acquirePlaceholderSession
(
when
(
mockDrmSessionManager
.
acquirePlaceholderSession
(
ArgumentMatchers
.
any
(),
ArgumentMatchers
.
anyInt
()))
ArgumentMatchers
.
any
(),
ArgumentMatchers
.
anyInt
()))
...
...
library/dash/src/main/java/com/google/android/exoplayer2/source/dash/DashMediaPeriod.java
View file @
aa9eb5ab
...
@@ -73,7 +73,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
...
@@ -73,7 +73,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
/* package */
final
int
id
;
/* package */
final
int
id
;
private
final
DashChunkSource
.
Factory
chunkSourceFactory
;
private
final
DashChunkSource
.
Factory
chunkSourceFactory
;
@Nullable
private
final
TransferListener
transferListener
;
@Nullable
private
final
TransferListener
transferListener
;
private
final
DrmSessionManager
<?>
drmSessionManager
;
private
final
DrmSessionManager
drmSessionManager
;
private
final
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
;
private
final
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
;
private
final
long
elapsedRealtimeOffsetMs
;
private
final
long
elapsedRealtimeOffsetMs
;
private
final
LoaderErrorThrower
manifestLoaderErrorThrower
;
private
final
LoaderErrorThrower
manifestLoaderErrorThrower
;
...
@@ -101,7 +101,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
...
@@ -101,7 +101,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
int
periodIndex
,
int
periodIndex
,
DashChunkSource
.
Factory
chunkSourceFactory
,
DashChunkSource
.
Factory
chunkSourceFactory
,
@Nullable
TransferListener
transferListener
,
@Nullable
TransferListener
transferListener
,
DrmSessionManager
<?>
drmSessionManager
,
DrmSessionManager
drmSessionManager
,
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
,
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
,
EventDispatcher
eventDispatcher
,
EventDispatcher
eventDispatcher
,
long
elapsedRealtimeOffsetMs
,
long
elapsedRealtimeOffsetMs
,
...
@@ -480,7 +480,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
...
@@ -480,7 +480,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
}
}
private
static
Pair
<
TrackGroupArray
,
TrackGroupInfo
[]>
buildTrackGroups
(
private
static
Pair
<
TrackGroupArray
,
TrackGroupInfo
[]>
buildTrackGroups
(
DrmSessionManager
<?>
drmSessionManager
,
DrmSessionManager
drmSessionManager
,
List
<
AdaptationSet
>
adaptationSets
,
List
<
AdaptationSet
>
adaptationSets
,
List
<
EventStream
>
eventStreams
)
{
List
<
EventStream
>
eventStreams
)
{
int
[][]
groupedAdaptationSetIndices
=
getGroupedAdaptationSetIndices
(
adaptationSets
);
int
[][]
groupedAdaptationSetIndices
=
getGroupedAdaptationSetIndices
(
adaptationSets
);
...
@@ -598,7 +598,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
...
@@ -598,7 +598,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
}
}
private
static
int
buildPrimaryAndEmbeddedTrackGroupInfos
(
private
static
int
buildPrimaryAndEmbeddedTrackGroupInfos
(
DrmSessionManager
<?>
drmSessionManager
,
DrmSessionManager
drmSessionManager
,
List
<
AdaptationSet
>
adaptationSets
,
List
<
AdaptationSet
>
adaptationSets
,
int
[][]
groupedAdaptationSetIndices
,
int
[][]
groupedAdaptationSetIndices
,
int
primaryGroupCount
,
int
primaryGroupCount
,
...
...
library/dash/src/main/java/com/google/android/exoplayer2/source/dash/DashMediaSource.java
View file @
aa9eb5ab
...
@@ -84,7 +84,7 @@ public final class DashMediaSource extends BaseMediaSource {
...
@@ -84,7 +84,7 @@ public final class DashMediaSource extends BaseMediaSource {
private
final
DashChunkSource
.
Factory
chunkSourceFactory
;
private
final
DashChunkSource
.
Factory
chunkSourceFactory
;
@Nullable
private
final
DataSource
.
Factory
manifestDataSourceFactory
;
@Nullable
private
final
DataSource
.
Factory
manifestDataSourceFactory
;
private
DrmSessionManager
<?>
drmSessionManager
;
private
DrmSessionManager
drmSessionManager
;
private
CompositeSequenceableLoaderFactory
compositeSequenceableLoaderFactory
;
private
CompositeSequenceableLoaderFactory
compositeSequenceableLoaderFactory
;
private
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
;
private
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
;
private
long
livePresentationDelayMs
;
private
long
livePresentationDelayMs
;
...
@@ -154,7 +154,7 @@ public final class DashMediaSource extends BaseMediaSource {
...
@@ -154,7 +154,7 @@ public final class DashMediaSource extends BaseMediaSource {
* @return This factory, for convenience.
* @return This factory, for convenience.
*/
*/
@Override
@Override
public
Factory
setDrmSessionManager
(
@Nullable
DrmSessionManager
<?>
drmSessionManager
)
{
public
Factory
setDrmSessionManager
(
@Nullable
DrmSessionManager
drmSessionManager
)
{
this
.
drmSessionManager
=
this
.
drmSessionManager
=
drmSessionManager
!=
null
drmSessionManager
!=
null
?
drmSessionManager
?
drmSessionManager
...
@@ -388,7 +388,7 @@ public final class DashMediaSource extends BaseMediaSource {
...
@@ -388,7 +388,7 @@ public final class DashMediaSource extends BaseMediaSource {
private
final
DataSource
.
Factory
manifestDataSourceFactory
;
private
final
DataSource
.
Factory
manifestDataSourceFactory
;
private
final
DashChunkSource
.
Factory
chunkSourceFactory
;
private
final
DashChunkSource
.
Factory
chunkSourceFactory
;
private
final
CompositeSequenceableLoaderFactory
compositeSequenceableLoaderFactory
;
private
final
CompositeSequenceableLoaderFactory
compositeSequenceableLoaderFactory
;
private
final
DrmSessionManager
<?>
drmSessionManager
;
private
final
DrmSessionManager
drmSessionManager
;
private
final
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
;
private
final
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
;
private
final
long
livePresentationDelayMs
;
private
final
long
livePresentationDelayMs
;
private
final
boolean
livePresentationDelayOverridesManifest
;
private
final
boolean
livePresentationDelayOverridesManifest
;
...
@@ -604,7 +604,7 @@ public final class DashMediaSource extends BaseMediaSource {
...
@@ -604,7 +604,7 @@ public final class DashMediaSource extends BaseMediaSource {
@Nullable
ParsingLoadable
.
Parser
<?
extends
DashManifest
>
manifestParser
,
@Nullable
ParsingLoadable
.
Parser
<?
extends
DashManifest
>
manifestParser
,
DashChunkSource
.
Factory
chunkSourceFactory
,
DashChunkSource
.
Factory
chunkSourceFactory
,
CompositeSequenceableLoaderFactory
compositeSequenceableLoaderFactory
,
CompositeSequenceableLoaderFactory
compositeSequenceableLoaderFactory
,
DrmSessionManager
<?>
drmSessionManager
,
DrmSessionManager
drmSessionManager
,
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
,
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
,
long
livePresentationDelayMs
,
long
livePresentationDelayMs
,
boolean
livePresentationDelayOverridesManifest
,
boolean
livePresentationDelayOverridesManifest
,
...
...
library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsMediaPeriod.java
View file @
aa9eb5ab
...
@@ -67,7 +67,7 @@ public final class HlsMediaPeriod implements MediaPeriod, HlsSampleStreamWrapper
...
@@ -67,7 +67,7 @@ public final class HlsMediaPeriod implements MediaPeriod, HlsSampleStreamWrapper
private
final
HlsPlaylistTracker
playlistTracker
;
private
final
HlsPlaylistTracker
playlistTracker
;
private
final
HlsDataSourceFactory
dataSourceFactory
;
private
final
HlsDataSourceFactory
dataSourceFactory
;
@Nullable
private
final
TransferListener
mediaTransferListener
;
@Nullable
private
final
TransferListener
mediaTransferListener
;
private
final
DrmSessionManager
<?>
drmSessionManager
;
private
final
DrmSessionManager
drmSessionManager
;
private
final
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
;
private
final
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
;
private
final
EventDispatcher
eventDispatcher
;
private
final
EventDispatcher
eventDispatcher
;
private
final
Allocator
allocator
;
private
final
Allocator
allocator
;
...
@@ -112,7 +112,7 @@ public final class HlsMediaPeriod implements MediaPeriod, HlsSampleStreamWrapper
...
@@ -112,7 +112,7 @@ public final class HlsMediaPeriod implements MediaPeriod, HlsSampleStreamWrapper
HlsPlaylistTracker
playlistTracker
,
HlsPlaylistTracker
playlistTracker
,
HlsDataSourceFactory
dataSourceFactory
,
HlsDataSourceFactory
dataSourceFactory
,
@Nullable
TransferListener
mediaTransferListener
,
@Nullable
TransferListener
mediaTransferListener
,
DrmSessionManager
<?>
drmSessionManager
,
DrmSessionManager
drmSessionManager
,
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
,
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
,
EventDispatcher
eventDispatcher
,
EventDispatcher
eventDispatcher
,
Allocator
allocator
,
Allocator
allocator
,
...
...
library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsMediaSource.java
View file @
aa9eb5ab
...
@@ -95,7 +95,7 @@ public final class HlsMediaSource extends BaseMediaSource
...
@@ -95,7 +95,7 @@ public final class HlsMediaSource extends BaseMediaSource
private
HlsPlaylistParserFactory
playlistParserFactory
;
private
HlsPlaylistParserFactory
playlistParserFactory
;
private
HlsPlaylistTracker
.
Factory
playlistTrackerFactory
;
private
HlsPlaylistTracker
.
Factory
playlistTrackerFactory
;
private
CompositeSequenceableLoaderFactory
compositeSequenceableLoaderFactory
;
private
CompositeSequenceableLoaderFactory
compositeSequenceableLoaderFactory
;
private
DrmSessionManager
<?>
drmSessionManager
;
private
DrmSessionManager
drmSessionManager
;
private
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
;
private
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
;
private
boolean
allowChunklessPreparation
;
private
boolean
allowChunklessPreparation
;
@MetadataType
private
int
metadataType
;
@MetadataType
private
int
metadataType
;
...
@@ -290,7 +290,7 @@ public final class HlsMediaSource extends BaseMediaSource
...
@@ -290,7 +290,7 @@ public final class HlsMediaSource extends BaseMediaSource
* @return This factory, for convenience.
* @return This factory, for convenience.
*/
*/
@Override
@Override
public
Factory
setDrmSessionManager
(
@Nullable
DrmSessionManager
<?>
drmSessionManager
)
{
public
Factory
setDrmSessionManager
(
@Nullable
DrmSessionManager
drmSessionManager
)
{
this
.
drmSessionManager
=
this
.
drmSessionManager
=
drmSessionManager
!=
null
drmSessionManager
!=
null
?
drmSessionManager
?
drmSessionManager
...
@@ -382,7 +382,7 @@ public final class HlsMediaSource extends BaseMediaSource
...
@@ -382,7 +382,7 @@ public final class HlsMediaSource extends BaseMediaSource
private
final
Uri
manifestUri
;
private
final
Uri
manifestUri
;
private
final
HlsDataSourceFactory
dataSourceFactory
;
private
final
HlsDataSourceFactory
dataSourceFactory
;
private
final
CompositeSequenceableLoaderFactory
compositeSequenceableLoaderFactory
;
private
final
CompositeSequenceableLoaderFactory
compositeSequenceableLoaderFactory
;
private
final
DrmSessionManager
<?>
drmSessionManager
;
private
final
DrmSessionManager
drmSessionManager
;
private
final
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
;
private
final
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
;
private
final
boolean
allowChunklessPreparation
;
private
final
boolean
allowChunklessPreparation
;
private
final
@MetadataType
int
metadataType
;
private
final
@MetadataType
int
metadataType
;
...
@@ -397,7 +397,7 @@ public final class HlsMediaSource extends BaseMediaSource
...
@@ -397,7 +397,7 @@ public final class HlsMediaSource extends BaseMediaSource
HlsDataSourceFactory
dataSourceFactory
,
HlsDataSourceFactory
dataSourceFactory
,
HlsExtractorFactory
extractorFactory
,
HlsExtractorFactory
extractorFactory
,
CompositeSequenceableLoaderFactory
compositeSequenceableLoaderFactory
,
CompositeSequenceableLoaderFactory
compositeSequenceableLoaderFactory
,
DrmSessionManager
<?>
drmSessionManager
,
DrmSessionManager
drmSessionManager
,
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
,
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
,
HlsPlaylistTracker
playlistTracker
,
HlsPlaylistTracker
playlistTracker
,
boolean
allowChunklessPreparation
,
boolean
allowChunklessPreparation
,
...
...
library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsSampleStreamWrapper.java
View file @
aa9eb5ab
...
@@ -114,7 +114,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
...
@@ -114,7 +114,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
private
final
HlsChunkSource
chunkSource
;
private
final
HlsChunkSource
chunkSource
;
private
final
Allocator
allocator
;
private
final
Allocator
allocator
;
@Nullable
private
final
Format
muxedAudioFormat
;
@Nullable
private
final
Format
muxedAudioFormat
;
private
final
DrmSessionManager
<?>
drmSessionManager
;
private
final
DrmSessionManager
drmSessionManager
;
private
final
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
;
private
final
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
;
private
final
Loader
loader
;
private
final
Loader
loader
;
private
final
EventDispatcher
eventDispatcher
;
private
final
EventDispatcher
eventDispatcher
;
...
@@ -190,7 +190,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
...
@@ -190,7 +190,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
Allocator
allocator
,
Allocator
allocator
,
long
positionUs
,
long
positionUs
,
@Nullable
Format
muxedAudioFormat
,
@Nullable
Format
muxedAudioFormat
,
DrmSessionManager
<?>
drmSessionManager
,
DrmSessionManager
drmSessionManager
,
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
,
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
,
EventDispatcher
eventDispatcher
,
EventDispatcher
eventDispatcher
,
@HlsMediaSource
.
MetadataType
int
metadataType
)
{
@HlsMediaSource
.
MetadataType
int
metadataType
)
{
...
@@ -1349,7 +1349,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
...
@@ -1349,7 +1349,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
public
FormatAdjustingSampleQueue
(
public
FormatAdjustingSampleQueue
(
Allocator
allocator
,
Allocator
allocator
,
DrmSessionManager
<?>
drmSessionManager
,
DrmSessionManager
drmSessionManager
,
MediaSourceEventDispatcher
eventDispatcher
,
MediaSourceEventDispatcher
eventDispatcher
,
Map
<
String
,
DrmInitData
>
overridingDrmInitData
)
{
Map
<
String
,
DrmInitData
>
overridingDrmInitData
)
{
super
(
allocator
,
drmSessionManager
,
eventDispatcher
);
super
(
allocator
,
drmSessionManager
,
eventDispatcher
);
...
...
library/smoothstreaming/src/main/java/com/google/android/exoplayer2/source/smoothstreaming/SsMediaPeriod.java
View file @
aa9eb5ab
...
@@ -47,7 +47,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
...
@@ -47,7 +47,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
private
final
SsChunkSource
.
Factory
chunkSourceFactory
;
private
final
SsChunkSource
.
Factory
chunkSourceFactory
;
@Nullable
private
final
TransferListener
transferListener
;
@Nullable
private
final
TransferListener
transferListener
;
private
final
LoaderErrorThrower
manifestLoaderErrorThrower
;
private
final
LoaderErrorThrower
manifestLoaderErrorThrower
;
private
final
DrmSessionManager
<?>
drmSessionManager
;
private
final
DrmSessionManager
drmSessionManager
;
private
final
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
;
private
final
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
;
private
final
EventDispatcher
eventDispatcher
;
private
final
EventDispatcher
eventDispatcher
;
private
final
Allocator
allocator
;
private
final
Allocator
allocator
;
...
@@ -65,7 +65,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
...
@@ -65,7 +65,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
SsChunkSource
.
Factory
chunkSourceFactory
,
SsChunkSource
.
Factory
chunkSourceFactory
,
@Nullable
TransferListener
transferListener
,
@Nullable
TransferListener
transferListener
,
CompositeSequenceableLoaderFactory
compositeSequenceableLoaderFactory
,
CompositeSequenceableLoaderFactory
compositeSequenceableLoaderFactory
,
DrmSessionManager
<?>
drmSessionManager
,
DrmSessionManager
drmSessionManager
,
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
,
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
,
EventDispatcher
eventDispatcher
,
EventDispatcher
eventDispatcher
,
LoaderErrorThrower
manifestLoaderErrorThrower
,
LoaderErrorThrower
manifestLoaderErrorThrower
,
...
@@ -259,7 +259,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
...
@@ -259,7 +259,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
}
}
private
static
TrackGroupArray
buildTrackGroups
(
private
static
TrackGroupArray
buildTrackGroups
(
SsManifest
manifest
,
DrmSessionManager
<?>
drmSessionManager
)
{
SsManifest
manifest
,
DrmSessionManager
drmSessionManager
)
{
TrackGroup
[]
trackGroups
=
new
TrackGroup
[
manifest
.
streamElements
.
length
];
TrackGroup
[]
trackGroups
=
new
TrackGroup
[
manifest
.
streamElements
.
length
];
for
(
int
i
=
0
;
i
<
manifest
.
streamElements
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
manifest
.
streamElements
.
length
;
i
++)
{
Format
[]
manifestFormats
=
manifest
.
streamElements
[
i
].
formats
;
Format
[]
manifestFormats
=
manifest
.
streamElements
[
i
].
formats
;
...
...
library/smoothstreaming/src/main/java/com/google/android/exoplayer2/source/smoothstreaming/SsMediaSource.java
View file @
aa9eb5ab
...
@@ -72,7 +72,7 @@ public final class SsMediaSource extends BaseMediaSource
...
@@ -72,7 +72,7 @@ public final class SsMediaSource extends BaseMediaSource
@Nullable
private
final
DataSource
.
Factory
manifestDataSourceFactory
;
@Nullable
private
final
DataSource
.
Factory
manifestDataSourceFactory
;
private
CompositeSequenceableLoaderFactory
compositeSequenceableLoaderFactory
;
private
CompositeSequenceableLoaderFactory
compositeSequenceableLoaderFactory
;
private
DrmSessionManager
<?>
drmSessionManager
;
private
DrmSessionManager
drmSessionManager
;
private
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
;
private
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
;
private
long
livePresentationDelayMs
;
private
long
livePresentationDelayMs
;
@Nullable
private
ParsingLoadable
.
Parser
<?
extends
SsManifest
>
manifestParser
;
@Nullable
private
ParsingLoadable
.
Parser
<?
extends
SsManifest
>
manifestParser
;
...
@@ -197,7 +197,7 @@ public final class SsMediaSource extends BaseMediaSource
...
@@ -197,7 +197,7 @@ public final class SsMediaSource extends BaseMediaSource
* @return This factory, for convenience.
* @return This factory, for convenience.
*/
*/
@Override
@Override
public
Factory
setDrmSessionManager
(
@Nullable
DrmSessionManager
<?>
drmSessionManager
)
{
public
Factory
setDrmSessionManager
(
@Nullable
DrmSessionManager
drmSessionManager
)
{
this
.
drmSessionManager
=
this
.
drmSessionManager
=
drmSessionManager
!=
null
drmSessionManager
!=
null
?
drmSessionManager
?
drmSessionManager
...
@@ -346,7 +346,7 @@ public final class SsMediaSource extends BaseMediaSource
...
@@ -346,7 +346,7 @@ public final class SsMediaSource extends BaseMediaSource
private
final
DataSource
.
Factory
manifestDataSourceFactory
;
private
final
DataSource
.
Factory
manifestDataSourceFactory
;
private
final
SsChunkSource
.
Factory
chunkSourceFactory
;
private
final
SsChunkSource
.
Factory
chunkSourceFactory
;
private
final
CompositeSequenceableLoaderFactory
compositeSequenceableLoaderFactory
;
private
final
CompositeSequenceableLoaderFactory
compositeSequenceableLoaderFactory
;
private
final
DrmSessionManager
<?>
drmSessionManager
;
private
final
DrmSessionManager
drmSessionManager
;
private
final
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
;
private
final
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
;
private
final
long
livePresentationDelayMs
;
private
final
long
livePresentationDelayMs
;
private
final
EventDispatcher
manifestEventDispatcher
;
private
final
EventDispatcher
manifestEventDispatcher
;
...
@@ -529,7 +529,7 @@ public final class SsMediaSource extends BaseMediaSource
...
@@ -529,7 +529,7 @@ public final class SsMediaSource extends BaseMediaSource
@Nullable
ParsingLoadable
.
Parser
<?
extends
SsManifest
>
manifestParser
,
@Nullable
ParsingLoadable
.
Parser
<?
extends
SsManifest
>
manifestParser
,
SsChunkSource
.
Factory
chunkSourceFactory
,
SsChunkSource
.
Factory
chunkSourceFactory
,
CompositeSequenceableLoaderFactory
compositeSequenceableLoaderFactory
,
CompositeSequenceableLoaderFactory
compositeSequenceableLoaderFactory
,
DrmSessionManager
<?>
drmSessionManager
,
DrmSessionManager
drmSessionManager
,
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
,
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
,
long
livePresentationDelayMs
,
long
livePresentationDelayMs
,
@Nullable
Object
tag
)
{
@Nullable
Object
tag
)
{
...
...
playbacktests/src/androidTest/java/com/google/android/exoplayer2/playbacktests/gts/DashTestRunner.java
View file @
aa9eb5ab
...
@@ -29,7 +29,6 @@ import com.google.android.exoplayer2.SimpleExoPlayer;
...
@@ -29,7 +29,6 @@ import com.google.android.exoplayer2.SimpleExoPlayer;
import
com.google.android.exoplayer2.decoder.DecoderCounters
;
import
com.google.android.exoplayer2.decoder.DecoderCounters
;
import
com.google.android.exoplayer2.drm.DefaultDrmSessionManager
;
import
com.google.android.exoplayer2.drm.DefaultDrmSessionManager
;
import
com.google.android.exoplayer2.drm.DrmSessionManager
;
import
com.google.android.exoplayer2.drm.DrmSessionManager
;
import
com.google.android.exoplayer2.drm.FrameworkMediaCrypto
;
import
com.google.android.exoplayer2.drm.FrameworkMediaDrm
;
import
com.google.android.exoplayer2.drm.FrameworkMediaDrm
;
import
com.google.android.exoplayer2.drm.HttpMediaDrmCallback
;
import
com.google.android.exoplayer2.drm.HttpMediaDrmCallback
;
import
com.google.android.exoplayer2.drm.MediaDrmCallback
;
import
com.google.android.exoplayer2.drm.MediaDrmCallback
;
...
@@ -256,8 +255,7 @@ import java.util.List;
...
@@ -256,8 +255,7 @@ import java.util.List;
}
}
@Override
@Override
protected
DrmSessionManager
<
FrameworkMediaCrypto
>
buildDrmSessionManager
(
protected
DrmSessionManager
buildDrmSessionManager
(
final
String
userAgent
)
{
final
String
userAgent
)
{
if
(
widevineLicenseUrl
==
null
)
{
if
(
widevineLicenseUrl
==
null
)
{
return
DrmSessionManager
.
getDummyDrmSessionManager
();
return
DrmSessionManager
.
getDummyDrmSessionManager
();
}
}
...
@@ -265,8 +263,8 @@ import java.util.List;
...
@@ -265,8 +263,8 @@ import java.util.List;
MediaDrmCallback
drmCallback
=
new
HttpMediaDrmCallback
(
widevineLicenseUrl
,
MediaDrmCallback
drmCallback
=
new
HttpMediaDrmCallback
(
widevineLicenseUrl
,
new
DefaultHttpDataSourceFactory
(
userAgent
));
new
DefaultHttpDataSourceFactory
(
userAgent
));
FrameworkMediaDrm
frameworkMediaDrm
=
FrameworkMediaDrm
.
newInstance
(
WIDEVINE_UUID
);
FrameworkMediaDrm
frameworkMediaDrm
=
FrameworkMediaDrm
.
newInstance
(
WIDEVINE_UUID
);
DefaultDrmSessionManager
<
FrameworkMediaCrypto
>
drmSessionManager
=
DefaultDrmSessionManager
drmSessionManager
=
new
DefaultDrmSessionManager
<>
(
new
DefaultDrmSessionManager
(
C
.
WIDEVINE_UUID
,
C
.
WIDEVINE_UUID
,
frameworkMediaDrm
,
frameworkMediaDrm
,
drmCallback
,
drmCallback
,
...
@@ -299,7 +297,7 @@ import java.util.List;
...
@@ -299,7 +297,7 @@ import java.util.List;
@Override
@Override
protected
MediaSource
buildSource
(
protected
MediaSource
buildSource
(
HostActivity
host
,
String
userAgent
,
DrmSessionManager
<?>
drmSessionManager
)
{
HostActivity
host
,
String
userAgent
,
DrmSessionManager
drmSessionManager
)
{
DataSource
.
Factory
dataSourceFactory
=
DataSource
.
Factory
dataSourceFactory
=
this
.
dataSourceFactory
!=
null
this
.
dataSourceFactory
!=
null
?
this
.
dataSourceFactory
?
this
.
dataSourceFactory
...
...
playbacktests/src/androidTest/java/com/google/android/exoplayer2/playbacktests/gts/DashWidevineOfflineTest.java
View file @
aa9eb5ab
...
@@ -27,7 +27,6 @@ import androidx.test.rule.ActivityTestRule;
...
@@ -27,7 +27,6 @@ import androidx.test.rule.ActivityTestRule;
import
com.google.android.exoplayer2.Player
;
import
com.google.android.exoplayer2.Player
;
import
com.google.android.exoplayer2.drm.DrmInitData
;
import
com.google.android.exoplayer2.drm.DrmInitData
;
import
com.google.android.exoplayer2.drm.DrmSession.DrmSessionException
;
import
com.google.android.exoplayer2.drm.DrmSession.DrmSessionException
;
import
com.google.android.exoplayer2.drm.ExoMediaCrypto
;
import
com.google.android.exoplayer2.drm.OfflineLicenseHelper
;
import
com.google.android.exoplayer2.drm.OfflineLicenseHelper
;
import
com.google.android.exoplayer2.source.dash.DashUtil
;
import
com.google.android.exoplayer2.source.dash.DashUtil
;
import
com.google.android.exoplayer2.source.dash.manifest.DashManifest
;
import
com.google.android.exoplayer2.source.dash.manifest.DashManifest
;
...
@@ -54,7 +53,7 @@ public final class DashWidevineOfflineTest {
...
@@ -54,7 +53,7 @@ public final class DashWidevineOfflineTest {
private
DashTestRunner
testRunner
;
private
DashTestRunner
testRunner
;
private
DefaultHttpDataSourceFactory
httpDataSourceFactory
;
private
DefaultHttpDataSourceFactory
httpDataSourceFactory
;
private
OfflineLicenseHelper
<
ExoMediaCrypto
>
offlineLicenseHelper
;
private
OfflineLicenseHelper
offlineLicenseHelper
;
private
byte
[]
offlineLicenseKeySetId
;
private
byte
[]
offlineLicenseKeySetId
;
@Rule
public
ActivityTestRule
<
HostActivity
>
testRule
=
new
ActivityTestRule
<>(
HostActivity
.
class
);
@Rule
public
ActivityTestRule
<
HostActivity
>
testRule
=
new
ActivityTestRule
<>(
HostActivity
.
class
);
...
...
testutils/src/main/java/com/google/android/exoplayer2/testutil/ExoHostedTest.java
View file @
aa9eb5ab
...
@@ -31,7 +31,6 @@ import com.google.android.exoplayer2.analytics.AnalyticsListener;
...
@@ -31,7 +31,6 @@ import com.google.android.exoplayer2.analytics.AnalyticsListener;
import
com.google.android.exoplayer2.audio.DefaultAudioSink
;
import
com.google.android.exoplayer2.audio.DefaultAudioSink
;
import
com.google.android.exoplayer2.decoder.DecoderCounters
;
import
com.google.android.exoplayer2.decoder.DecoderCounters
;
import
com.google.android.exoplayer2.drm.DrmSessionManager
;
import
com.google.android.exoplayer2.drm.DrmSessionManager
;
import
com.google.android.exoplayer2.drm.FrameworkMediaCrypto
;
import
com.google.android.exoplayer2.source.MediaSource
;
import
com.google.android.exoplayer2.source.MediaSource
;
import
com.google.android.exoplayer2.testutil.HostActivity.HostedTest
;
import
com.google.android.exoplayer2.testutil.HostActivity.HostedTest
;
import
com.google.android.exoplayer2.trackselection.DefaultTrackSelector
;
import
com.google.android.exoplayer2.trackselection.DefaultTrackSelector
;
...
@@ -142,7 +141,7 @@ public abstract class ExoHostedTest implements AnalyticsListener, HostedTest {
...
@@ -142,7 +141,7 @@ public abstract class ExoHostedTest implements AnalyticsListener, HostedTest {
pendingSchedule
.
start
(
player
,
trackSelector
,
surface
,
actionHandler
,
/* callback= */
null
);
pendingSchedule
.
start
(
player
,
trackSelector
,
surface
,
actionHandler
,
/* callback= */
null
);
pendingSchedule
=
null
;
pendingSchedule
=
null
;
}
}
DrmSessionManager
<
FrameworkMediaCrypto
>
drmSessionManager
=
buildDrmSessionManager
(
userAgent
);
DrmSessionManager
drmSessionManager
=
buildDrmSessionManager
(
userAgent
);
player
.
setMediaSource
(
buildSource
(
host
,
Util
.
getUserAgent
(
host
,
userAgent
),
drmSessionManager
));
player
.
setMediaSource
(
buildSource
(
host
,
Util
.
getUserAgent
(
host
,
userAgent
),
drmSessionManager
));
player
.
prepare
();
player
.
prepare
();
}
}
...
@@ -232,7 +231,7 @@ public abstract class ExoHostedTest implements AnalyticsListener, HostedTest {
...
@@ -232,7 +231,7 @@ public abstract class ExoHostedTest implements AnalyticsListener, HostedTest {
return
true
;
return
true
;
}
}
protected
DrmSessionManager
<
FrameworkMediaCrypto
>
buildDrmSessionManager
(
String
userAgent
)
{
protected
DrmSessionManager
buildDrmSessionManager
(
String
userAgent
)
{
// Do nothing. Interested subclasses may override.
// Do nothing. Interested subclasses may override.
return
DrmSessionManager
.
getDummyDrmSessionManager
();
return
DrmSessionManager
.
getDummyDrmSessionManager
();
}
}
...
@@ -255,7 +254,7 @@ public abstract class ExoHostedTest implements AnalyticsListener, HostedTest {
...
@@ -255,7 +254,7 @@ public abstract class ExoHostedTest implements AnalyticsListener, HostedTest {
}
}
protected
abstract
MediaSource
buildSource
(
protected
abstract
MediaSource
buildSource
(
HostActivity
host
,
String
userAgent
,
DrmSessionManager
<?>
drmSessionManager
);
HostActivity
host
,
String
userAgent
,
DrmSessionManager
drmSessionManager
);
protected
void
onPlayerErrorInternal
(
ExoPlaybackException
error
)
{
protected
void
onPlayerErrorInternal
(
ExoPlaybackException
error
)
{
// Do nothing. Interested subclasses may override.
// Do nothing. Interested subclasses may override.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment