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
c4808182
authored
Apr 30, 2019
by
tonihei
Committed by
Oliver Woodman
Apr 30, 2019
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Fix some random AndroidStudio warnings.
PiperOrigin-RevId: 245956915
parent
0bb32a8f
Show whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
38 additions
and
79 deletions
demos/main/src/main/java/com/google/android/exoplayer2/demo/DownloadTracker.java
extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/MediaSessionConnector.java
extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/TimelineQueueNavigator.java
library/core/src/main/java/com/google/android/exoplayer2/C.java
library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImplInternal.java
library/core/src/main/java/com/google/android/exoplayer2/analytics/DefaultPlaybackSessionManager.java
library/core/src/main/java/com/google/android/exoplayer2/audio/DefaultAudioSink.java
library/core/src/main/java/com/google/android/exoplayer2/drm/DefaultDrmSession.java
library/core/src/main/java/com/google/android/exoplayer2/drm/DrmInitData.java
library/core/src/main/java/com/google/android/exoplayer2/drm/OfflineLicenseHelper.java
library/core/src/main/java/com/google/android/exoplayer2/extractor/ogg/VorbisUtil.java
library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecUtil.java
library/core/src/main/java/com/google/android/exoplayer2/metadata/MetadataRenderer.java
library/core/src/main/java/com/google/android/exoplayer2/trackselection/MappingTrackSelector.java
library/core/src/main/java/com/google/android/exoplayer2/upstream/DefaultBandwidthMeter.java
library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CacheDataSink.java
library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CachedContentIndex.java
library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/SimpleCache.java
library/core/src/test/java/com/google/android/exoplayer2/offline/ActionFileUpgradeUtilTest.java
library/core/src/test/java/com/google/android/exoplayer2/offline/DownloadManagerTest.java
library/core/src/test/java/com/google/android/exoplayer2/trackselection/AdaptiveTrackSelectionTest.java
library/core/src/test/java/com/google/android/exoplayer2/upstream/cache/SimpleCacheTest.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/manifest/DashManifestParser.java
library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerView.java
library/ui/src/main/java/com/google/android/exoplayer2/ui/spherical/SphericalSurfaceView.java
testutils_robolectric/src/main/java/com/google/android/exoplayer2/testutil/CacheAsserts.java
testutils_robolectric/src/main/java/com/google/android/exoplayer2/testutil/MediaPeriodAsserts.java
demos/main/src/main/java/com/google/android/exoplayer2/demo/DownloadTracker.java
View file @
c4808182
...
@@ -82,7 +82,6 @@ public class DownloadTracker {
...
@@ -82,7 +82,6 @@ public class DownloadTracker {
return
download
!=
null
&&
download
.
state
!=
Download
.
STATE_FAILED
;
return
download
!=
null
&&
download
.
state
!=
Download
.
STATE_FAILED
;
}
}
@SuppressWarnings
(
"unchecked"
)
public
DownloadRequest
getDownloadRequest
(
Uri
uri
)
{
public
DownloadRequest
getDownloadRequest
(
Uri
uri
)
{
Download
download
=
downloads
.
get
(
uri
);
Download
download
=
downloads
.
get
(
uri
);
return
download
!=
null
&&
download
.
state
!=
Download
.
STATE_FAILED
?
download
.
request
:
null
;
return
download
!=
null
&&
download
.
state
!=
Download
.
STATE_FAILED
?
download
.
request
:
null
;
...
...
extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/MediaSessionConnector.java
View file @
c4808182
...
@@ -952,8 +952,7 @@ public final class MediaSessionConnector {
...
@@ -952,8 +952,7 @@ public final class MediaSessionConnector {
}
}
if
(
description
.
getMediaId
()
!=
null
)
{
if
(
description
.
getMediaId
()
!=
null
)
{
builder
.
putString
(
builder
.
putString
(
MediaMetadataCompat
.
METADATA_KEY_MEDIA_ID
,
MediaMetadataCompat
.
METADATA_KEY_MEDIA_ID
,
description
.
getMediaId
());
String
.
valueOf
(
description
.
getMediaId
()));
}
}
if
(
description
.
getMediaUri
()
!=
null
)
{
if
(
description
.
getMediaUri
()
!=
null
)
{
builder
.
putString
(
builder
.
putString
(
...
...
extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/TimelineQueueNavigator.java
View file @
c4808182
...
@@ -80,7 +80,7 @@ public abstract class TimelineQueueNavigator implements MediaSessionConnector.Qu
...
@@ -80,7 +80,7 @@ public abstract class TimelineQueueNavigator implements MediaSessionConnector.Qu
* <p>Often artworks and icons need to be loaded asynchronously. In such a case, return a {@link
* <p>Often artworks and icons need to be loaded asynchronously. In such a case, return a {@link
* MediaDescriptionCompat} without the images, load your images asynchronously off the main thread
* MediaDescriptionCompat} without the images, load your images asynchronously off the main thread
* and then call {@link MediaSessionConnector#invalidateMediaSessionQueue()} to make the connector
* and then call {@link MediaSessionConnector#invalidateMediaSessionQueue()} to make the connector
* update the queue by calling
{@link #getMediaDescription(Player, int)}
again.
* update the queue by calling
this method
again.
*
*
* @param player The current player.
* @param player The current player.
* @param windowIndex The timeline window index for which to provide a description.
* @param windowIndex The timeline window index for which to provide a description.
...
...
library/core/src/main/java/com/google/android/exoplayer2/C.java
View file @
c4808182
...
@@ -494,7 +494,6 @@ public final class C {
...
@@ -494,7 +494,6 @@ public final class C {
/** Indicates that a buffer is (at least partially) encrypted. */
/** Indicates that a buffer is (at least partially) encrypted. */
public
static
final
int
BUFFER_FLAG_ENCRYPTED
=
1
<<
30
;
// 0x40000000
public
static
final
int
BUFFER_FLAG_ENCRYPTED
=
1
<<
30
;
// 0x40000000
/** Indicates that a buffer should be decoded but not rendered. */
/** Indicates that a buffer should be decoded but not rendered. */
@SuppressWarnings
(
"NumericOverflow"
)
public
static
final
int
BUFFER_FLAG_DECODE_ONLY
=
1
<<
31
;
// 0x80000000
public
static
final
int
BUFFER_FLAG_DECODE_ONLY
=
1
<<
31
;
// 0x80000000
/**
/**
...
...
library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImplInternal.java
View file @
c4808182
...
@@ -302,7 +302,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
...
@@ -302,7 +302,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
// Handler.Callback implementation.
// Handler.Callback implementation.
@SuppressWarnings
(
"unchecked"
)
@Override
@Override
public
boolean
handleMessage
(
Message
msg
)
{
public
boolean
handleMessage
(
Message
msg
)
{
try
{
try
{
...
...
library/core/src/main/java/com/google/android/exoplayer2/analytics/DefaultPlaybackSessionManager.java
View file @
c4808182
...
@@ -253,14 +253,12 @@ public final class DefaultPlaybackSessionManager implements PlaybackSessionManag
...
@@ -253,14 +253,12 @@ public final class DefaultPlaybackSessionManager implements PlaybackSessionManag
if
(
windowIndex
==
C
.
INDEX_UNSET
)
{
if
(
windowIndex
==
C
.
INDEX_UNSET
)
{
return
false
;
return
false
;
}
}
if
(
adMediaPeriodId
!=
null
)
{
if
(
adMediaPeriodId
==
null
)
{
int
newPeriodIndex
=
newTimeline
.
getIndexOfPeriod
(
adMediaPeriodId
.
periodUid
);
if
(
newPeriodIndex
==
C
.
INDEX_UNSET
)
{
return
false
;
}
}
return
true
;
return
true
;
}
}
int
newPeriodIndex
=
newTimeline
.
getIndexOfPeriod
(
adMediaPeriodId
.
periodUid
);
return
newPeriodIndex
!=
C
.
INDEX_UNSET
;
}
public
boolean
belongsToSession
(
public
boolean
belongsToSession
(
int
eventWindowIndex
,
@Nullable
MediaPeriodId
eventMediaPeriodId
)
{
int
eventWindowIndex
,
@Nullable
MediaPeriodId
eventMediaPeriodId
)
{
...
...
library/core/src/main/java/com/google/android/exoplayer2/audio/DefaultAudioSink.java
View file @
c4808182
...
@@ -1218,7 +1218,6 @@ public final class DefaultAudioSink implements AudioSink {
...
@@ -1218,7 +1218,6 @@ public final class DefaultAudioSink implements AudioSink {
audioTrack
.
setVolume
(
volume
);
audioTrack
.
setVolume
(
volume
);
}
}
@SuppressWarnings
(
"deprecation"
)
private
static
void
setVolumeInternalV3
(
AudioTrack
audioTrack
,
float
volume
)
{
private
static
void
setVolumeInternalV3
(
AudioTrack
audioTrack
,
float
volume
)
{
audioTrack
.
setStereoVolume
(
volume
,
volume
);
audioTrack
.
setStereoVolume
(
volume
,
volume
);
}
}
...
...
library/core/src/main/java/com/google/android/exoplayer2/drm/DefaultDrmSession.java
View file @
c4808182
...
@@ -500,7 +500,6 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
...
@@ -500,7 +500,6 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
}
}
@Override
@Override
@SuppressWarnings
(
"unchecked"
)
public
void
handleMessage
(
Message
msg
)
{
public
void
handleMessage
(
Message
msg
)
{
Object
request
=
msg
.
obj
;
Object
request
=
msg
.
obj
;
Object
response
;
Object
response
;
...
...
library/core/src/main/java/com/google/android/exoplayer2/drm/DrmInitData.java
View file @
c4808182
...
@@ -428,7 +428,6 @@ public final class DrmInitData implements Comparator<SchemeData>, Parcelable {
...
@@ -428,7 +428,6 @@ public final class DrmInitData implements Comparator<SchemeData>, Parcelable {
dest
.
writeByte
((
byte
)
(
requiresSecureDecryption
?
1
:
0
));
dest
.
writeByte
((
byte
)
(
requiresSecureDecryption
?
1
:
0
));
}
}
@SuppressWarnings
(
"hiding"
)
public
static
final
Parcelable
.
Creator
<
SchemeData
>
CREATOR
=
public
static
final
Parcelable
.
Creator
<
SchemeData
>
CREATOR
=
new
Parcelable
.
Creator
<
SchemeData
>()
{
new
Parcelable
.
Creator
<
SchemeData
>()
{
...
...
library/core/src/main/java/com/google/android/exoplayer2/drm/OfflineLicenseHelper.java
View file @
c4808182
...
@@ -92,7 +92,7 @@ public final class OfflineLicenseHelper<T extends ExoMediaCrypto> {
...
@@ -92,7 +92,7 @@ public final class OfflineLicenseHelper<T extends ExoMediaCrypto> {
* @throws UnsupportedDrmException If the Widevine DRM scheme is unsupported or cannot be
* @throws UnsupportedDrmException If the Widevine DRM scheme is unsupported or cannot be
* instantiated.
* instantiated.
* @see DefaultDrmSessionManager#DefaultDrmSessionManager(java.util.UUID, ExoMediaDrm,
* @see DefaultDrmSessionManager#DefaultDrmSessionManager(java.util.UUID, ExoMediaDrm,
* MediaDrmCallback, HashMap
, Handler, DefaultDrmSessionEventListener
)
* MediaDrmCallback, HashMap)
*/
*/
public
static
OfflineLicenseHelper
<
FrameworkMediaCrypto
>
newWidevineInstance
(
public
static
OfflineLicenseHelper
<
FrameworkMediaCrypto
>
newWidevineInstance
(
String
defaultLicenseUrl
,
String
defaultLicenseUrl
,
...
@@ -115,7 +115,7 @@ public final class OfflineLicenseHelper<T extends ExoMediaCrypto> {
...
@@ -115,7 +115,7 @@ public final class OfflineLicenseHelper<T extends ExoMediaCrypto> {
* @param optionalKeyRequestParameters An optional map of parameters to pass as the last argument
* @param optionalKeyRequestParameters An optional map of parameters to pass as the last argument
* to {@link MediaDrm#getKeyRequest(byte[], byte[], String, int, HashMap)}. May be null.
* to {@link MediaDrm#getKeyRequest(byte[], byte[], String, int, HashMap)}. May be null.
* @see DefaultDrmSessionManager#DefaultDrmSessionManager(java.util.UUID, ExoMediaDrm,
* @see DefaultDrmSessionManager#DefaultDrmSessionManager(java.util.UUID, ExoMediaDrm,
* MediaDrmCallback, HashMap
, Handler, DefaultDrmSessionEventListener
)
* MediaDrmCallback, HashMap)
*/
*/
public
OfflineLicenseHelper
(
public
OfflineLicenseHelper
(
UUID
uuid
,
UUID
uuid
,
...
...
library/core/src/main/java/com/google/android/exoplayer2/extractor/ogg/VorbisUtil.java
View file @
c4808182
...
@@ -218,8 +218,10 @@ import java.util.Arrays;
...
@@ -218,8 +218,10 @@ import java.util.Arrays;
int
mappingsCount
=
bitArray
.
readBits
(
6
)
+
1
;
int
mappingsCount
=
bitArray
.
readBits
(
6
)
+
1
;
for
(
int
i
=
0
;
i
<
mappingsCount
;
i
++)
{
for
(
int
i
=
0
;
i
<
mappingsCount
;
i
++)
{
int
mappingType
=
bitArray
.
readBits
(
16
);
int
mappingType
=
bitArray
.
readBits
(
16
);
switch
(
mappingType
)
{
if
(
mappingType
!=
0
)
{
case
0
:
Log
.
e
(
TAG
,
"mapping type other than 0 not supported: "
+
mappingType
);
continue
;
}
int
submaps
;
int
submaps
;
if
(
bitArray
.
readBit
())
{
if
(
bitArray
.
readBit
())
{
submaps
=
bitArray
.
readBits
(
4
)
+
1
;
submaps
=
bitArray
.
readBits
(
4
)
+
1
;
...
@@ -249,10 +251,6 @@ import java.util.Arrays;
...
@@ -249,10 +251,6 @@ import java.util.Arrays;
bitArray
.
skipBits
(
8
);
// submapFloor
bitArray
.
skipBits
(
8
);
// submapFloor
bitArray
.
skipBits
(
8
);
// submapResidue
bitArray
.
skipBits
(
8
);
// submapResidue
}
}
break
;
default
:
Log
.
e
(
TAG
,
"mapping type other than 0 not supported: "
+
mappingType
);
}
}
}
}
}
...
...
library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecUtil.java
View file @
c4808182
...
@@ -827,7 +827,6 @@ public final class MediaCodecUtil {
...
@@ -827,7 +827,6 @@ public final class MediaCodecUtil {
}
}
@SuppressWarnings
(
"deprecation"
)
private
static
final
class
MediaCodecListCompatV16
implements
MediaCodecListCompat
{
private
static
final
class
MediaCodecListCompatV16
implements
MediaCodecListCompat
{
@Override
@Override
...
...
library/core/src/main/java/com/google/android/exoplayer2/metadata/MetadataRenderer.java
View file @
c4808182
...
@@ -177,7 +177,6 @@ public final class MetadataRenderer extends BaseRenderer implements Callback {
...
@@ -177,7 +177,6 @@ public final class MetadataRenderer extends BaseRenderer implements Callback {
pendingMetadataCount
=
0
;
pendingMetadataCount
=
0
;
}
}
@SuppressWarnings
(
"unchecked"
)
@Override
@Override
public
boolean
handleMessage
(
Message
msg
)
{
public
boolean
handleMessage
(
Message
msg
)
{
switch
(
msg
.
what
)
{
switch
(
msg
.
what
)
{
...
...
library/core/src/main/java/com/google/android/exoplayer2/trackselection/MappingTrackSelector.java
View file @
c4808182
...
@@ -156,10 +156,10 @@ public abstract class MappingTrackSelector extends TrackSelector {
...
@@ -156,10 +156,10 @@ public abstract class MappingTrackSelector extends TrackSelector {
public
@RendererSupport
int
getRendererSupport
(
int
rendererIndex
)
{
public
@RendererSupport
int
getRendererSupport
(
int
rendererIndex
)
{
int
bestRendererSupport
=
RENDERER_SUPPORT_NO_TRACKS
;
int
bestRendererSupport
=
RENDERER_SUPPORT_NO_TRACKS
;
int
[][]
rendererFormatSupport
=
rendererFormatSupports
[
rendererIndex
];
int
[][]
rendererFormatSupport
=
rendererFormatSupports
[
rendererIndex
];
for
(
int
i
=
0
;
i
<
rendererFormatSupport
.
length
;
i
++
)
{
for
(
int
[]
trackGroupFormatSupport
:
rendererFormatSupport
)
{
for
(
int
j
=
0
;
j
<
rendererFormatSupport
[
i
].
length
;
j
++
)
{
for
(
int
trackFormatSupport
:
trackGroupFormatSupport
)
{
int
trackRendererSupport
;
int
trackRendererSupport
;
switch
(
rendererFormatSupport
[
i
][
j
]
&
RendererCapabilities
.
FORMAT_SUPPORT_MASK
)
{
switch
(
trackFormatSupport
&
RendererCapabilities
.
FORMAT_SUPPORT_MASK
)
{
case
RendererCapabilities
.
FORMAT_HANDLED
:
case
RendererCapabilities
.
FORMAT_HANDLED
:
return
RENDERER_SUPPORT_PLAYABLE_TRACKS
;
return
RENDERER_SUPPORT_PLAYABLE_TRACKS
;
case
RendererCapabilities
.
FORMAT_EXCEEDS_CAPABILITIES
:
case
RendererCapabilities
.
FORMAT_EXCEEDS_CAPABILITIES
:
...
...
library/core/src/main/java/com/google/android/exoplayer2/upstream/DefaultBandwidthMeter.java
View file @
c4808182
...
@@ -342,7 +342,7 @@ public final class DefaultBandwidthMeter implements BandwidthMeter, TransferList
...
@@ -342,7 +342,7 @@ public final class DefaultBandwidthMeter implements BandwidthMeter, TransferList
totalElapsedTimeMs
+=
sampleElapsedTimeMs
;
totalElapsedTimeMs
+=
sampleElapsedTimeMs
;
totalBytesTransferred
+=
sampleBytesTransferred
;
totalBytesTransferred
+=
sampleBytesTransferred
;
if
(
sampleElapsedTimeMs
>
0
)
{
if
(
sampleElapsedTimeMs
>
0
)
{
float
bitsPerSecond
=
(
sampleBytesTransferred
*
8000
)
/
sampleElapsedTimeMs
;
float
bitsPerSecond
=
(
sampleBytesTransferred
*
8000
f
)
/
sampleElapsedTimeMs
;
slidingPercentile
.
addSample
((
int
)
Math
.
sqrt
(
sampleBytesTransferred
),
bitsPerSecond
);
slidingPercentile
.
addSample
((
int
)
Math
.
sqrt
(
sampleBytesTransferred
),
bitsPerSecond
);
if
(
totalElapsedTimeMs
>=
ELAPSED_MILLIS_FOR_ESTIMATE
if
(
totalElapsedTimeMs
>=
ELAPSED_MILLIS_FOR_ESTIMATE
||
totalBytesTransferred
>=
BYTES_TRANSFERRED_FOR_ESTIMATE
)
{
||
totalBytesTransferred
>=
BYTES_TRANSFERRED_FOR_ESTIMATE
)
{
...
...
library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CacheDataSink.java
View file @
c4808182
...
@@ -199,7 +199,6 @@ public final class CacheDataSink implements DataSink {
...
@@ -199,7 +199,6 @@ public final class CacheDataSink implements DataSink {
outputStreamBytesWritten
=
0
;
outputStreamBytesWritten
=
0
;
}
}
@SuppressWarnings
(
"ThrowFromFinallyBlock"
)
private
void
closeCurrentOutputStream
()
throws
IOException
{
private
void
closeCurrentOutputStream
()
throws
IOException
{
if
(
outputStream
==
null
)
{
if
(
outputStream
==
null
)
{
return
;
return
;
...
...
library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CachedContentIndex.java
View file @
c4808182
...
@@ -94,7 +94,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
...
@@ -94,7 +94,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
@Nullable
private
Storage
previousStorage
;
@Nullable
private
Storage
previousStorage
;
/** Returns whether the file is an index file. */
/** Returns whether the file is an index file. */
public
static
final
boolean
isIndexFile
(
String
fileName
)
{
public
static
boolean
isIndexFile
(
String
fileName
)
{
// Atomic file backups add additional suffixes to the file name.
// Atomic file backups add additional suffixes to the file name.
return
fileName
.
startsWith
(
FILE_NAME_ATOMIC
);
return
fileName
.
startsWith
(
FILE_NAME_ATOMIC
);
}
}
...
...
library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/SimpleCache.java
View file @
c4808182
...
@@ -780,7 +780,6 @@ public final class SimpleCache implements Cache {
...
@@ -780,7 +780,6 @@ public final class SimpleCache implements Cache {
*
*
* @param files The files belonging to the root directory.
* @param files The files belonging to the root directory.
* @return The loaded UID, or {@link #UID_UNSET} if a UID has not yet been created.
* @return The loaded UID, or {@link #UID_UNSET} if a UID has not yet been created.
* @throws IOException If there is an error loading or generating the UID.
*/
*/
private
static
long
loadUid
(
File
[]
files
)
{
private
static
long
loadUid
(
File
[]
files
)
{
for
(
File
file
:
files
)
{
for
(
File
file
:
files
)
{
...
...
library/core/src/test/java/com/google/android/exoplayer2/offline/ActionFileUpgradeUtilTest.java
View file @
c4808182
...
@@ -198,7 +198,6 @@ public class ActionFileUpgradeUtilTest {
...
@@ -198,7 +198,6 @@ public class ActionFileUpgradeUtilTest {
assertThat
(
download
.
state
).
isEqualTo
(
state
);
assertThat
(
download
.
state
).
isEqualTo
(
state
);
}
}
@SuppressWarnings
(
"unchecked"
)
private
static
List
<
StreamKey
>
asList
(
StreamKey
...
streamKeys
)
{
private
static
List
<
StreamKey
>
asList
(
StreamKey
...
streamKeys
)
{
return
Arrays
.
asList
(
streamKeys
);
return
Arrays
.
asList
(
streamKeys
);
}
}
...
...
library/core/src/test/java/com/google/android/exoplayer2/offline/DownloadManagerTest.java
View file @
c4808182
...
@@ -763,15 +763,10 @@ public class DownloadManagerTest {
...
@@ -763,15 +763,10 @@ public class DownloadManagerTest {
private
void
block
()
throws
InterruptedException
{
private
void
block
()
throws
InterruptedException
{
try
{
try
{
while
(
true
)
{
try
{
blocker
.
block
();
blocker
.
block
();
break
;
}
catch
(
InterruptedException
e
)
{
}
catch
(
InterruptedException
e
)
{
interrupted
=
true
;
interrupted
=
true
;
throw
e
;
throw
e
;
}
}
}
finally
{
}
finally
{
blocker
.
close
();
blocker
.
close
();
}
}
...
...
library/core/src/test/java/com/google/android/exoplayer2/trackselection/AdaptiveTrackSelectionTest.java
View file @
c4808182
...
@@ -266,14 +266,9 @@ public final class AdaptiveTrackSelectionTest {
...
@@ -266,14 +266,9 @@ public final class AdaptiveTrackSelectionTest {
/* mediaChunkIterators= */
THREE_EMPTY_MEDIA_CHUNK_ITERATORS
);
/* mediaChunkIterators= */
THREE_EMPTY_MEDIA_CHUNK_ITERATORS
);
ArgumentMatcher
<
Format
[]>
matcher
=
ArgumentMatcher
<
Format
[]>
matcher
=
new
ArgumentMatcher
<
Format
[]>()
{
formats
->
@Override
formats
.
length
==
3
public
boolean
matches
(
Format
[]
argument
)
{
Format
[]
formats
=
(
Format
[])
argument
;
return
formats
.
length
==
3
&&
Arrays
.
asList
(
formats
).
containsAll
(
Arrays
.
asList
(
format1
,
format2
,
format3
));
&&
Arrays
.
asList
(
formats
).
containsAll
(
Arrays
.
asList
(
format1
,
format2
,
format3
));
}
};
verify
(
estimator
)
verify
(
estimator
)
.
getBitrates
(
.
getBitrates
(
argThat
(
matcher
),
argThat
(
matcher
),
...
...
library/core/src/test/java/com/google/android/exoplayer2/upstream/cache/SimpleCacheTest.java
View file @
c4808182
...
@@ -401,11 +401,8 @@ public class SimpleCacheTest {
...
@@ -401,11 +401,8 @@ public class SimpleCacheTest {
private
static
void
addCache
(
SimpleCache
simpleCache
,
String
key
,
int
position
,
int
length
)
private
static
void
addCache
(
SimpleCache
simpleCache
,
String
key
,
int
position
,
int
length
)
throws
IOException
{
throws
IOException
{
File
file
=
simpleCache
.
startFile
(
key
,
position
,
length
);
File
file
=
simpleCache
.
startFile
(
key
,
position
,
length
);
FileOutputStream
fos
=
new
FileOutputStream
(
file
);
try
(
FileOutputStream
fos
=
new
FileOutputStream
(
file
))
{
try
{
fos
.
write
(
generateData
(
key
,
position
,
length
));
fos
.
write
(
generateData
(
key
,
position
,
length
));
}
finally
{
fos
.
close
();
}
}
simpleCache
.
commitFile
(
file
,
length
);
simpleCache
.
commitFile
(
file
,
length
);
}
}
...
@@ -413,11 +410,8 @@ public class SimpleCacheTest {
...
@@ -413,11 +410,8 @@ public class SimpleCacheTest {
private
static
void
assertCachedDataReadCorrect
(
CacheSpan
cacheSpan
)
throws
IOException
{
private
static
void
assertCachedDataReadCorrect
(
CacheSpan
cacheSpan
)
throws
IOException
{
assertThat
(
cacheSpan
.
isCached
).
isTrue
();
assertThat
(
cacheSpan
.
isCached
).
isTrue
();
byte
[]
expected
=
generateData
(
cacheSpan
.
key
,
(
int
)
cacheSpan
.
position
,
(
int
)
cacheSpan
.
length
);
byte
[]
expected
=
generateData
(
cacheSpan
.
key
,
(
int
)
cacheSpan
.
position
,
(
int
)
cacheSpan
.
length
);
FileInputStream
inputStream
=
new
FileInputStream
(
cacheSpan
.
file
);
try
(
FileInputStream
inputStream
=
new
FileInputStream
(
cacheSpan
.
file
))
{
try
{
assertThat
(
toByteArray
(
inputStream
)).
isEqualTo
(
expected
);
assertThat
(
toByteArray
(
inputStream
)).
isEqualTo
(
expected
);
}
finally
{
inputStream
.
close
();
}
}
}
}
...
...
library/dash/src/main/java/com/google/android/exoplayer2/source/dash/DashMediaPeriod.java
View file @
c4808182
...
@@ -219,9 +219,8 @@ import java.util.regex.Pattern;
...
@@ -219,9 +219,8 @@ import java.util.regex.Pattern;
int
totalTracksInPreviousAdaptationSets
=
0
;
int
totalTracksInPreviousAdaptationSets
=
0
;
int
tracksInCurrentAdaptationSet
=
int
tracksInCurrentAdaptationSet
=
manifestAdaptationSets
.
get
(
adaptationSetIndices
[
0
]).
representations
.
size
();
manifestAdaptationSets
.
get
(
adaptationSetIndices
[
0
]).
representations
.
size
();
for
(
int
i
=
0
;
i
<
trackIndices
.
length
;
i
++)
{
for
(
int
trackIndex
:
trackIndices
)
{
while
(
trackIndices
[
i
]
while
(
trackIndex
>=
totalTracksInPreviousAdaptationSets
+
tracksInCurrentAdaptationSet
)
{
>=
totalTracksInPreviousAdaptationSets
+
tracksInCurrentAdaptationSet
)
{
currentAdaptationSetIndex
++;
currentAdaptationSetIndex
++;
totalTracksInPreviousAdaptationSets
+=
tracksInCurrentAdaptationSet
;
totalTracksInPreviousAdaptationSets
+=
tracksInCurrentAdaptationSet
;
tracksInCurrentAdaptationSet
=
tracksInCurrentAdaptationSet
=
...
@@ -234,7 +233,7 @@ import java.util.regex.Pattern;
...
@@ -234,7 +233,7 @@ import java.util.regex.Pattern;
new
StreamKey
(
new
StreamKey
(
periodIndex
,
periodIndex
,
adaptationSetIndices
[
currentAdaptationSetIndex
],
adaptationSetIndices
[
currentAdaptationSetIndex
],
trackInd
ices
[
i
]
-
totalTracksInPreviousAdaptationSets
));
trackInd
ex
-
totalTracksInPreviousAdaptationSets
));
}
}
}
}
return
streamKeys
;
return
streamKeys
;
...
@@ -515,10 +514,9 @@ import java.util.regex.Pattern;
...
@@ -515,10 +514,9 @@ import java.util.regex.Pattern;
int
[]
adaptationSetIndices
=
new
int
[
1
+
extraAdaptationSetIds
.
length
];
int
[]
adaptationSetIndices
=
new
int
[
1
+
extraAdaptationSetIds
.
length
];
adaptationSetIndices
[
0
]
=
i
;
adaptationSetIndices
[
0
]
=
i
;
int
outputIndex
=
1
;
int
outputIndex
=
1
;
for
(
int
j
=
0
;
j
<
extraAdaptationSetIds
.
length
;
j
++
)
{
for
(
String
adaptationSetId
:
extraAdaptationSetIds
)
{
int
extraIndex
=
int
extraIndex
=
idToIndexMap
.
get
(
idToIndexMap
.
get
(
Integer
.
parseInt
(
adaptationSetId
),
/* valueIfKeyNotFound= */
-
1
);
Integer
.
parseInt
(
extraAdaptationSetIds
[
j
]),
/* valueIfKeyNotFound= */
-
1
);
if
(
extraIndex
!=
-
1
)
{
if
(
extraIndex
!=
-
1
)
{
adaptationSetUsedFlags
[
extraIndex
]
=
true
;
adaptationSetUsedFlags
[
extraIndex
]
=
true
;
adaptationSetIndices
[
outputIndex
]
=
extraIndex
;
adaptationSetIndices
[
outputIndex
]
=
extraIndex
;
...
...
library/dash/src/main/java/com/google/android/exoplayer2/source/dash/manifest/DashManifestParser.java
View file @
c4808182
...
@@ -100,7 +100,7 @@ public class DashManifestParser extends DefaultHandler
...
@@ -100,7 +100,7 @@ public class DashManifestParser extends DefaultHandler
long
durationMs
=
parseDuration
(
xpp
,
"mediaPresentationDuration"
,
C
.
TIME_UNSET
);
long
durationMs
=
parseDuration
(
xpp
,
"mediaPresentationDuration"
,
C
.
TIME_UNSET
);
long
minBufferTimeMs
=
parseDuration
(
xpp
,
"minBufferTime"
,
C
.
TIME_UNSET
);
long
minBufferTimeMs
=
parseDuration
(
xpp
,
"minBufferTime"
,
C
.
TIME_UNSET
);
String
typeString
=
xpp
.
getAttributeValue
(
null
,
"type"
);
String
typeString
=
xpp
.
getAttributeValue
(
null
,
"type"
);
boolean
dynamic
=
typeString
!=
null
&&
"dynamic"
.
equals
(
typeString
);
boolean
dynamic
=
"dynamic"
.
equals
(
typeString
);
long
minUpdateTimeMs
=
dynamic
?
parseDuration
(
xpp
,
"minimumUpdatePeriod"
,
C
.
TIME_UNSET
)
long
minUpdateTimeMs
=
dynamic
?
parseDuration
(
xpp
,
"minimumUpdatePeriod"
,
C
.
TIME_UNSET
)
:
C
.
TIME_UNSET
;
:
C
.
TIME_UNSET
;
long
timeShiftBufferDepthMs
=
dynamic
long
timeShiftBufferDepthMs
=
dynamic
...
...
library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerView.java
View file @
c4808182
...
@@ -17,7 +17,6 @@ package com.google.android.exoplayer2.ui;
...
@@ -17,7 +17,6 @@ package com.google.android.exoplayer2.ui;
import
android.annotation.SuppressLint
;
import
android.annotation.SuppressLint
;
import
android.annotation.TargetApi
;
import
android.annotation.TargetApi
;
import
android.app.Activity
;
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
;
...
@@ -1076,8 +1075,8 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider
...
@@ -1076,8 +1075,8 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider
* Should be called when the player is visible to the user and if {@code surface_type} is {@code
* Should be called when the player is visible to the user and if {@code surface_type} is {@code
* spherical_view}. It is the counterpart to {@link #onPause()}.
* spherical_view}. It is the counterpart to {@link #onPause()}.
*
*
* <p>This method should typically be called in {@
link Activity#onStart()}, or {@link
* <p>This method should typically be called in {@
code Activity.onStart()}, or {@code
* Activity
#
onResume()} for API versions <= 23.
* Activity
.
onResume()} for API versions <= 23.
*/
*/
public
void
onResume
()
{
public
void
onResume
()
{
if
(
surfaceView
instanceof
SphericalSurfaceView
)
{
if
(
surfaceView
instanceof
SphericalSurfaceView
)
{
...
@@ -1089,8 +1088,8 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider
...
@@ -1089,8 +1088,8 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider
* Should be called when the player is no longer visible to the user and if {@code surface_type}
* Should be called when the player is no longer visible to the user and if {@code surface_type}
* is {@code spherical_view}. It is the counterpart to {@link #onResume()}.
* is {@code spherical_view}. It is the counterpart to {@link #onResume()}.
*
*
* <p>This method should typically be called in {@
link Activity#onStop()}, or {@link
* <p>This method should typically be called in {@
code Activity.onStop()}, or {@code
* Activity
#
onPause()} for API versions <= 23.
* Activity
.
onPause()} for API versions <= 23.
*/
*/
public
void
onPause
()
{
public
void
onPause
()
{
if
(
surfaceView
instanceof
SphericalSurfaceView
)
{
if
(
surfaceView
instanceof
SphericalSurfaceView
)
{
...
@@ -1316,7 +1315,6 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider
...
@@ -1316,7 +1315,6 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider
logo
.
setBackgroundColor
(
resources
.
getColor
(
R
.
color
.
exo_edit_mode_background_color
,
null
));
logo
.
setBackgroundColor
(
resources
.
getColor
(
R
.
color
.
exo_edit_mode_background_color
,
null
));
}
}
@SuppressWarnings
(
"deprecation"
)
private
static
void
configureEditModeLogo
(
Resources
resources
,
ImageView
logo
)
{
private
static
void
configureEditModeLogo
(
Resources
resources
,
ImageView
logo
)
{
logo
.
setImageDrawable
(
resources
.
getDrawable
(
R
.
drawable
.
exo_edit_mode_logo
));
logo
.
setImageDrawable
(
resources
.
getDrawable
(
R
.
drawable
.
exo_edit_mode_logo
));
logo
.
setBackgroundColor
(
resources
.
getColor
(
R
.
color
.
exo_edit_mode_background_color
));
logo
.
setBackgroundColor
(
resources
.
getColor
(
R
.
color
.
exo_edit_mode_background_color
));
...
...
library/ui/src/main/java/com/google/android/exoplayer2/ui/spherical/SphericalSurfaceView.java
View file @
c4808182
...
@@ -80,7 +80,6 @@ public final class SphericalSurfaceView extends GLSurfaceView {
...
@@ -80,7 +80,6 @@ public final class SphericalSurfaceView extends GLSurfaceView {
private
final
SensorManager
sensorManager
;
private
final
SensorManager
sensorManager
;
private
final
@Nullable
Sensor
orientationSensor
;
private
final
@Nullable
Sensor
orientationSensor
;
private
final
OrientationListener
orientationListener
;
private
final
OrientationListener
orientationListener
;
private
final
Renderer
renderer
;
private
final
Handler
mainHandler
;
private
final
Handler
mainHandler
;
private
final
TouchTracker
touchTracker
;
private
final
TouchTracker
touchTracker
;
private
final
SceneRenderer
scene
;
private
final
SceneRenderer
scene
;
...
@@ -114,7 +113,7 @@ public final class SphericalSurfaceView extends GLSurfaceView {
...
@@ -114,7 +113,7 @@ public final class SphericalSurfaceView extends GLSurfaceView {
this
.
orientationSensor
=
orientationSensor
;
this
.
orientationSensor
=
orientationSensor
;
scene
=
new
SceneRenderer
();
scene
=
new
SceneRenderer
();
renderer
=
new
Renderer
(
scene
);
Renderer
renderer
=
new
Renderer
(
scene
);
touchTracker
=
new
TouchTracker
(
context
,
renderer
,
PX_PER_DEGREES
);
touchTracker
=
new
TouchTracker
(
context
,
renderer
,
PX_PER_DEGREES
);
WindowManager
windowManager
=
(
WindowManager
)
context
.
getSystemService
(
Context
.
WINDOW_SERVICE
);
WindowManager
windowManager
=
(
WindowManager
)
context
.
getSystemService
(
Context
.
WINDOW_SERVICE
);
...
@@ -332,7 +331,7 @@ public final class SphericalSurfaceView extends GLSurfaceView {
...
@@ -332,7 +331,7 @@ public final class SphericalSurfaceView extends GLSurfaceView {
private
float
calculateFieldOfViewInYDirection
(
float
aspect
)
{
private
float
calculateFieldOfViewInYDirection
(
float
aspect
)
{
boolean
landscapeMode
=
aspect
>
1
;
boolean
landscapeMode
=
aspect
>
1
;
if
(
landscapeMode
)
{
if
(
landscapeMode
)
{
double
halfFovX
=
FIELD_OF_VIEW_DEGREES
/
2
;
double
halfFovX
=
FIELD_OF_VIEW_DEGREES
/
2
f
;
double
tanY
=
Math
.
tan
(
Math
.
toRadians
(
halfFovX
))
/
aspect
;
double
tanY
=
Math
.
tan
(
Math
.
toRadians
(
halfFovX
))
/
aspect
;
double
halfFovY
=
Math
.
toDegrees
(
Math
.
atan
(
tanY
));
double
halfFovY
=
Math
.
toDegrees
(
Math
.
atan
(
tanY
));
return
(
float
)
(
halfFovY
*
2
);
return
(
float
)
(
halfFovY
*
2
);
...
...
testutils_robolectric/src/main/java/com/google/android/exoplayer2/testutil/CacheAsserts.java
View file @
c4808182
...
@@ -114,14 +114,11 @@ public final class CacheAsserts {
...
@@ -114,14 +114,11 @@ public final class CacheAsserts {
*/
*/
public
static
void
assertReadData
(
DataSource
dataSource
,
DataSpec
dataSpec
,
byte
[]
expected
)
public
static
void
assertReadData
(
DataSource
dataSource
,
DataSpec
dataSpec
,
byte
[]
expected
)
throws
IOException
{
throws
IOException
{
DataSourceInputStream
inputStream
=
new
DataSourceInputStream
(
dataSource
,
dataSpec
);
byte
[]
bytes
=
null
;
byte
[]
bytes
=
null
;
try
{
try
(
DataSourceInputStream
inputStream
=
new
DataSourceInputStream
(
dataSource
,
dataSpec
))
{
bytes
=
Util
.
toByteArray
(
inputStream
);
bytes
=
Util
.
toByteArray
(
inputStream
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
// Ignore
// Ignore
}
finally
{
inputStream
.
close
();
}
}
assertThat
(
bytes
).
isEqualTo
(
expected
);
assertThat
(
bytes
).
isEqualTo
(
expected
);
}
}
...
...
testutils_robolectric/src/main/java/com/google/android/exoplayer2/testutil/MediaPeriodAsserts.java
View file @
c4808182
...
@@ -176,8 +176,8 @@ public final class MediaPeriodAsserts {
...
@@ -176,8 +176,8 @@ public final class MediaPeriodAsserts {
for
(
int
i
=
0
;
i
<
trackGroup
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
trackGroup
.
length
;
i
++)
{
allFormats
.
add
(
trackGroup
.
getFormat
(
i
));
allFormats
.
add
(
trackGroup
.
getFormat
(
i
));
}
}
for
(
int
i
=
0
;
i
<
formats
.
length
;
i
++
)
{
for
(
Format
format
:
formats
)
{
if
(!
allFormats
.
remove
(
format
s
[
i
]
))
{
if
(!
allFormats
.
remove
(
format
))
{
return
false
;
return
false
;
}
}
}
}
...
@@ -189,7 +189,7 @@ public final class MediaPeriodAsserts {
...
@@ -189,7 +189,7 @@ public final class MediaPeriodAsserts {
DummyMainThread
dummyMainThread
=
new
DummyMainThread
();
DummyMainThread
dummyMainThread
=
new
DummyMainThread
();
ConditionVariable
preparedCondition
=
new
ConditionVariable
();
ConditionVariable
preparedCondition
=
new
ConditionVariable
();
dummyMainThread
.
runOnMainThread
(
dummyMainThread
.
runOnMainThread
(
()
->
{
()
->
mediaPeriod
.
prepare
(
mediaPeriod
.
prepare
(
new
Callback
()
{
new
Callback
()
{
@Override
@Override
...
@@ -203,8 +203,7 @@ public final class MediaPeriodAsserts {
...
@@ -203,8 +203,7 @@ public final class MediaPeriodAsserts {
// Ignore.
// Ignore.
}
}
},
},
/* positionUs= */
0
);
/* positionUs= */
0
));
});
try
{
try
{
preparedCondition
.
block
();
preparedCondition
.
block
();
}
catch
(
InterruptedException
e
)
{
}
catch
(
InterruptedException
e
)
{
...
...
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