Fix some lint/analyze errors

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179406910
This commit is contained in:
olly 2017-12-18 04:44:58 -08:00 committed by Oliver Woodman
parent d9bee4d29c
commit 539d291fce
11 changed files with 24 additions and 17 deletions

View file

@ -38,6 +38,7 @@ public class OfflineLicenseHelperTest extends InstrumentationTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
MockitoUtil.setUpMockito(this);
when(mediaDrm.openSession()).thenReturn(new byte[] {1, 2, 3});
offlineLicenseHelper = new OfflineLicenseHelper<>(C.WIDEVINE_UUID, mediaDrm, mediaDrmCallback,
@ -48,6 +49,7 @@ public class OfflineLicenseHelperTest extends InstrumentationTestCase {
protected void tearDown() throws Exception {
offlineLicenseHelper.release();
offlineLicenseHelper = null;
super.tearDown();
}
public void testDownloadRenewReleaseKey() throws Exception {

View file

@ -69,6 +69,7 @@ public class AdtsReaderTest extends TestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
FakeExtractorOutput fakeExtractorOutput = new FakeExtractorOutput();
adtsOutput = fakeExtractorOutput.track(0, C.TRACK_TYPE_AUDIO);
id3Output = fakeExtractorOutput.track(1, C.TRACK_TYPE_METADATA);

View file

@ -36,6 +36,7 @@ public class CachedContentIndexTest extends InstrumentationTestCase {
@Override
public void setUp() throws Exception {
super.setUp();
cacheDir = Util.createTempDirectory(getInstrumentation().getContext(), "ExoPlayerTest");
index = new CachedContentIndex(cacheDir);
}
@ -43,6 +44,7 @@ public class CachedContentIndexTest extends InstrumentationTestCase {
@Override
protected void tearDown() throws Exception {
Util.recursiveDelete(cacheDir);
super.tearDown();
}
public void testAddGetRemove() throws Exception {

View file

@ -46,8 +46,8 @@ public final class CachedRegionTrackerTest extends InstrumentationTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
MockitoUtil.setUpMockito(this);
tracker = new CachedRegionTracker(cache, CACHE_KEY, CHUNK_INDEX);
cacheDir = Util.createTempDirectory(getInstrumentation().getContext(), "ExoPlayerTest");
index = new CachedContentIndex(cacheDir);
@ -56,6 +56,7 @@ public final class CachedRegionTrackerTest extends InstrumentationTestCase {
@Override
protected void tearDown() throws Exception {
Util.recursiveDelete(cacheDir);
super.tearDown();
}
public void testGetRegion_noSpansInCache() {

View file

@ -48,6 +48,7 @@ public class SimpleCacheSpanTest extends InstrumentationTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
cacheDir = Util.createTempDirectory(getInstrumentation().getContext(), "ExoPlayerTest");
index = new CachedContentIndex(cacheDir);
}
@ -55,6 +56,7 @@ public class SimpleCacheSpanTest extends InstrumentationTestCase {
@Override
protected void tearDown() throws Exception {
Util.recursiveDelete(cacheDir);
super.tearDown();
}
public void testCacheFile() throws Exception {

View file

@ -51,6 +51,8 @@ import java.util.Arrays;
/**
* Resets the channel mapping. After calling this method, call {@link #configure(int, int, int)}
* to start using the new channel map.
*
* @see AudioSink#configure(int, int, int, int, int[], int, int)
*/
public void setChannelMap(int[] outputChannels) {
pendingOutputChannels = outputChannels;

View file

@ -102,6 +102,7 @@ import java.nio.ByteOrder;
resampledSize = size / 2;
break;
case C.ENCODING_PCM_16BIT:
case C.ENCODING_PCM_FLOAT:
case C.ENCODING_INVALID:
case Format.NO_VALUE:
default:

View file

@ -61,7 +61,6 @@ public final class LatmReader implements ElementaryStreamReader {
// Container data.
private boolean streamMuxRead;
private int audioMuxVersion;
private int audioMuxVersionA;
private int numSubframes;
private int frameLengthType;
@ -176,7 +175,7 @@ public final class LatmReader implements ElementaryStreamReader {
* Parses a StreamMuxConfig as defined in ISO/IEC 14496-3:2009 Section 1.7.3.1, Table 1.42.
*/
private void parseStreamMuxConfig(ParsableBitArray data) throws ParserException {
audioMuxVersion = data.readBits(1);
int audioMuxVersion = data.readBits(1);
audioMuxVersionA = audioMuxVersion == 1 ? data.readBits(1) : 0;
if (audioMuxVersionA == 0) {
if (audioMuxVersion == 1) {

View file

@ -17,6 +17,7 @@ package com.google.android.exoplayer2.trackselection;
import android.content.Context;
import android.graphics.Point;
import android.support.annotation.NonNull;
import android.text.TextUtils;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlaybackException;
@ -1216,11 +1217,11 @@ public class DefaultTrackSelector extends MappingTrackSelector {
* Compares the score of the current track format with another {@link AudioTrackScore}.
*
* @param other The other score to compare to.
* @return A positive integer if this score is better than the other. Zero if they are
* equal. A negative integer if this score is worse than the other.
* @return A positive integer if this score is better than the other. Zero if they are equal. A
* negative integer if this score is worse than the other.
*/
@Override
public int compareTo(AudioTrackScore other) {
public int compareTo(@NonNull AudioTrackScore other) {
if (this.withinRendererCapabilitiesScore != other.withinRendererCapabilitiesScore) {
return compareInts(this.withinRendererCapabilitiesScore,
other.withinRendererCapabilitiesScore);

View file

@ -91,12 +91,10 @@ public final class ColorInfo implements Parcelable {
return false;
}
ColorInfo other = (ColorInfo) obj;
if (colorSpace != other.colorSpace || colorRange != other.colorRange
|| colorTransfer != other.colorTransfer
|| !Arrays.equals(hdrStaticInfo, other.hdrStaticInfo)) {
return false;
}
return true;
return colorSpace == other.colorSpace
&& colorRange == other.colorRange
&& colorTransfer == other.colorTransfer
&& Arrays.equals(hdrStaticInfo, other.hdrStaticInfo);
}
@Override

View file

@ -481,11 +481,9 @@ public class FakeSimpleExoPlayer extends SimpleExoPlayer {
private boolean haveSufficientBuffer(boolean rebuffering, long rendererPositionUs,
long bufferedPositionUs) {
if (bufferedPositionUs == C.TIME_END_OF_SOURCE) {
return true;
}
return
loadControl.shouldStartPlayback(bufferedPositionUs - rendererPositionUs, 1f, rebuffering);
return bufferedPositionUs == C.TIME_END_OF_SOURCE
|| loadControl.shouldStartPlayback(
bufferedPositionUs - rendererPositionUs, 1f, rebuffering);
}
private void handlePlayerError(final ExoPlaybackException e) {