Skip to content

Commit

Permalink
Fix some lint/analyze errors
Browse files Browse the repository at this point in the history
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179406910
  • Loading branch information
ojw28 committed Jan 2, 2018
1 parent d9bee4d commit 539d291
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -48,6 +49,7 @@ protected void setUp() throws Exception {
protected void tearDown() throws Exception {
offlineLicenseHelper.release();
offlineLicenseHelper = null;
super.tearDown();
}

public void testDownloadRenewReleaseKey() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@ public class CachedContentIndexTest extends InstrumentationTestCase {

@Override
public void setUp() throws Exception {
super.setUp();
cacheDir = Util.createTempDirectory(getInstrumentation().getContext(), "ExoPlayerTest");
index = new CachedContentIndex(cacheDir);
}

@Override
protected void tearDown() throws Exception {
Util.recursiveDelete(cacheDir);
super.tearDown();
}

public void testAddGetRemove() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -56,6 +56,7 @@ protected void setUp() throws Exception {
@Override
protected void tearDown() throws Exception {
Util.recursiveDelete(cacheDir);
super.tearDown();
}

public void testGetRegion_noSpansInCache() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,15 @@ public static CacheSpan createCacheSpan(CachedContentIndex index, File cacheDir,

@Override
protected void setUp() throws Exception {
super.setUp();
cacheDir = Util.createTempDirectory(getInstrumentation().getContext(), "ExoPlayerTest");
index = new CachedContentIndex(cacheDir);
}

@Override
protected void tearDown() throws Exception {
Util.recursiveDelete(cacheDir);
super.tearDown();
}

public void testCacheFile() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public ChannelMappingAudioProcessor() {
/**
* 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ public void queueInput(ByteBuffer inputBuffer) {
resampledSize = size / 2;
break;
case C.ENCODING_PCM_16BIT:
case C.ENCODING_PCM_FLOAT:
case C.ENCODING_INVALID:
case Format.NO_VALUE:
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -176,7 +175,7 @@ private void parseAudioMuxElement(ParsableBitArray data) throws ParserException
* 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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

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;
Expand Down Expand Up @@ -1216,11 +1217,11 @@ public AudioTrackScore(Format format, Parameters parameters, int formatSupport)
* 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,10 @@ public boolean equals(Object obj) {
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -481,11 +481,9 @@ public void run() {

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) {
Expand Down

0 comments on commit 539d291

Please sign in to comment.