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
b0ddef5b
authored
Jul 01, 2021
by
aquilescanta
Committed by
kim-vde
Jul 09, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Assign DRM error codes
PiperOrigin-RevId: 382527115
parent
c1995745
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
72 additions
and
2 deletions
library/common/src/main/java/com/google/android/exoplayer2/PlaybackException.java
library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImplInternal.java
library/common/src/main/java/com/google/android/exoplayer2/PlaybackException.java
View file @
b0ddef5b
...
@@ -67,6 +67,7 @@ public class PlaybackException extends Exception implements Bundleable {
...
@@ -67,6 +67,7 @@ public class PlaybackException extends Exception implements Bundleable {
ERROR_CODE_DECODING_FORMAT_UNSUPPORTED
,
ERROR_CODE_DECODING_FORMAT_UNSUPPORTED
,
ERROR_CODE_AUDIO_TRACK_INIT_FAILED
,
ERROR_CODE_AUDIO_TRACK_INIT_FAILED
,
ERROR_CODE_AUDIO_TRACK_WRITE_FAILED
,
ERROR_CODE_AUDIO_TRACK_WRITE_FAILED
,
ERROR_CODE_DRM_UNSPECIFIED
,
ERROR_CODE_DRM_SCHEME_UNSUPPORTED
,
ERROR_CODE_DRM_SCHEME_UNSUPPORTED
,
ERROR_CODE_DRM_PROVISIONING_FAILED
,
ERROR_CODE_DRM_PROVISIONING_FAILED
,
ERROR_CODE_DRM_CONTENT_ERROR
,
ERROR_CODE_DRM_CONTENT_ERROR
,
...
@@ -163,6 +164,8 @@ public class PlaybackException extends Exception implements Bundleable {
...
@@ -163,6 +164,8 @@ public class PlaybackException extends Exception implements Bundleable {
// DRM errors (6xxx).
// DRM errors (6xxx).
/** Caused by an unspecified error related to DRM protection. */
public
static
final
int
ERROR_CODE_DRM_UNSPECIFIED
=
6000
;
/**
/**
* Caused by a chosen DRM protection scheme not being supported by the device. Examples of DRM
* Caused by a chosen DRM protection scheme not being supported by the device. Examples of DRM
* protection schemes are ClearKey and Widevine.
* protection schemes are ClearKey and Widevine.
...
@@ -238,6 +241,8 @@ public class PlaybackException extends Exception implements Bundleable {
...
@@ -238,6 +241,8 @@ public class PlaybackException extends Exception implements Bundleable {
return
"ERROR_CODE_AUDIO_TRACK_INIT_FAILED"
;
return
"ERROR_CODE_AUDIO_TRACK_INIT_FAILED"
;
case
ERROR_CODE_AUDIO_TRACK_WRITE_FAILED:
case
ERROR_CODE_AUDIO_TRACK_WRITE_FAILED:
return
"ERROR_CODE_AUDIO_TRACK_WRITE_FAILED"
;
return
"ERROR_CODE_AUDIO_TRACK_WRITE_FAILED"
;
case
ERROR_CODE_DRM_UNSPECIFIED:
return
"ERROR_CODE_DRM_UNSPECIFIED"
;
case
ERROR_CODE_DRM_SCHEME_UNSUPPORTED:
case
ERROR_CODE_DRM_SCHEME_UNSUPPORTED:
return
"ERROR_CODE_DRM_SCHEME_UNSUPPORTED"
;
return
"ERROR_CODE_DRM_SCHEME_UNSUPPORTED"
;
case
ERROR_CODE_DRM_PROVISIONING_FAILED:
case
ERROR_CODE_DRM_PROVISIONING_FAILED:
...
...
library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImplInternal.java
View file @
b0ddef5b
...
@@ -19,6 +19,10 @@ import static com.google.android.exoplayer2.util.Util.castNonNull;
...
@@ -19,6 +19,10 @@ import static com.google.android.exoplayer2.util.Util.castNonNull;
import
static
java
.
lang
.
Math
.
max
;
import
static
java
.
lang
.
Math
.
max
;
import
static
java
.
lang
.
Math
.
min
;
import
static
java
.
lang
.
Math
.
min
;
import
android.media.DeniedByServerException
;
import
android.media.MediaDrm
;
import
android.media.MediaDrmResetException
;
import
android.media.NotProvisionedException
;
import
android.os.Handler
;
import
android.os.Handler
;
import
android.os.HandlerThread
;
import
android.os.HandlerThread
;
import
android.os.Looper
;
import
android.os.Looper
;
...
@@ -39,6 +43,9 @@ import com.google.android.exoplayer2.Player.PlayWhenReadyChangeReason;
...
@@ -39,6 +43,9 @@ import com.google.android.exoplayer2.Player.PlayWhenReadyChangeReason;
import
com.google.android.exoplayer2.Player.PlaybackSuppressionReason
;
import
com.google.android.exoplayer2.Player.PlaybackSuppressionReason
;
import
com.google.android.exoplayer2.Player.RepeatMode
;
import
com.google.android.exoplayer2.Player.RepeatMode
;
import
com.google.android.exoplayer2.analytics.AnalyticsCollector
;
import
com.google.android.exoplayer2.analytics.AnalyticsCollector
;
import
com.google.android.exoplayer2.drm.DefaultDrmSessionManager
;
import
com.google.android.exoplayer2.drm.DrmSession
;
import
com.google.android.exoplayer2.drm.UnsupportedDrmException
;
import
com.google.android.exoplayer2.metadata.Metadata
;
import
com.google.android.exoplayer2.metadata.Metadata
;
import
com.google.android.exoplayer2.source.BehindLiveWindowException
;
import
com.google.android.exoplayer2.source.BehindLiveWindowException
;
import
com.google.android.exoplayer2.source.MediaPeriod
;
import
com.google.android.exoplayer2.source.MediaPeriod
;
...
@@ -582,11 +589,34 @@ import java.util.concurrent.atomic.AtomicBoolean;
...
@@ -582,11 +589,34 @@ import java.util.concurrent.atomic.AtomicBoolean;
stopInternal
(
/* forceResetRenderers= */
true
,
/* acknowledgeStop= */
false
);
stopInternal
(
/* forceResetRenderers= */
true
,
/* acknowledgeStop= */
false
);
playbackInfo
=
playbackInfo
.
copyWithPlaybackError
(
e
);
playbackInfo
=
playbackInfo
.
copyWithPlaybackError
(
e
);
}
}
}
catch
(
DrmSession
.
DrmSessionException
e
)
{
@Nullable
Throwable
cause
=
e
.
getCause
();
@ErrorCode
int
errorCode
;
if
(
Util
.
SDK_INT
>=
21
&&
PlatformOperationsWrapperV21
.
isMediaDrmStateException
(
cause
))
{
errorCode
=
PlatformOperationsWrapperV21
.
mediaDrmStateExceptionToErrorCode
(
cause
);
}
else
if
(
Util
.
SDK_INT
>=
23
&&
PlaformOperationsWrapperV23
.
isMediaDrmResetException
(
cause
))
{
errorCode
=
PlaybackException
.
ERROR_CODE_DRM_SYSTEM_ERROR
;
}
else
if
(
Util
.
SDK_INT
>=
18
&&
PlaformOperationsWrapperV18
.
isNotProvisionedException
(
cause
))
{
errorCode
=
PlaybackException
.
ERROR_CODE_DRM_PROVISIONING_FAILED
;
}
else
if
(
Util
.
SDK_INT
>=
18
&&
PlaformOperationsWrapperV18
.
isDeniedByServerException
(
cause
))
{
errorCode
=
PlaybackException
.
ERROR_CODE_DRM_DEVICE_REVOKED
;
}
else
if
(
cause
instanceof
UnsupportedDrmException
)
{
errorCode
=
PlaybackException
.
ERROR_CODE_DRM_SCHEME_UNSUPPORTED
;
}
else
if
(
cause
instanceof
DefaultDrmSessionManager
.
MissingSchemeDataException
)
{
errorCode
=
PlaybackException
.
ERROR_CODE_DRM_CONTENT_ERROR
;
}
else
{
errorCode
=
PlaybackException
.
ERROR_CODE_DRM_UNSPECIFIED
;
}
handleIoException
(
e
,
errorCode
);
}
catch
(
FileDataSource
.
FileDataSourceException
e
)
{
}
catch
(
FileDataSource
.
FileDataSourceException
e
)
{
@Nullable
Throwable
cause
=
e
.
getCause
();
@Nullable
Throwable
cause
=
e
.
getCause
();
@ErrorCode
int
errorCode
;
@ErrorCode
int
errorCode
;
if
(
cause
instanceof
FileNotFoundException
)
{
if
(
cause
instanceof
FileNotFoundException
)
{
if
(
Util
.
SDK_INT
>=
21
&&
ErrnoExceptionWrapperV21
.
isPermissionError
(
cause
.
getCause
()))
{
if
(
Util
.
SDK_INT
>=
21
&&
PlatformOperationsWrapperV21
.
isPermissionError
(
cause
.
getCause
()))
{
errorCode
=
PlaybackException
.
ERROR_CODE_IO_NO_PERMISSION
;
errorCode
=
PlaybackException
.
ERROR_CODE_IO_NO_PERMISSION
;
}
else
{
}
else
{
errorCode
=
PlaybackException
.
ERROR_CODE_IO_FILE_NOT_FOUND
;
errorCode
=
PlaybackException
.
ERROR_CODE_IO_FILE_NOT_FOUND
;
...
@@ -3062,12 +3092,47 @@ import java.util.concurrent.atomic.AtomicBoolean;
...
@@ -3062,12 +3092,47 @@ import java.util.concurrent.atomic.AtomicBoolean;
}
}
}
}
@RequiresApi
(
18
)
private
static
final
class
PlaformOperationsWrapperV18
{
@DoNotInline
public
static
boolean
isNotProvisionedException
(
@Nullable
Throwable
throwable
)
{
return
throwable
instanceof
NotProvisionedException
;
}
@DoNotInline
public
static
boolean
isDeniedByServerException
(
@Nullable
Throwable
throwable
)
{
return
throwable
instanceof
DeniedByServerException
;
}
}
@RequiresApi
(
21
)
@RequiresApi
(
21
)
private
static
final
class
ErrnoException
WrapperV21
{
private
static
final
class
PlatformOperations
WrapperV21
{
@DoNotInline
@DoNotInline
public
static
boolean
isPermissionError
(
@Nullable
Throwable
e
)
{
public
static
boolean
isPermissionError
(
@Nullable
Throwable
e
)
{
return
e
instanceof
ErrnoException
&&
((
ErrnoException
)
e
).
errno
==
OsConstants
.
EACCES
;
return
e
instanceof
ErrnoException
&&
((
ErrnoException
)
e
).
errno
==
OsConstants
.
EACCES
;
}
}
@DoNotInline
public
static
boolean
isMediaDrmStateException
(
@Nullable
Throwable
throwable
)
{
return
throwable
instanceof
MediaDrm
.
MediaDrmStateException
;
}
@DoNotInline
public
static
int
mediaDrmStateExceptionToErrorCode
(
Throwable
throwable
)
{
@Nullable
String
diagnosticsInfo
=
((
MediaDrm
.
MediaDrmStateException
)
throwable
).
getDiagnosticInfo
();
return
Util
.
getErrorCodeFromPlatformDiagnosticsInfo
(
diagnosticsInfo
);
}
}
@RequiresApi
(
23
)
private
static
final
class
PlaformOperationsWrapperV23
{
@DoNotInline
public
static
boolean
isMediaDrmResetException
(
@Nullable
Throwable
throwable
)
{
return
throwable
instanceof
MediaDrmResetException
;
}
}
}
}
}
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