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
bdadd572
authored
Jul 22, 2020
by
ibaker
Committed by
Oliver Woodman
Jul 24, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Enable nullness checks for more easy files
PiperOrigin-RevId: 322586013
parent
787cfb94
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
7 deletions
library/core/src/main/java/com/google/android/exoplayer2/DefaultLoadControl.java
library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecInfo.java
library/core/src/main/java/com/google/android/exoplayer2/upstream/DefaultAllocator.java
library/core/src/main/java/com/google/android/exoplayer2/DefaultLoadControl.java
View file @
bdadd572
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
*/
*/
package
com
.
google
.
android
.
exoplayer2
;
package
com
.
google
.
android
.
exoplayer2
;
import
androidx.annotation.Nullable
;
import
com.google.android.exoplayer2.source.TrackGroupArray
;
import
com.google.android.exoplayer2.source.TrackGroupArray
;
import
com.google.android.exoplayer2.trackselection.TrackSelectionArray
;
import
com.google.android.exoplayer2.trackselection.TrackSelectionArray
;
import
com.google.android.exoplayer2.upstream.Allocator
;
import
com.google.android.exoplayer2.upstream.Allocator
;
...
@@ -94,7 +95,7 @@ public class DefaultLoadControl implements LoadControl {
...
@@ -94,7 +95,7 @@ public class DefaultLoadControl implements LoadControl {
/** Builder for {@link DefaultLoadControl}. */
/** Builder for {@link DefaultLoadControl}. */
public
static
final
class
Builder
{
public
static
final
class
Builder
{
private
DefaultAllocator
allocator
;
@Nullable
private
DefaultAllocator
allocator
;
private
int
minBufferMs
;
private
int
minBufferMs
;
private
int
maxBufferMs
;
private
int
maxBufferMs
;
private
int
bufferForPlaybackMs
;
private
int
bufferForPlaybackMs
;
...
...
library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecInfo.java
View file @
bdadd572
...
@@ -328,7 +328,7 @@ public final class MediaCodecInfo {
...
@@ -328,7 +328,7 @@ public final class MediaCodecInfo {
public
boolean
isSeamlessAdaptationSupported
(
public
boolean
isSeamlessAdaptationSupported
(
Format
oldFormat
,
Format
newFormat
,
boolean
isNewFormatComplete
)
{
Format
oldFormat
,
Format
newFormat
,
boolean
isNewFormatComplete
)
{
if
(
isVideo
)
{
if
(
isVideo
)
{
return
oldFormat
.
sampleMimeType
.
equals
(
newFormat
.
sampleMimeType
)
return
Assertions
.
checkNotNull
(
oldFormat
.
sampleMimeType
)
.
equals
(
newFormat
.
sampleMimeType
)
&&
oldFormat
.
rotationDegrees
==
newFormat
.
rotationDegrees
&&
oldFormat
.
rotationDegrees
==
newFormat
.
rotationDegrees
&&
(
adaptive
&&
(
adaptive
||
(
oldFormat
.
width
==
newFormat
.
width
&&
oldFormat
.
height
==
newFormat
.
height
))
||
(
oldFormat
.
width
==
newFormat
.
width
&&
oldFormat
.
height
==
newFormat
.
height
))
...
@@ -336,14 +336,16 @@ public final class MediaCodecInfo {
...
@@ -336,14 +336,16 @@ public final class MediaCodecInfo {
||
Util
.
areEqual
(
oldFormat
.
colorInfo
,
newFormat
.
colorInfo
));
||
Util
.
areEqual
(
oldFormat
.
colorInfo
,
newFormat
.
colorInfo
));
}
else
{
}
else
{
if
(!
MimeTypes
.
AUDIO_AAC
.
equals
(
mimeType
)
if
(!
MimeTypes
.
AUDIO_AAC
.
equals
(
mimeType
)
||
!
oldFormat
.
sampleMimeType
.
equals
(
newFormat
.
sampleMimeType
)
||
!
Assertions
.
checkNotNull
(
oldFormat
.
sampleMimeType
)
.
equals
(
newFormat
.
sampleMimeType
)
||
oldFormat
.
channelCount
!=
newFormat
.
channelCount
||
oldFormat
.
channelCount
!=
newFormat
.
channelCount
||
oldFormat
.
sampleRate
!=
newFormat
.
sampleRate
)
{
||
oldFormat
.
sampleRate
!=
newFormat
.
sampleRate
)
{
return
false
;
return
false
;
}
}
// Check the codec profile levels support adaptation.
// Check the codec profile levels support adaptation.
@Nullable
Pair
<
Integer
,
Integer
>
oldCodecProfileLevel
=
Pair
<
Integer
,
Integer
>
oldCodecProfileLevel
=
MediaCodecUtil
.
getCodecProfileAndLevel
(
oldFormat
);
MediaCodecUtil
.
getCodecProfileAndLevel
(
oldFormat
);
@Nullable
Pair
<
Integer
,
Integer
>
newCodecProfileLevel
=
Pair
<
Integer
,
Integer
>
newCodecProfileLevel
=
MediaCodecUtil
.
getCodecProfileAndLevel
(
newFormat
);
MediaCodecUtil
.
getCodecProfileAndLevel
(
newFormat
);
if
(
oldCodecProfileLevel
==
null
||
newCodecProfileLevel
==
null
)
{
if
(
oldCodecProfileLevel
==
null
||
newCodecProfileLevel
==
null
)
{
...
@@ -402,6 +404,7 @@ public final class MediaCodecInfo {
...
@@ -402,6 +404,7 @@ public final class MediaCodecInfo {
* the {@link MediaCodec}'s width and height alignment requirements, or null if not a video
* the {@link MediaCodec}'s width and height alignment requirements, or null if not a video
* codec.
* codec.
*/
*/
@Nullable
@RequiresApi
(
21
)
@RequiresApi
(
21
)
public
Point
alignVideoSizeV21
(
int
width
,
int
height
)
{
public
Point
alignVideoSizeV21
(
int
width
,
int
height
)
{
if
(
capabilities
==
null
)
{
if
(
capabilities
==
null
)
{
...
...
library/core/src/main/java/com/google/android/exoplayer2/upstream/DefaultAllocator.java
View file @
bdadd572
...
@@ -19,6 +19,7 @@ import androidx.annotation.Nullable;
...
@@ -19,6 +19,7 @@ import androidx.annotation.Nullable;
import
com.google.android.exoplayer2.util.Assertions
;
import
com.google.android.exoplayer2.util.Assertions
;
import
com.google.android.exoplayer2.util.Util
;
import
com.google.android.exoplayer2.util.Util
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
org.checkerframework.checker.nullness.compatqual.NullableType
;
/**
/**
* Default implementation of {@link Allocator}.
* Default implementation of {@link Allocator}.
...
@@ -35,7 +36,7 @@ public final class DefaultAllocator implements Allocator {
...
@@ -35,7 +36,7 @@ public final class DefaultAllocator implements Allocator {
private
int
targetBufferSize
;
private
int
targetBufferSize
;
private
int
allocatedCount
;
private
int
allocatedCount
;
private
int
availableCount
;
private
int
availableCount
;
private
Allocation
[]
availableAllocations
;
@NullableType
private
Allocation
[]
availableAllocations
;
/**
/**
* Constructs an instance without creating any {@link Allocation}s up front.
* Constructs an instance without creating any {@link Allocation}s up front.
...
@@ -97,7 +98,7 @@ public final class DefaultAllocator implements Allocator {
...
@@ -97,7 +98,7 @@ public final class DefaultAllocator implements Allocator {
allocatedCount
++;
allocatedCount
++;
Allocation
allocation
;
Allocation
allocation
;
if
(
availableCount
>
0
)
{
if
(
availableCount
>
0
)
{
allocation
=
availableAllocations
[--
availableCount
]
;
allocation
=
Assertions
.
checkNotNull
(
availableAllocations
[--
availableCount
])
;
availableAllocations
[
availableCount
]
=
null
;
availableAllocations
[
availableCount
]
=
null
;
}
else
{
}
else
{
allocation
=
new
Allocation
(
new
byte
[
individualAllocationSize
],
0
);
allocation
=
new
Allocation
(
new
byte
[
individualAllocationSize
],
0
);
...
@@ -141,11 +142,11 @@ public final class DefaultAllocator implements Allocator {
...
@@ -141,11 +142,11 @@ public final class DefaultAllocator implements Allocator {
int
lowIndex
=
0
;
int
lowIndex
=
0
;
int
highIndex
=
availableCount
-
1
;
int
highIndex
=
availableCount
-
1
;
while
(
lowIndex
<=
highIndex
)
{
while
(
lowIndex
<=
highIndex
)
{
Allocation
lowAllocation
=
availableAllocations
[
lowIndex
]
;
Allocation
lowAllocation
=
Assertions
.
checkNotNull
(
availableAllocations
[
lowIndex
])
;
if
(
lowAllocation
.
data
==
initialAllocationBlock
)
{
if
(
lowAllocation
.
data
==
initialAllocationBlock
)
{
lowIndex
++;
lowIndex
++;
}
else
{
}
else
{
Allocation
highAllocation
=
availableAllocations
[
highIndex
]
;
Allocation
highAllocation
=
Assertions
.
checkNotNull
(
availableAllocations
[
highIndex
])
;
if
(
highAllocation
.
data
!=
initialAllocationBlock
)
{
if
(
highAllocation
.
data
!=
initialAllocationBlock
)
{
highIndex
--;
highIndex
--;
}
else
{
}
else
{
...
...
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