diff --git a/extensions/ima/src/main/java/com/google/android/exoplayer2/ext/ima/ImaAdsLoader.java b/extensions/ima/src/main/java/com/google/android/exoplayer2/ext/ima/ImaAdsLoader.java index 3be28e1b84..40950bceef 100644 --- a/extensions/ima/src/main/java/com/google/android/exoplayer2/ext/ima/ImaAdsLoader.java +++ b/extensions/ima/src/main/java/com/google/android/exoplayer2/ext/ima/ImaAdsLoader.java @@ -21,6 +21,7 @@ import android.os.Looper; import android.os.SystemClock; import android.support.annotation.IntDef; import android.support.annotation.Nullable; +import android.support.annotation.VisibleForTesting; import android.view.ViewGroup; import com.google.ads.interactivemedia.v3.api.Ad; import com.google.ads.interactivemedia.v3.api.AdDisplayContainer; @@ -206,7 +207,7 @@ public final class ImaAdsLoader return this; } - // @VisibleForTesting + @VisibleForTesting /* package */ Builder setImaFactory(ImaFactory imaFactory) { this.imaFactory = Assertions.checkNotNull(imaFactory); return this; @@ -1346,7 +1347,7 @@ public final class ImaAdsLoader } /** Factory for objects provided by the IMA SDK. */ - // @VisibleForTesting + @VisibleForTesting /* package */ interface ImaFactory { /** @see ImaSdkSettings */ ImaSdkSettings createImaSdkSettings(); diff --git a/library/core/src/main/java/com/google/android/exoplayer2/extractor/ogg/DefaultOggSeeker.java b/library/core/src/main/java/com/google/android/exoplayer2/extractor/ogg/DefaultOggSeeker.java index 93ed00a05b..d251dc1d5d 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/extractor/ogg/DefaultOggSeeker.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/extractor/ogg/DefaultOggSeeker.java @@ -15,6 +15,7 @@ */ package com.google.android.exoplayer2.extractor.ogg; +import android.support.annotation.VisibleForTesting; import com.google.android.exoplayer2.ParserException; import com.google.android.exoplayer2.extractor.ExtractorInput; import com.google.android.exoplayer2.extractor.SeekMap; @@ -26,10 +27,8 @@ import java.io.IOException; /** Seeks in an Ogg stream. */ /* package */ final class DefaultOggSeeker implements OggSeeker { - //@VisibleForTesting - public static final int MATCH_RANGE = 72000; - //@VisibleForTesting - public static final int MATCH_BYTE_RANGE = 100000; + @VisibleForTesting public static final int MATCH_RANGE = 72000; + @VisibleForTesting public static final int MATCH_BYTE_RANGE = 100000; private static final int DEFAULT_OFFSET = 30000; private static final int STATE_SEEK_TO_END = 0; @@ -133,7 +132,7 @@ import java.io.IOException; return totalGranules != 0 ? new OggSeekMap() : null; } - //@VisibleForTesting + @VisibleForTesting public void resetSeeking() { start = startPosition; end = endPosition; @@ -150,12 +149,12 @@ import java.io.IOException; * * @param targetGranule the target granule position to seek to. * @param input the {@link ExtractorInput} to read from. - * @return the position to seek the {@link ExtractorInput} to for a next call or - * -(currentGranule + 2) if it's close enough to skip to the target page. + * @return the position to seek the {@link ExtractorInput} to for a next call or -(currentGranule + * + 2) if it's close enough to skip to the target page. * @throws IOException thrown if reading from the input fails. * @throws InterruptedException thrown if interrupted while reading from the input. */ - //@VisibleForTesting + @VisibleForTesting public long getNextSeekPosition(long targetGranule, ExtractorInput input) throws IOException, InterruptedException { if (start == end) { @@ -250,7 +249,7 @@ import java.io.IOException; * @throws InterruptedException If the thread is interrupted. * @throws EOFException If the next page can't be found before the end of the input. */ - // @VisibleForTesting + @VisibleForTesting void skipToNextPage(ExtractorInput input) throws IOException, InterruptedException { if (!skipToNextPage(input, endPosition)) { // Not found until eof. @@ -267,7 +266,7 @@ import java.io.IOException; * @throws IOException thrown if peeking/reading from the input fails. * @throws InterruptedException thrown if interrupted while peeking/reading from the input. */ - // @VisibleForTesting + @VisibleForTesting boolean skipToNextPage(ExtractorInput input, long limit) throws IOException, InterruptedException { limit = Math.min(limit + 3, endPosition); @@ -307,7 +306,7 @@ import java.io.IOException; * @throws IOException If reading from the input fails. * @throws InterruptedException If the thread is interrupted. */ - // @VisibleForTesting + @VisibleForTesting long readGranuleOfLastPage(ExtractorInput input) throws IOException, InterruptedException { skipToNextPage(input); pageHeader.reset(); @@ -319,8 +318,8 @@ import java.io.IOException; } /** - * Skips to the position of the start of the page containing the {@code targetGranule} and - * returns the granule of the page previous to the target page. + * Skips to the position of the start of the page containing the {@code targetGranule} and returns + * the granule of the page previous to the target page. * * @param input the {@link ExtractorInput} to read from. * @param targetGranule the target granule. @@ -331,7 +330,7 @@ import java.io.IOException; * @throws IOException thrown if reading from the input fails. * @throws InterruptedException thrown if interrupted while reading from the input. */ - //@VisibleForTesting + @VisibleForTesting long skipToPageOfGranule(ExtractorInput input, long targetGranule, long currentGranule) throws IOException, InterruptedException { pageHeader.populate(input, false); diff --git a/library/core/src/main/java/com/google/android/exoplayer2/extractor/ogg/OggPacket.java b/library/core/src/main/java/com/google/android/exoplayer2/extractor/ogg/OggPacket.java index 482f0c5021..ca79c838de 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/extractor/ogg/OggPacket.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/extractor/ogg/OggPacket.java @@ -15,6 +15,7 @@ */ package com.google.android.exoplayer2.extractor.ogg; +import android.support.annotation.VisibleForTesting; import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.extractor.ExtractorInput; import com.google.android.exoplayer2.util.Assertions; @@ -103,14 +104,14 @@ import java.util.Arrays; /** * An OGG Packet may span multiple pages. Returns the {@link OggPageHeader} of the last page read, * or an empty header if the packet has yet to be populated. - *
- * Note that the returned {@link OggPageHeader} is mutable and may be updated during subsequent + * + *
Note that the returned {@link OggPageHeader} is mutable and may be updated during subsequent
* calls to {@link #populate(ExtractorInput)}.
*
* @return the {@code PageHeader} of the last page read or an empty header if the packet has yet
* to be populated.
*/
- //@VisibleForTesting
+ @VisibleForTesting
public OggPageHeader getPageHeader() {
return pageHeader;
}
diff --git a/library/core/src/main/java/com/google/android/exoplayer2/extractor/ogg/VorbisReader.java b/library/core/src/main/java/com/google/android/exoplayer2/extractor/ogg/VorbisReader.java
index 147ad5a20b..3c62f7a824 100644
--- a/library/core/src/main/java/com/google/android/exoplayer2/extractor/ogg/VorbisReader.java
+++ b/library/core/src/main/java/com/google/android/exoplayer2/extractor/ogg/VorbisReader.java
@@ -15,6 +15,7 @@
*/
package com.google.android.exoplayer2.extractor.ogg;
+import android.support.annotation.VisibleForTesting;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.ParserException;
import com.google.android.exoplayer2.extractor.ogg.VorbisUtil.Mode;
@@ -107,7 +108,7 @@ import java.util.ArrayList;
return true;
}
- //@VisibleForTesting
+ @VisibleForTesting
/* package */ VorbisSetup readSetupHeaders(ParsableByteArray scratch) throws IOException {
if (vorbisIdHeader == null) {
@@ -133,22 +134,22 @@ import java.util.ArrayList;
}
/**
- * Reads an int of {@code length} bits from {@code src} starting at
- * {@code leastSignificantBitIndex}.
+ * Reads an int of {@code length} bits from {@code src} starting at {@code
+ * leastSignificantBitIndex}.
*
* @param src the {@code byte} to read from.
* @param length the length in bits of the int to read.
* @param leastSignificantBitIndex the index of the least significant bit of the int to read.
* @return the int value read.
*/
- //@VisibleForTesting
+ @VisibleForTesting
/* package */ static int readBits(byte src, int length, int leastSignificantBitIndex) {
return (src >> leastSignificantBitIndex) & (255 >>> (8 - length));
}
- //@VisibleForTesting
- /* package */ static void appendNumberOfSamples(ParsableByteArray buffer,
- long packetSampleCount) {
+ @VisibleForTesting
+ /* package */ static void appendNumberOfSamples(
+ ParsableByteArray buffer, long packetSampleCount) {
buffer.setLimit(buffer.limit() + 4);
// The vorbis decoder expects the number of samples in the packet
diff --git a/library/core/src/main/java/com/google/android/exoplayer2/text/ttml/TtmlSubtitle.java b/library/core/src/main/java/com/google/android/exoplayer2/text/ttml/TtmlSubtitle.java
index 50916aa841..2ac1427e91 100644
--- a/library/core/src/main/java/com/google/android/exoplayer2/text/ttml/TtmlSubtitle.java
+++ b/library/core/src/main/java/com/google/android/exoplayer2/text/ttml/TtmlSubtitle.java
@@ -15,6 +15,7 @@
*/
package com.google.android.exoplayer2.text.ttml;
+import android.support.annotation.VisibleForTesting;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.text.Cue;
import com.google.android.exoplayer2.text.Subtitle;
@@ -58,7 +59,7 @@ import java.util.Map;
return eventTimesUs[index];
}
- /* @VisibleForTesting */
+ @VisibleForTesting
/* package */ TtmlNode getRoot() {
return root;
}
@@ -68,7 +69,7 @@ import java.util.Map;
return root.getCues(timeUs, globalStyles, regionMap);
}
- /* @VisibleForTesting */
+ @VisibleForTesting
/* package */ Map