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
54283746
authored
Feb 19, 2020
by
olly
Committed by
Oliver Woodman
Feb 25, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Fix lint errors
PiperOrigin-RevId: 295953956
parent
1f905434
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
57 additions
and
29 deletions
constants.gradle
demos/gl/src/main/java/com/google/android/exoplayer2/gldemo/VideoProcessingGLSurfaceView.java
library/common/src/main/java/com/google/android/exoplayer2/util/Util.java
library/common/src/test/java/com/google/android/exoplayer2/util/UtilTest.java
library/core/src/main/java/com/google/android/exoplayer2/audio/AudioTimestampPoller.java
library/core/src/main/java/com/google/android/exoplayer2/audio/DefaultAudioSink.java
library/core/src/main/java/com/google/android/exoplayer2/mediacodec/DedicatedThreadAsyncMediaCodecAdapter.java
library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecInfo.java
library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java
library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MultiLockAsyncMediaCodecAdapter.java
library/core/src/main/java/com/google/android/exoplayer2/util/GlUtil.java
library/core/src/main/java/com/google/android/exoplayer2/video/MediaCodecVideoRenderer.java
library/core/src/main/java/com/google/android/exoplayer2/video/VideoFrameReleaseTimeHelper.java
library/ui/src/main/java/com/google/android/exoplayer2/ui/DefaultTimeBar.java
testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeExtractorOutput.java
constants.gradle
View file @
54283746
...
@@ -17,7 +17,7 @@ project.ext {
...
@@ -17,7 +17,7 @@ project.ext {
releaseVersionCode
=
2011003
releaseVersionCode
=
2011003
minSdkVersion
=
16
minSdkVersion
=
16
appTargetSdkVersion
=
29
appTargetSdkVersion
=
29
targetSdkVersion
=
28
// TODO: Bump once b/143232359 is resolved
targetSdkVersion
=
28
// TODO: Bump once b/143232359 is resolved
. Also fix TODOs in UtilTest.
compileSdkVersion
=
29
compileSdkVersion
=
29
dexmakerVersion
=
'2.21.0'
dexmakerVersion
=
'2.21.0'
junitVersion
=
'4.13-rc-2'
junitVersion
=
'4.13-rc-2'
...
...
demos/gl/src/main/java/com/google/android/exoplayer2/gldemo/VideoProcessingGLSurfaceView.java
View file @
54283746
...
@@ -83,6 +83,7 @@ public final class VideoProcessingGLSurfaceView extends GLSurfaceView {
...
@@ -83,6 +83,7 @@ public final class VideoProcessingGLSurfaceView extends GLSurfaceView {
* created, if supported by the device.
* created, if supported by the device.
* @param videoProcessor Processor that draws to the view.
* @param videoProcessor Processor that draws to the view.
*/
*/
@SuppressWarnings
(
"InlinedApi"
)
public
VideoProcessingGLSurfaceView
(
public
VideoProcessingGLSurfaceView
(
Context
context
,
boolean
requireSecureContext
,
VideoProcessor
videoProcessor
)
{
Context
context
,
boolean
requireSecureContext
,
VideoProcessor
videoProcessor
)
{
super
(
context
);
super
(
context
);
...
...
library/common/src/main/java/com/google/android/exoplayer2/util/Util.java
View file @
54283746
...
@@ -19,7 +19,6 @@ import static android.content.Context.UI_MODE_SERVICE;
...
@@ -19,7 +19,6 @@ import static android.content.Context.UI_MODE_SERVICE;
import
android.Manifest.permission
;
import
android.Manifest.permission
;
import
android.annotation.SuppressLint
;
import
android.annotation.SuppressLint
;
import
android.annotation.TargetApi
;
import
android.app.Activity
;
import
android.app.Activity
;
import
android.app.UiModeManager
;
import
android.app.UiModeManager
;
import
android.content.ComponentName
;
import
android.content.ComponentName
;
...
@@ -179,7 +178,6 @@ public final class Util {
...
@@ -179,7 +178,6 @@ public final class Util {
* @param uris {@link Uri}s that may require {@link permission#READ_EXTERNAL_STORAGE} to read.
* @param uris {@link Uri}s that may require {@link permission#READ_EXTERNAL_STORAGE} to read.
* @return Whether a permission request was made.
* @return Whether a permission request was made.
*/
*/
@TargetApi
(
23
)
public
static
boolean
maybeRequestReadExternalStoragePermission
(
Activity
activity
,
Uri
...
uris
)
{
public
static
boolean
maybeRequestReadExternalStoragePermission
(
Activity
activity
,
Uri
...
uris
)
{
if
(
Util
.
SDK_INT
<
23
)
{
if
(
Util
.
SDK_INT
<
23
)
{
return
false
;
return
false
;
...
@@ -204,7 +202,6 @@ public final class Util {
...
@@ -204,7 +202,6 @@ public final class Util {
* @param uris A list of URIs that will be loaded.
* @param uris A list of URIs that will be loaded.
* @return Whether it may be possible to load the given URIs.
* @return Whether it may be possible to load the given URIs.
*/
*/
@TargetApi
(
24
)
public
static
boolean
checkCleartextTrafficPermitted
(
Uri
...
uris
)
{
public
static
boolean
checkCleartextTrafficPermitted
(
Uri
...
uris
)
{
if
(
Util
.
SDK_INT
<
24
)
{
if
(
Util
.
SDK_INT
<
24
)
{
// We assume cleartext traffic is permitted.
// We assume cleartext traffic is permitted.
...
...
library/common/src/test/java/com/google/android/exoplayer2/util/UtilTest.java
View file @
54283746
...
@@ -784,8 +784,9 @@ public class UtilTest {
...
@@ -784,8 +784,9 @@ public class UtilTest {
assertThat
(
Arrays
.
copyOf
(
output
.
data
,
output
.
limit
())).
isEqualTo
(
testData
);
assertThat
(
Arrays
.
copyOf
(
output
.
data
,
output
.
limit
())).
isEqualTo
(
testData
);
}
}
// TODO: Revert to @Config(sdk = Config.ALL_SDKS) once b/143232359 is resolved
@Test
@Test
@Config
(
sdk
=
Config
.
ALL_SDKS
)
@Config
(
minSdk
=
Config
.
OLDEST_SDK
,
maxSdk
=
Config
.
TARGET_SDK
)
public
void
normalizeLanguageCode_keepsUndefinedTagsUnchanged
()
{
public
void
normalizeLanguageCode_keepsUndefinedTagsUnchanged
()
{
assertThat
(
Util
.
normalizeLanguageCode
(
null
)).
isNull
();
assertThat
(
Util
.
normalizeLanguageCode
(
null
)).
isNull
();
assertThat
(
Util
.
normalizeLanguageCode
(
""
)).
isEmpty
();
assertThat
(
Util
.
normalizeLanguageCode
(
""
)).
isEmpty
();
...
@@ -793,8 +794,9 @@ public class UtilTest {
...
@@ -793,8 +794,9 @@ public class UtilTest {
assertThat
(
Util
.
normalizeLanguageCode
(
"DoesNotExist"
)).
isEqualTo
(
"doesnotexist"
);
assertThat
(
Util
.
normalizeLanguageCode
(
"DoesNotExist"
)).
isEqualTo
(
"doesnotexist"
);
}
}
// TODO: Revert to @Config(sdk = Config.ALL_SDKS) once b/143232359 is resolved
@Test
@Test
@Config
(
sdk
=
Config
.
ALL_SDKS
)
@Config
(
minSdk
=
Config
.
OLDEST_SDK
,
maxSdk
=
Config
.
TARGET_SDK
)
public
void
normalizeLanguageCode_normalizesCodeToTwoLetterISOAndLowerCase_keepingAllSubtags
()
{
public
void
normalizeLanguageCode_normalizesCodeToTwoLetterISOAndLowerCase_keepingAllSubtags
()
{
assertThat
(
Util
.
normalizeLanguageCode
(
"es"
)).
isEqualTo
(
"es"
);
assertThat
(
Util
.
normalizeLanguageCode
(
"es"
)).
isEqualTo
(
"es"
);
assertThat
(
Util
.
normalizeLanguageCode
(
"spa"
)).
isEqualTo
(
"es"
);
assertThat
(
Util
.
normalizeLanguageCode
(
"spa"
)).
isEqualTo
(
"es"
);
...
@@ -812,8 +814,9 @@ public class UtilTest {
...
@@ -812,8 +814,9 @@ public class UtilTest {
assertThat
(
Util
.
normalizeLanguageCode
(
"sv-illegalSubtag"
)).
isEqualTo
(
"sv-illegalsubtag"
);
assertThat
(
Util
.
normalizeLanguageCode
(
"sv-illegalSubtag"
)).
isEqualTo
(
"sv-illegalsubtag"
);
}
}
// TODO: Revert to @Config(sdk = Config.ALL_SDKS) once b/143232359 is resolved
@Test
@Test
@Config
(
sdk
=
Config
.
ALL_SDKS
)
@Config
(
minSdk
=
Config
.
OLDEST_SDK
,
maxSdk
=
Config
.
TARGET_SDK
)
public
void
normalizeLanguageCode_iso6392BibliographicalAndTextualCodes_areNormalizedToSameTag
()
{
public
void
normalizeLanguageCode_iso6392BibliographicalAndTextualCodes_areNormalizedToSameTag
()
{
// See https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes.
// See https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes.
assertThat
(
Util
.
normalizeLanguageCode
(
"alb"
)).
isEqualTo
(
Util
.
normalizeLanguageCode
(
"sqi"
));
assertThat
(
Util
.
normalizeLanguageCode
(
"alb"
)).
isEqualTo
(
Util
.
normalizeLanguageCode
(
"sqi"
));
...
@@ -839,8 +842,9 @@ public class UtilTest {
...
@@ -839,8 +842,9 @@ public class UtilTest {
assertThat
(
Util
.
normalizeLanguageCode
(
"wel"
)).
isEqualTo
(
Util
.
normalizeLanguageCode
(
"cym"
));
assertThat
(
Util
.
normalizeLanguageCode
(
"wel"
)).
isEqualTo
(
Util
.
normalizeLanguageCode
(
"cym"
));
}
}
// TODO: Revert to @Config(sdk = Config.ALL_SDKS) once b/143232359 is resolved
@Test
@Test
@Config
(
sdk
=
Config
.
ALL_SDKS
)
@Config
(
minSdk
=
Config
.
OLDEST_SDK
,
maxSdk
=
Config
.
TARGET_SDK
)
public
void
public
void
normalizeLanguageCode_deprecatedLanguageTagsAndModernReplacement_areNormalizedToSameTag
()
{
normalizeLanguageCode_deprecatedLanguageTagsAndModernReplacement_areNormalizedToSameTag
()
{
// See https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes, "ISO 639:1988"
// See https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes, "ISO 639:1988"
...
@@ -877,8 +881,9 @@ public class UtilTest {
...
@@ -877,8 +881,9 @@ public class UtilTest {
.
isEqualTo
(
Util
.
normalizeLanguageCode
(
"zh-hsn"
));
.
isEqualTo
(
Util
.
normalizeLanguageCode
(
"zh-hsn"
));
}
}
// TODO: Revert to @Config(sdk = Config.ALL_SDKS) once b/143232359 is resolved
@Test
@Test
@Config
(
sdk
=
Config
.
ALL_SDKS
)
@Config
(
minSdk
=
Config
.
OLDEST_SDK
,
maxSdk
=
Config
.
TARGET_SDK
)
public
void
normalizeLanguageCode_macrolanguageTags_areFullyMaintained
()
{
public
void
normalizeLanguageCode_macrolanguageTags_areFullyMaintained
()
{
// See https://en.wikipedia.org/wiki/ISO_639_macrolanguage
// See https://en.wikipedia.org/wiki/ISO_639_macrolanguage
assertThat
(
Util
.
normalizeLanguageCode
(
"zh-cmn"
)).
isEqualTo
(
"zh-cmn"
);
assertThat
(
Util
.
normalizeLanguageCode
(
"zh-cmn"
)).
isEqualTo
(
"zh-cmn"
);
...
...
library/core/src/main/java/com/google/android/exoplayer2/audio/AudioTimestampPoller.java
View file @
54283746
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
*/
*/
package
com
.
google
.
android
.
exoplayer2
.
audio
;
package
com
.
google
.
android
.
exoplayer2
.
audio
;
import
android.annotation.TargetApi
;
import
android.media.AudioTimestamp
;
import
android.media.AudioTimestamp
;
import
android.media.AudioTrack
;
import
android.media.AudioTrack
;
import
androidx.annotation.IntDef
;
import
androidx.annotation.IntDef
;
...
@@ -115,6 +116,7 @@ import java.lang.annotation.RetentionPolicy;
...
@@ -115,6 +116,7 @@ import java.lang.annotation.RetentionPolicy;
* @param systemTimeUs The current system time, in microseconds.
* @param systemTimeUs The current system time, in microseconds.
* @return Whether the timestamp was updated.
* @return Whether the timestamp was updated.
*/
*/
@TargetApi
(
19
)
// audioTimestamp will be null if Util.SDK_INT < 19.
public
boolean
maybePollTimestamp
(
long
systemTimeUs
)
{
public
boolean
maybePollTimestamp
(
long
systemTimeUs
)
{
if
(
audioTimestamp
==
null
||
(
systemTimeUs
-
lastTimestampSampleTimeUs
)
<
sampleIntervalUs
)
{
if
(
audioTimestamp
==
null
||
(
systemTimeUs
-
lastTimestampSampleTimeUs
)
<
sampleIntervalUs
)
{
return
false
;
return
false
;
...
@@ -220,6 +222,7 @@ import java.lang.annotation.RetentionPolicy;
...
@@ -220,6 +222,7 @@ import java.lang.annotation.RetentionPolicy;
* If {@link #maybePollTimestamp(long)} or {@link #hasTimestamp()} returned {@code true}, returns
* If {@link #maybePollTimestamp(long)} or {@link #hasTimestamp()} returned {@code true}, returns
* the system time at which the latest timestamp was sampled, in microseconds.
* the system time at which the latest timestamp was sampled, in microseconds.
*/
*/
@TargetApi
(
19
)
// audioTimestamp will be null if Util.SDK_INT < 19.
public
long
getTimestampSystemTimeUs
()
{
public
long
getTimestampSystemTimeUs
()
{
return
audioTimestamp
!=
null
?
audioTimestamp
.
getTimestampSystemTimeUs
()
:
C
.
TIME_UNSET
;
return
audioTimestamp
!=
null
?
audioTimestamp
.
getTimestampSystemTimeUs
()
:
C
.
TIME_UNSET
;
}
}
...
@@ -228,6 +231,7 @@ import java.lang.annotation.RetentionPolicy;
...
@@ -228,6 +231,7 @@ import java.lang.annotation.RetentionPolicy;
* If {@link #maybePollTimestamp(long)} or {@link #hasTimestamp()} returned {@code true}, returns
* If {@link #maybePollTimestamp(long)} or {@link #hasTimestamp()} returned {@code true}, returns
* the latest timestamp's position in frames.
* the latest timestamp's position in frames.
*/
*/
@TargetApi
(
19
)
// audioTimestamp will be null if Util.SDK_INT < 19.
public
long
getTimestampPositionFrames
()
{
public
long
getTimestampPositionFrames
()
{
return
audioTimestamp
!=
null
?
audioTimestamp
.
getTimestampPositionFrames
()
:
C
.
POSITION_UNSET
;
return
audioTimestamp
!=
null
?
audioTimestamp
.
getTimestampPositionFrames
()
:
C
.
POSITION_UNSET
;
}
}
...
...
library/core/src/main/java/com/google/android/exoplayer2/audio/DefaultAudioSink.java
View file @
54283746
...
@@ -1122,6 +1122,9 @@ public final class DefaultAudioSink implements AudioSink {
...
@@ -1122,6 +1122,9 @@ public final class DefaultAudioSink implements AudioSink {
private
static
int
getMaximumEncodedRateBytesPerSecond
(
@C
.
Encoding
int
encoding
)
{
private
static
int
getMaximumEncodedRateBytesPerSecond
(
@C
.
Encoding
int
encoding
)
{
switch
(
encoding
)
{
switch
(
encoding
)
{
case
C
.
ENCODING_MP3
:
// Maximum bitrate for MPEG-1 layer III: 320 kbit/s.
return
320
*
1000
/
8
;
case
C
.
ENCODING_AC3
:
case
C
.
ENCODING_AC3
:
return
640
*
1000
/
8
;
return
640
*
1000
/
8
;
case
C
.
ENCODING_E_AC3
:
case
C
.
ENCODING_E_AC3
:
...
@@ -1136,12 +1139,13 @@ public final class DefaultAudioSink implements AudioSink {
...
@@ -1136,12 +1139,13 @@ public final class DefaultAudioSink implements AudioSink {
return
18000
*
1000
/
8
;
return
18000
*
1000
/
8
;
case
C
.
ENCODING_DOLBY_TRUEHD
:
case
C
.
ENCODING_DOLBY_TRUEHD
:
return
24500
*
1000
/
8
;
return
24500
*
1000
/
8
;
case
C
.
ENCODING_INVALID
:
case
C
.
ENCODING_PCM_16BIT
:
case
C
.
ENCODING_PCM_16BIT
:
case
C
.
ENCODING_PCM_16BIT_BIG_ENDIAN
:
case
C
.
ENCODING_PCM_24BIT
:
case
C
.
ENCODING_PCM_24BIT
:
case
C
.
ENCODING_PCM_32BIT
:
case
C
.
ENCODING_PCM_32BIT
:
case
C
.
ENCODING_PCM_8BIT
:
case
C
.
ENCODING_PCM_8BIT
:
case
C
.
ENCODING_PCM_FLOAT
:
case
C
.
ENCODING_PCM_FLOAT
:
case
C
.
ENCODING_INVALID
:
case
Format
.
NO_VALUE
:
case
Format
.
NO_VALUE
:
default
:
default
:
throw
new
IllegalArgumentException
();
throw
new
IllegalArgumentException
();
...
@@ -1167,6 +1171,14 @@ public final class DefaultAudioSink implements AudioSink {
...
@@ -1167,6 +1171,14 @@ public final class DefaultAudioSink implements AudioSink {
?
0
?
0
:
(
Ac3Util
.
parseTrueHdSyncframeAudioSampleCount
(
buffer
,
syncframeOffset
)
:
(
Ac3Util
.
parseTrueHdSyncframeAudioSampleCount
(
buffer
,
syncframeOffset
)
*
Ac3Util
.
TRUEHD_RECHUNK_SAMPLE_COUNT
);
*
Ac3Util
.
TRUEHD_RECHUNK_SAMPLE_COUNT
);
case
C
.
ENCODING_PCM_16BIT
:
case
C
.
ENCODING_PCM_16BIT_BIG_ENDIAN
:
case
C
.
ENCODING_PCM_24BIT
:
case
C
.
ENCODING_PCM_32BIT
:
case
C
.
ENCODING_PCM_8BIT
:
case
C
.
ENCODING_PCM_FLOAT
:
case
C
.
ENCODING_INVALID
:
case
Format
.
NO_VALUE
:
default
:
default
:
throw
new
IllegalStateException
(
"Unexpected audio encoding: "
+
encoding
);
throw
new
IllegalStateException
(
"Unexpected audio encoding: "
+
encoding
);
}
}
...
...
library/core/src/main/java/com/google/android/exoplayer2/mediacodec/DedicatedThreadAsyncMediaCodecAdapter.java
View file @
54283746
...
@@ -28,6 +28,9 @@ import androidx.annotation.VisibleForTesting;
...
@@ -28,6 +28,9 @@ import androidx.annotation.VisibleForTesting;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.decoder.CryptoInfo
;
import
com.google.android.exoplayer2.decoder.CryptoInfo
;
import
com.google.android.exoplayer2.util.Util
;
import
com.google.android.exoplayer2.util.Util
;
import
java.lang.annotation.Documented
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
org.checkerframework.checker.nullness.qual.MonotonicNonNull
;
import
org.checkerframework.checker.nullness.qual.MonotonicNonNull
;
/**
/**
...
@@ -41,6 +44,8 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
...
@@ -41,6 +44,8 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
/* package */
final
class
DedicatedThreadAsyncMediaCodecAdapter
extends
MediaCodec
.
Callback
/* package */
final
class
DedicatedThreadAsyncMediaCodecAdapter
extends
MediaCodec
.
Callback
implements
MediaCodecAdapter
{
implements
MediaCodecAdapter
{
@Documented
@Retention
(
RetentionPolicy
.
SOURCE
)
@IntDef
({
STATE_CREATED
,
STATE_STARTED
,
STATE_SHUT_DOWN
})
@IntDef
({
STATE_CREATED
,
STATE_STARTED
,
STATE_SHUT_DOWN
})
private
@interface
State
{}
private
@interface
State
{}
...
...
library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecInfo.java
View file @
54283746
...
@@ -229,9 +229,10 @@ public final class MediaCodecInfo {
...
@@ -229,9 +229,10 @@ public final class MediaCodecInfo {
* @see CodecCapabilities#getMaxSupportedInstances()
* @see CodecCapabilities#getMaxSupportedInstances()
*/
*/
public
int
getMaxSupportedInstances
()
{
public
int
getMaxSupportedInstances
()
{
return
(
Util
.
SDK_INT
<
23
||
capabilities
==
null
)
if
(
Util
.
SDK_INT
<
23
||
capabilities
==
null
)
{
?
MAX_SUPPORTED_INSTANCES_UNKNOWN
return
MAX_SUPPORTED_INSTANCES_UNKNOWN
;
:
getMaxSupportedInstancesV23
(
capabilities
);
}
return
getMaxSupportedInstancesV23
(
capabilities
);
}
}
/**
/**
...
...
library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java
View file @
54283746
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
*/
*/
package
com
.
google
.
android
.
exoplayer2
.
mediacodec
;
package
com
.
google
.
android
.
exoplayer2
.
mediacodec
;
import
android.annotation.TargetApi
;
import
android.media.MediaCodec
;
import
android.media.MediaCodec
;
import
android.media.MediaCodec.CodecException
;
import
android.media.MediaCodec.CodecException
;
import
android.media.MediaCodec.CryptoException
;
import
android.media.MediaCodec.CryptoException
;
...
@@ -1842,6 +1843,7 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
...
@@ -1842,6 +1843,7 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
*
*
* @throws ExoPlaybackException If an error occurs processing the signal.
* @throws ExoPlaybackException If an error occurs processing the signal.
*/
*/
@TargetApi
(
23
)
// codecDrainAction == DRAIN_ACTION_UPDATE_DRM_SESSION implies SDK_INT >= 23.
private
void
processEndOfStream
()
throws
ExoPlaybackException
{
private
void
processEndOfStream
()
throws
ExoPlaybackException
{
switch
(
codecDrainAction
)
{
switch
(
codecDrainAction
)
{
case
DRAIN_ACTION_REINITIALIZE:
case
DRAIN_ACTION_REINITIALIZE:
...
...
library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MultiLockAsyncMediaCodecAdapter.java
View file @
54283746
...
@@ -30,6 +30,9 @@ import com.google.android.exoplayer2.C;
...
@@ -30,6 +30,9 @@ import com.google.android.exoplayer2.C;
import
com.google.android.exoplayer2.decoder.CryptoInfo
;
import
com.google.android.exoplayer2.decoder.CryptoInfo
;
import
com.google.android.exoplayer2.util.IntArrayQueue
;
import
com.google.android.exoplayer2.util.IntArrayQueue
;
import
com.google.android.exoplayer2.util.Util
;
import
com.google.android.exoplayer2.util.Util
;
import
java.lang.annotation.Documented
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.util.ArrayDeque
;
import
java.util.ArrayDeque
;
import
org.checkerframework.checker.nullness.qual.MonotonicNonNull
;
import
org.checkerframework.checker.nullness.qual.MonotonicNonNull
;
...
@@ -52,6 +55,8 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
...
@@ -52,6 +55,8 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
/* package */
final
class
MultiLockAsyncMediaCodecAdapter
extends
MediaCodec
.
Callback
/* package */
final
class
MultiLockAsyncMediaCodecAdapter
extends
MediaCodec
.
Callback
implements
MediaCodecAdapter
{
implements
MediaCodecAdapter
{
@Documented
@Retention
(
RetentionPolicy
.
SOURCE
)
@IntDef
({
STATE_CREATED
,
STATE_STARTED
,
STATE_SHUT_DOWN
})
@IntDef
({
STATE_CREATED
,
STATE_STARTED
,
STATE_SHUT_DOWN
})
private
@interface
State
{}
private
@interface
State
{}
...
...
library/core/src/main/java/com/google/android/exoplayer2/util/GlUtil.java
View file @
54283746
...
@@ -17,7 +17,6 @@ package com.google.android.exoplayer2.util;
...
@@ -17,7 +17,6 @@ package com.google.android.exoplayer2.util;
import
static
android
.
opengl
.
GLU
.
gluErrorString
;
import
static
android
.
opengl
.
GLU
.
gluErrorString
;
import
android.annotation.TargetApi
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.pm.PackageManager
;
import
android.content.pm.PackageManager
;
import
android.opengl.EGL14
;
import
android.opengl.EGL14
;
...
@@ -208,7 +207,6 @@ public final class GlUtil {
...
@@ -208,7 +207,6 @@ public final class GlUtil {
* Returns whether creating a GL context with {@value EXTENSION_PROTECTED_CONTENT} is possible. If
* Returns whether creating a GL context with {@value EXTENSION_PROTECTED_CONTENT} is possible. If
* {@code true}, the device supports a protected output path for DRM content when using GL.
* {@code true}, the device supports a protected output path for DRM content when using GL.
*/
*/
@TargetApi
(
24
)
public
static
boolean
isProtectedContentExtensionSupported
(
Context
context
)
{
public
static
boolean
isProtectedContentExtensionSupported
(
Context
context
)
{
if
(
Util
.
SDK_INT
<
24
)
{
if
(
Util
.
SDK_INT
<
24
)
{
return
false
;
return
false
;
...
@@ -236,7 +234,6 @@ public final class GlUtil {
...
@@ -236,7 +234,6 @@ public final class GlUtil {
/**
/**
* Returns whether creating a GL context with {@value EXTENSION_SURFACELESS_CONTEXT} is possible.
* Returns whether creating a GL context with {@value EXTENSION_SURFACELESS_CONTEXT} is possible.
*/
*/
@TargetApi
(
17
)
public
static
boolean
isSurfacelessContextExtensionSupported
()
{
public
static
boolean
isSurfacelessContextExtensionSupported
()
{
if
(
Util
.
SDK_INT
<
17
)
{
if
(
Util
.
SDK_INT
<
17
)
{
return
false
;
return
false
;
...
...
library/core/src/main/java/com/google/android/exoplayer2/video/MediaCodecVideoRenderer.java
View file @
54283746
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
package
com
.
google
.
android
.
exoplayer2
.
video
;
package
com
.
google
.
android
.
exoplayer2
.
video
;
import
android.annotation.SuppressLint
;
import
android.annotation.SuppressLint
;
import
android.annotation.TargetApi
;
import
android.content.Context
;
import
android.content.Context
;
import
android.graphics.Point
;
import
android.graphics.Point
;
import
android.media.MediaCodec
;
import
android.media.MediaCodec
;
...
@@ -658,6 +659,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
...
@@ -658,6 +659,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
}
}
@Override
@Override
@TargetApi
(
29
)
// codecHandlesHdr10PlusOutOfBandMetadata is false if Util.SDK_INT < 29
protected
void
handleInputBufferSupplementalData
(
DecoderInputBuffer
buffer
)
protected
void
handleInputBufferSupplementalData
(
DecoderInputBuffer
buffer
)
throws
ExoPlaybackException
{
throws
ExoPlaybackException
{
if
(!
codecHandlesHdr10PlusOutOfBandMetadata
)
{
if
(!
codecHandlesHdr10PlusOutOfBandMetadata
)
{
...
@@ -682,7 +684,6 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
...
@@ -682,7 +684,6 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
byte
[]
hdr10PlusInfo
=
new
byte
[
data
.
remaining
()];
byte
[]
hdr10PlusInfo
=
new
byte
[
data
.
remaining
()];
data
.
get
(
hdr10PlusInfo
);
data
.
get
(
hdr10PlusInfo
);
data
.
position
(
0
);
data
.
position
(
0
);
// If codecHandlesHdr10PlusOutOfBandMetadata is true, this is an API 29 or later build.
setHdr10PlusInfoV29
(
getCodec
(),
hdr10PlusInfo
);
setHdr10PlusInfoV29
(
getCodec
(),
hdr10PlusInfo
);
}
}
}
}
...
@@ -1179,6 +1180,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
...
@@ -1179,6 +1180,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
* @return The framework {@link MediaFormat} that should be used to configure the decoder.
* @return The framework {@link MediaFormat} that should be used to configure the decoder.
*/
*/
@SuppressLint
(
"InlinedApi"
)
@SuppressLint
(
"InlinedApi"
)
@TargetApi
(
21
)
// tunnelingAudioSessionId is unset if Util.SDK_INT < 21
protected
MediaFormat
getMediaFormat
(
protected
MediaFormat
getMediaFormat
(
Format
format
,
Format
format
,
String
codecMimeType
,
String
codecMimeType
,
...
...
library/core/src/main/java/com/google/android/exoplayer2/video/VideoFrameReleaseTimeHelper.java
View file @
54283746
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
*/
*/
package
com
.
google
.
android
.
exoplayer2
.
video
;
package
com
.
google
.
android
.
exoplayer2
.
video
;
import
android.annotation.TargetApi
;
import
android.content.Context
;
import
android.content.Context
;
import
android.hardware.display.DisplayManager
;
import
android.hardware.display.DisplayManager
;
import
android.os.Handler
;
import
android.os.Handler
;
...
@@ -40,9 +41,9 @@ public final class VideoFrameReleaseTimeHelper {
...
@@ -40,9 +41,9 @@ public final class VideoFrameReleaseTimeHelper {
private
static
final
long
VSYNC_OFFSET_PERCENTAGE
=
80
;
private
static
final
long
VSYNC_OFFSET_PERCENTAGE
=
80
;
private
static
final
int
MIN_FRAMES_FOR_ADJUSTMENT
=
6
;
private
static
final
int
MIN_FRAMES_FOR_ADJUSTMENT
=
6
;
private
final
WindowManager
windowManager
;
@Nullable
private
final
WindowManager
windowManager
;
private
final
VSyncSampler
vsyncSampler
;
@Nullable
private
final
VSyncSampler
vsyncSampler
;
private
final
DefaultDisplayListener
displayListener
;
@Nullable
private
final
DefaultDisplayListener
displayListener
;
private
long
vsyncDurationNs
;
private
long
vsyncDurationNs
;
private
long
vsyncOffsetNs
;
private
long
vsyncOffsetNs
;
...
@@ -88,9 +89,8 @@ public final class VideoFrameReleaseTimeHelper {
...
@@ -88,9 +89,8 @@ public final class VideoFrameReleaseTimeHelper {
vsyncOffsetNs
=
C
.
TIME_UNSET
;
vsyncOffsetNs
=
C
.
TIME_UNSET
;
}
}
/**
/** Enables the helper. Must be called from the playback thread. */
* Enables the helper. Must be called from the playback thread.
@TargetApi
(
17
)
// displayListener is null if Util.SDK_INT < 17.
*/
public
void
enable
()
{
public
void
enable
()
{
haveSync
=
false
;
haveSync
=
false
;
if
(
windowManager
!=
null
)
{
if
(
windowManager
!=
null
)
{
...
@@ -102,9 +102,8 @@ public final class VideoFrameReleaseTimeHelper {
...
@@ -102,9 +102,8 @@ public final class VideoFrameReleaseTimeHelper {
}
}
}
}
/**
/** Disables the helper. Must be called from the playback thread. */
* Disables the helper. Must be called from the playback thread.
@TargetApi
(
17
)
// displayListener is null if Util.SDK_INT < 17.
*/
public
void
disable
()
{
public
void
disable
()
{
if
(
windowManager
!=
null
)
{
if
(
windowManager
!=
null
)
{
if
(
displayListener
!=
null
)
{
if
(
displayListener
!=
null
)
{
...
...
library/ui/src/main/java/com/google/android/exoplayer2/ui/DefaultTimeBar.java
View file @
54283746
...
@@ -15,7 +15,6 @@
...
@@ -15,7 +15,6 @@
*/
*/
package
com
.
google
.
android
.
exoplayer2
.
ui
;
package
com
.
google
.
android
.
exoplayer2
.
ui
;
import
android.annotation.TargetApi
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.res.Resources
;
import
android.content.res.Resources
;
import
android.content.res.TypedArray
;
import
android.content.res.TypedArray
;
...
@@ -638,7 +637,6 @@ public class DefaultTimeBar extends View implements TimeBar {
...
@@ -638,7 +637,6 @@ public class DefaultTimeBar extends View implements TimeBar {
event
.
setClassName
(
ACCESSIBILITY_CLASS_NAME
);
event
.
setClassName
(
ACCESSIBILITY_CLASS_NAME
);
}
}
@TargetApi
(
21
)
@Override
@Override
public
void
onInitializeAccessibilityNodeInfo
(
AccessibilityNodeInfo
info
)
{
public
void
onInitializeAccessibilityNodeInfo
(
AccessibilityNodeInfo
info
)
{
super
.
onInitializeAccessibilityNodeInfo
(
info
);
super
.
onInitializeAccessibilityNodeInfo
(
info
);
...
...
testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeExtractorOutput.java
View file @
54283746
...
@@ -59,7 +59,7 @@ public final class FakeExtractorOutput implements ExtractorOutput, Dumper.Dumpab
...
@@ -59,7 +59,7 @@ public final class FakeExtractorOutput implements ExtractorOutput, Dumper.Dumpab
*/
*/
private
static
final
int
WRITE_TO_LOCAL
=
1
;
private
static
final
int
WRITE_TO_LOCAL
=
1
;
/** Write output to folder {@code /storage/emulated/0/Android/data} of device. */
/** Write output to folder {@code /storage/emulated/0/Android/data} of device. */
private
static
final
int
WRITE_TO_DEVICE
=
2
;
private
static
final
int
WRITE_TO_DEVICE
=
1
<<
1
;
@DumpFilesAction
private
static
final
int
DUMP_FILE_ACTION
=
COMPARE_WITH_EXISTING
;
@DumpFilesAction
private
static
final
int
DUMP_FILE_ACTION
=
COMPARE_WITH_EXISTING
;
...
...
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