Commit 52f3ee81 by samrobinson Committed by microkatz

Handle buffers in DefaultAudioSink with AudioProcessingPipeline.

PiperOrigin-RevId: 488412695
parent 095c52e7
Showing with 163 additions and 158 deletions
...@@ -311,7 +311,7 @@ public class CastTimelineTrackerTest { ...@@ -311,7 +311,7 @@ public class CastTimelineTrackerTest {
} }
private static MediaInfo getMediaInfo(long durationMs) { private static MediaInfo getMediaInfo(long durationMs) {
return new MediaInfo.Builder(/*contentId= */ "") return new MediaInfo.Builder(/* contentId= */ "")
.setStreamDuration(durationMs) .setStreamDuration(durationMs)
.setContentType(MimeTypes.APPLICATION_MP4) .setContentType(MimeTypes.APPLICATION_MP4)
.setStreamType(MediaInfo.STREAM_TYPE_NONE) .setStreamType(MediaInfo.STREAM_TYPE_NONE)
......
...@@ -1157,7 +1157,7 @@ public final class CronetDataSourceTest { ...@@ -1157,7 +1157,7 @@ public final class CronetDataSourceTest {
@Test @Test
public void redirectParseAndAttachCookie_dataSourceDoesNotHandleSetCookie_followsRedirect() public void redirectParseAndAttachCookie_dataSourceDoesNotHandleSetCookie_followsRedirect()
throws HttpDataSourceException { throws HttpDataSourceException {
mockSingleRedirectSuccess(/*responseCode=*/ 300); mockSingleRedirectSuccess(/* responseCode= */ 300);
mockFollowRedirectSuccess(); mockFollowRedirectSuccess();
testResponseHeader.put("Set-Cookie", "testcookie=testcookie; Path=/video"); testResponseHeader.put("Set-Cookie", "testcookie=testcookie; Path=/video");
...@@ -1182,7 +1182,7 @@ public final class CronetDataSourceTest { ...@@ -1182,7 +1182,7 @@ public final class CronetDataSourceTest {
dataSourceUnderTest.addTransferListener(mockTransferListener); dataSourceUnderTest.addTransferListener(mockTransferListener);
dataSourceUnderTest.setRequestProperty("Content-Type", TEST_CONTENT_TYPE); dataSourceUnderTest.setRequestProperty("Content-Type", TEST_CONTENT_TYPE);
mockSingleRedirectSuccess(/*responseCode=*/ 300); mockSingleRedirectSuccess(/* responseCode= */ 300);
testResponseHeader.put("Set-Cookie", "testcookie=testcookie; Path=/video"); testResponseHeader.put("Set-Cookie", "testcookie=testcookie; Path=/video");
...@@ -1210,7 +1210,7 @@ public final class CronetDataSourceTest { ...@@ -1210,7 +1210,7 @@ public final class CronetDataSourceTest {
dataSourceUnderTest.addTransferListener(mockTransferListener); dataSourceUnderTest.addTransferListener(mockTransferListener);
dataSourceUnderTest.setRequestProperty("Content-Type", TEST_CONTENT_TYPE); dataSourceUnderTest.setRequestProperty("Content-Type", TEST_CONTENT_TYPE);
mockSingleRedirectSuccess(/*responseCode=*/ 300); mockSingleRedirectSuccess(/* responseCode= */ 300);
mockReadSuccess(0, 1000); mockReadSuccess(0, 1000);
testResponseHeader.put("Set-Cookie", "testcookie=testcookie; Path=/video"); testResponseHeader.put("Set-Cookie", "testcookie=testcookie; Path=/video");
...@@ -1225,7 +1225,7 @@ public final class CronetDataSourceTest { ...@@ -1225,7 +1225,7 @@ public final class CronetDataSourceTest {
@Test @Test
public void redirectNoSetCookieFollowsRedirect() throws HttpDataSourceException { public void redirectNoSetCookieFollowsRedirect() throws HttpDataSourceException {
mockSingleRedirectSuccess(/*responseCode=*/ 300); mockSingleRedirectSuccess(/* responseCode= */ 300);
mockFollowRedirectSuccess(); mockFollowRedirectSuccess();
dataSourceUnderTest.open(testDataSpec); dataSourceUnderTest.open(testDataSpec);
...@@ -1245,7 +1245,7 @@ public final class CronetDataSourceTest { ...@@ -1245,7 +1245,7 @@ public final class CronetDataSourceTest {
.setHandleSetCookieRequests(true) .setHandleSetCookieRequests(true)
.createDataSource(); .createDataSource();
dataSourceUnderTest.addTransferListener(mockTransferListener); dataSourceUnderTest.addTransferListener(mockTransferListener);
mockSingleRedirectSuccess(/*responseCode=*/ 300); mockSingleRedirectSuccess(/* responseCode= */ 300);
mockFollowRedirectSuccess(); mockFollowRedirectSuccess();
dataSourceUnderTest.open(testDataSpec); dataSourceUnderTest.open(testDataSpec);
...@@ -1255,7 +1255,7 @@ public final class CronetDataSourceTest { ...@@ -1255,7 +1255,7 @@ public final class CronetDataSourceTest {
@Test @Test
public void redirectPostFollowRedirect() throws HttpDataSourceException { public void redirectPostFollowRedirect() throws HttpDataSourceException {
mockSingleRedirectSuccess(/*responseCode=*/ 302); mockSingleRedirectSuccess(/* responseCode= */ 302);
mockFollowRedirectSuccess(); mockFollowRedirectSuccess();
dataSourceUnderTest.setRequestProperty("Content-Type", TEST_CONTENT_TYPE); dataSourceUnderTest.setRequestProperty("Content-Type", TEST_CONTENT_TYPE);
...@@ -1275,7 +1275,7 @@ public final class CronetDataSourceTest { ...@@ -1275,7 +1275,7 @@ public final class CronetDataSourceTest {
.setKeepPostFor302Redirects(false) .setKeepPostFor302Redirects(false)
.setHandleSetCookieRequests(true) .setHandleSetCookieRequests(true)
.createDataSource(); .createDataSource();
mockSingleRedirectSuccess(/*responseCode=*/ 302); mockSingleRedirectSuccess(/* responseCode= */ 302);
dataSourceUnderTest.setRequestProperty("Content-Type", TEST_CONTENT_TYPE); dataSourceUnderTest.setRequestProperty("Content-Type", TEST_CONTENT_TYPE);
testResponseHeader.put("Set-Cookie", "testcookie=testcookie; Path=/video"); testResponseHeader.put("Set-Cookie", "testcookie=testcookie; Path=/video");
...@@ -1297,7 +1297,7 @@ public final class CronetDataSourceTest { ...@@ -1297,7 +1297,7 @@ public final class CronetDataSourceTest {
.setResetTimeoutOnRedirects(true) .setResetTimeoutOnRedirects(true)
.setKeepPostFor302Redirects(true) .setKeepPostFor302Redirects(true)
.createDataSource(); .createDataSource();
mockSingleRedirectSuccess(/*responseCode=*/ 302); mockSingleRedirectSuccess(/* responseCode= */ 302);
dataSourceUnderTest.setRequestProperty("Content-Type", TEST_CONTENT_TYPE); dataSourceUnderTest.setRequestProperty("Content-Type", TEST_CONTENT_TYPE);
dataSourceUnderTest.open(testPostDataSpec); dataSourceUnderTest.open(testPostDataSpec);
......
...@@ -680,7 +680,7 @@ public final class ImaServerSideAdInsertionMediaSource extends CompositeMediaSou ...@@ -680,7 +680,7 @@ public final class ImaServerSideAdInsertionMediaSource extends CompositeMediaSou
adPlaybackState, adPlaybackState,
/* fromPositionUs= */ fromPositionUs, /* fromPositionUs= */ fromPositionUs,
/* contentResumeOffsetUs= */ 0, /* contentResumeOffsetUs= */ 0,
/* adDurationsUs...= */ getAdDuration( /* adDurationsUs= */ getAdDuration(
/* startTimeSeconds= */ cuePoint.getStartTime(), /* startTimeSeconds= */ cuePoint.getStartTime(),
/* endTimeSeconds= */ cuePoint.getEndTime())); /* endTimeSeconds= */ cuePoint.getEndTime()));
} }
......
...@@ -443,7 +443,7 @@ import java.util.Set; ...@@ -443,7 +443,7 @@ import java.util.Set;
private static AdPlaybackState splitAdGroupForPeriod( private static AdPlaybackState splitAdGroupForPeriod(
Object adsId, AdGroup adGroup, long periodStartUs, long periodDurationUs) { Object adsId, AdGroup adGroup, long periodStartUs, long periodDurationUs) {
AdPlaybackState adPlaybackState = AdPlaybackState adPlaybackState =
new AdPlaybackState(checkNotNull(adsId), /* adGroupTimesUs...= */ 0) new AdPlaybackState(checkNotNull(adsId), /* adGroupTimesUs= */ 0)
.withAdCount(/* adGroupIndex= */ 0, /* adCount= */ 1) .withAdCount(/* adGroupIndex= */ 0, /* adCount= */ 1)
.withAdDurationsUs(/* adGroupIndex= */ 0, periodDurationUs) .withAdDurationsUs(/* adGroupIndex= */ 0, periodDurationUs)
.withIsServerSideInserted(/* adGroupIndex= */ 0, true) .withIsServerSideInserted(/* adGroupIndex= */ 0, true)
...@@ -605,7 +605,7 @@ import java.util.Set; ...@@ -605,7 +605,7 @@ import java.util.Set;
adPlaybackState, adPlaybackState,
/* fromPositionUs= */ currentContentPeriodPositionUs, /* fromPositionUs= */ currentContentPeriodPositionUs,
/* contentResumeOffsetUs= */ sum(adDurationsUs), /* contentResumeOffsetUs= */ sum(adDurationsUs),
/* adDurationsUs...= */ adDurationsUs); /* adDurationsUs= */ adDurationsUs);
adGroupIndex = adGroupIndex =
adPlaybackState.getAdGroupIndexForPositionUs( adPlaybackState.getAdGroupIndexForPositionUs(
mediaPeriodPositionUs, /* periodDurationUs= */ C.TIME_UNSET); mediaPeriodPositionUs, /* periodDurationUs= */ C.TIME_UNSET);
......
...@@ -239,7 +239,7 @@ public final class ImaAdsLoaderTest { ...@@ -239,7 +239,7 @@ public final class ImaAdsLoaderTest {
assertThat(getAdPlaybackState(/* periodIndex= */ 0)) assertThat(getAdPlaybackState(/* periodIndex= */ 0))
.isEqualTo( .isEqualTo(
new AdPlaybackState(TEST_ADS_ID, /* adGroupTimesUs...= */ 0) new AdPlaybackState(TEST_ADS_ID, /* adGroupTimesUs= */ 0)
.withContentDurationUs(CONTENT_PERIOD_DURATION_US)); .withContentDurationUs(CONTENT_PERIOD_DURATION_US));
} }
...@@ -312,7 +312,7 @@ public final class ImaAdsLoaderTest { ...@@ -312,7 +312,7 @@ public final class ImaAdsLoaderTest {
// Verify that the preroll ad has been marked as played. // Verify that the preroll ad has been marked as played.
assertThat(getAdPlaybackState(/* periodIndex= */ 0)) assertThat(getAdPlaybackState(/* periodIndex= */ 0))
.isEqualTo( .isEqualTo(
new AdPlaybackState(TEST_ADS_ID, /* adGroupTimesUs...= */ 0) new AdPlaybackState(TEST_ADS_ID, /* adGroupTimesUs= */ 0)
.withContentDurationUs(CONTENT_PERIOD_DURATION_US) .withContentDurationUs(CONTENT_PERIOD_DURATION_US)
.withAdCount(/* adGroupIndex= */ 0, /* adCount= */ 1) .withAdCount(/* adGroupIndex= */ 0, /* adCount= */ 1)
.withAvailableAdUri(/* adGroupIndex= */ 0, /* adIndexInAdGroup= */ 0, TEST_URI) .withAvailableAdUri(/* adGroupIndex= */ 0, /* adIndexInAdGroup= */ 0, TEST_URI)
...@@ -336,7 +336,7 @@ public final class ImaAdsLoaderTest { ...@@ -336,7 +336,7 @@ public final class ImaAdsLoaderTest {
assertThat(getAdPlaybackState(/* periodIndex= */ 0)) assertThat(getAdPlaybackState(/* periodIndex= */ 0))
.isEqualTo( .isEqualTo(
new AdPlaybackState(TEST_ADS_ID, /* adGroupTimesUs...= */ 20_500_000) new AdPlaybackState(TEST_ADS_ID, /* adGroupTimesUs= */ 20_500_000)
.withContentDurationUs(CONTENT_PERIOD_DURATION_US) .withContentDurationUs(CONTENT_PERIOD_DURATION_US)
.withAdDurationsUs(new long[][] {{TEST_AD_DURATION_US}}) .withAdDurationsUs(new long[][] {{TEST_AD_DURATION_US}})
.withAdCount(/* adGroupIndex= */ 0, /* adCount= */ 1) .withAdCount(/* adGroupIndex= */ 0, /* adCount= */ 1)
...@@ -384,7 +384,7 @@ public final class ImaAdsLoaderTest { ...@@ -384,7 +384,7 @@ public final class ImaAdsLoaderTest {
assertThat(getAdPlaybackState(/* periodIndex= */ 0)) assertThat(getAdPlaybackState(/* periodIndex= */ 0))
.isEqualTo( .isEqualTo(
new AdPlaybackState(TEST_ADS_ID, /* adGroupTimesUs...= */ C.TIME_END_OF_SOURCE) new AdPlaybackState(TEST_ADS_ID, /* adGroupTimesUs= */ C.TIME_END_OF_SOURCE)
.withContentDurationUs(CONTENT_PERIOD_DURATION_US) .withContentDurationUs(CONTENT_PERIOD_DURATION_US)
.withAdDurationsUs(new long[][] {{TEST_AD_DURATION_US}}) .withAdDurationsUs(new long[][] {{TEST_AD_DURATION_US}})
.withAdCount(/* adGroupIndex= */ 0, /* adCount= */ 1) .withAdCount(/* adGroupIndex= */ 0, /* adCount= */ 1)
...@@ -1114,7 +1114,7 @@ public final class ImaAdsLoaderTest { ...@@ -1114,7 +1114,7 @@ public final class ImaAdsLoaderTest {
// Verify that the preroll ad has been marked as played. // Verify that the preroll ad has been marked as played.
assertThat(getAdPlaybackState(/* periodIndex= */ 0)) assertThat(getAdPlaybackState(/* periodIndex= */ 0))
.isEqualTo( .isEqualTo(
new AdPlaybackState(TEST_ADS_ID, /* adGroupTimesUs...= */ 0) new AdPlaybackState(TEST_ADS_ID, /* adGroupTimesUs= */ 0)
.withContentDurationUs(CONTENT_PERIOD_DURATION_US) .withContentDurationUs(CONTENT_PERIOD_DURATION_US)
.withAdCount(/* adGroupIndex= */ 0, /* adCount= */ 1) .withAdCount(/* adGroupIndex= */ 0, /* adCount= */ 1)
.withAvailableAdUri(/* adGroupIndex= */ 0, /* adIndexInAdGroup= */ 0, TEST_URI) .withAvailableAdUri(/* adGroupIndex= */ 0, /* adIndexInAdGroup= */ 0, TEST_URI)
...@@ -1123,7 +1123,7 @@ public final class ImaAdsLoaderTest { ...@@ -1123,7 +1123,7 @@ public final class ImaAdsLoaderTest {
.withAdResumePositionUs(/* adResumePositionUs= */ 0)); .withAdResumePositionUs(/* adResumePositionUs= */ 0));
// Verify that the second source's ad cue points have preloaded. // Verify that the second source's ad cue points have preloaded.
assertThat(getAdPlaybackState(/* periodIndex= */ 1)) assertThat(getAdPlaybackState(/* periodIndex= */ 1))
.isEqualTo(new AdPlaybackState(secondAdsId, /* adGroupTimesUs...= */ 0)); .isEqualTo(new AdPlaybackState(secondAdsId, /* adGroupTimesUs= */ 0));
} }
@Test @Test
...@@ -1181,7 +1181,7 @@ public final class ImaAdsLoaderTest { ...@@ -1181,7 +1181,7 @@ public final class ImaAdsLoaderTest {
// Verify that the preroll ad has been marked as played. // Verify that the preroll ad has been marked as played.
assertThat(getAdPlaybackState(/* periodIndex= */ 0)) assertThat(getAdPlaybackState(/* periodIndex= */ 0))
.isEqualTo( .isEqualTo(
new AdPlaybackState(TEST_ADS_ID, /* adGroupTimesUs...= */ 0) new AdPlaybackState(TEST_ADS_ID, /* adGroupTimesUs= */ 0)
.withContentDurationUs(CONTENT_PERIOD_DURATION_US) .withContentDurationUs(CONTENT_PERIOD_DURATION_US)
.withAdCount(/* adGroupIndex= */ 0, /* adCount= */ 1) .withAdCount(/* adGroupIndex= */ 0, /* adCount= */ 1)
.withAvailableAdUri(/* adGroupIndex= */ 0, /* adIndexInAdGroup= */ 0, TEST_URI) .withAvailableAdUri(/* adGroupIndex= */ 0, /* adIndexInAdGroup= */ 0, TEST_URI)
...@@ -1190,7 +1190,7 @@ public final class ImaAdsLoaderTest { ...@@ -1190,7 +1190,7 @@ public final class ImaAdsLoaderTest {
.withAdResumePositionUs(/* adResumePositionUs= */ 0)); .withAdResumePositionUs(/* adResumePositionUs= */ 0));
// Verify that the second source's ad cue points have preloaded. // Verify that the second source's ad cue points have preloaded.
assertThat(getAdPlaybackState(/* periodIndex= */ 1)) assertThat(getAdPlaybackState(/* periodIndex= */ 1))
.isEqualTo(new AdPlaybackState(secondAdsId, /* adGroupTimesUs...= */ 0)); .isEqualTo(new AdPlaybackState(secondAdsId, /* adGroupTimesUs= */ 0));
} }
@Test @Test
......
...@@ -37,7 +37,7 @@ public class ImaServerSideAdInsertionMediaSourceTest { ...@@ -37,7 +37,7 @@ public class ImaServerSideAdInsertionMediaSourceTest {
new AdPlaybackState("adsId1"), new AdPlaybackState("adsId1"),
/* fromPositionUs= */ 0, /* fromPositionUs= */ 0,
/* contentResumeOffsetUs= */ 10, /* contentResumeOffsetUs= */ 10,
/* adDurationsUs...= */ 5_000_000, /* adDurationsUs= */ 5_000_000,
10_000_000, 10_000_000,
20_000_000); 20_000_000);
AdPlaybackState secondAdPlaybackState = AdPlaybackState secondAdPlaybackState =
...@@ -45,20 +45,20 @@ public class ImaServerSideAdInsertionMediaSourceTest { ...@@ -45,20 +45,20 @@ public class ImaServerSideAdInsertionMediaSourceTest {
new AdPlaybackState("adsId2"), new AdPlaybackState("adsId2"),
/* fromPositionUs= */ 0, /* fromPositionUs= */ 0,
/* contentResumeOffsetUs= */ 10, /* contentResumeOffsetUs= */ 10,
/* adDurationsUs...= */ 10_000_000) /* adDurationsUs= */ 10_000_000)
.withPlayedAd(/* adGroupIndex= */ 0, /* adIndexInAdGroup= */ 0); .withPlayedAd(/* adGroupIndex= */ 0, /* adIndexInAdGroup= */ 0);
AdPlaybackState thirdAdPlaybackState = AdPlaybackState thirdAdPlaybackState =
ServerSideAdInsertionUtil.addAdGroupToAdPlaybackState( ServerSideAdInsertionUtil.addAdGroupToAdPlaybackState(
new AdPlaybackState("adsId3"), new AdPlaybackState("adsId3"),
/* fromPositionUs= */ C.TIME_END_OF_SOURCE, /* fromPositionUs= */ C.TIME_END_OF_SOURCE,
/* contentResumeOffsetUs= */ 10, /* contentResumeOffsetUs= */ 10,
/* adDurationsUs...= */ 10_000_000); /* adDurationsUs= */ 10_000_000);
thirdAdPlaybackState = thirdAdPlaybackState =
ServerSideAdInsertionUtil.addAdGroupToAdPlaybackState( ServerSideAdInsertionUtil.addAdGroupToAdPlaybackState(
thirdAdPlaybackState, thirdAdPlaybackState,
/* fromPositionUs= */ 0, /* fromPositionUs= */ 0,
/* contentResumeOffsetUs= */ 10, /* contentResumeOffsetUs= */ 10,
/* adDurationsUs...= */ 10_000_000) /* adDurationsUs= */ 10_000_000)
.withRemovedAdGroupCount(1); .withRemovedAdGroupCount(1);
State state = State state =
new State( new State(
......
...@@ -435,7 +435,7 @@ public class ImaUtilTest { ...@@ -435,7 +435,7 @@ public class ImaUtilTest {
new AdPlaybackState(/* adsId= */ "adsId", 0) new AdPlaybackState(/* adsId= */ "adsId", 0)
.withAdCount(/* adGroupIndex= */ 0, periodCount) .withAdCount(/* adGroupIndex= */ 0, periodCount)
.withAdDurationsUs( .withAdDurationsUs(
/* adGroupIndex= */ 0, /* adDurationsUs...= */ /* adGroupIndex= */ 0, /* adDurationsUs= */
DEFAULT_WINDOW_OFFSET_IN_FIRST_PERIOD_US + periodDurationUs, DEFAULT_WINDOW_OFFSET_IN_FIRST_PERIOD_US + periodDurationUs,
periodDurationUs, periodDurationUs,
periodDurationUs, periodDurationUs,
...@@ -475,12 +475,10 @@ public class ImaUtilTest { ...@@ -475,12 +475,10 @@ public class ImaUtilTest {
.withAdCount(/* adGroupIndex= */ 1, 1) .withAdCount(/* adGroupIndex= */ 1, 1)
.withAdCount(/* adGroupIndex= */ 2, 1) .withAdCount(/* adGroupIndex= */ 2, 1)
.withAdDurationsUs( .withAdDurationsUs(
/* adGroupIndex= */ 0, /* adDurationsUs...= */ /* adGroupIndex= */ 0, /* adDurationsUs= */
DEFAULT_WINDOW_OFFSET_IN_FIRST_PERIOD_US + (2 * periodDurationUs)) DEFAULT_WINDOW_OFFSET_IN_FIRST_PERIOD_US + (2 * periodDurationUs))
.withAdDurationsUs( .withAdDurationsUs(/* adGroupIndex= */ 1, /* adDurationsUs= */ (2 * periodDurationUs))
/* adGroupIndex= */ 1, /* adDurationsUs...= */ (2 * periodDurationUs)) .withAdDurationsUs(/* adGroupIndex= */ 2, /* adDurationsUs= */ (2 * periodDurationUs))
.withAdDurationsUs(
/* adGroupIndex= */ 2, /* adDurationsUs...= */ (2 * periodDurationUs))
.withPlayedAd(/* adGroupIndex= */ 0, /* adIndexInAdGroup= */ 0) .withPlayedAd(/* adGroupIndex= */ 0, /* adIndexInAdGroup= */ 0)
.withPlayedAd(/* adGroupIndex= */ 1, /* adIndexInAdGroup= */ 0) .withPlayedAd(/* adGroupIndex= */ 1, /* adIndexInAdGroup= */ 0)
.withIsServerSideInserted(/* adGroupIndex= */ 0, true) .withIsServerSideInserted(/* adGroupIndex= */ 0, true)
...@@ -522,7 +520,7 @@ public class ImaUtilTest { ...@@ -522,7 +520,7 @@ public class ImaUtilTest {
// around removed. // around removed.
DEFAULT_WINDOW_OFFSET_IN_FIRST_PERIOD_US + periodDurationUs + 2) DEFAULT_WINDOW_OFFSET_IN_FIRST_PERIOD_US + periodDurationUs + 2)
.withAdCount(/* adGroupIndex= */ 0, 1) .withAdCount(/* adGroupIndex= */ 0, 1)
.withAdDurationsUs(/* adGroupIndex= */ 0, /* adDurationsUs...= */ periodDurationUs) .withAdDurationsUs(/* adGroupIndex= */ 0, /* adDurationsUs= */ periodDurationUs)
.withIsServerSideInserted(/* adGroupIndex= */ 0, true); .withIsServerSideInserted(/* adGroupIndex= */ 0, true);
FakeTimeline timeline = FakeTimeline timeline =
new FakeTimeline( new FakeTimeline(
...@@ -545,7 +543,7 @@ public class ImaUtilTest { ...@@ -545,7 +543,7 @@ public class ImaUtilTest {
AdPlaybackState adPlaybackState = AdPlaybackState adPlaybackState =
new AdPlaybackState(/* adsId= */ "adsId", periodDurationUs - 1) new AdPlaybackState(/* adsId= */ "adsId", periodDurationUs - 1)
.withAdCount(/* adGroupIndex= */ 0, 1) .withAdCount(/* adGroupIndex= */ 0, 1)
.withAdDurationsUs(/* adGroupIndex= */ 0, /* adDurationsUs...= */ periodDurationUs) .withAdDurationsUs(/* adGroupIndex= */ 0, /* adDurationsUs= */ periodDurationUs)
.withIsServerSideInserted(/* adGroupIndex= */ 0, true); .withIsServerSideInserted(/* adGroupIndex= */ 0, true);
FakeTimeline timeline = FakeTimeline timeline =
new FakeTimeline( new FakeTimeline(
...@@ -569,7 +567,7 @@ public class ImaUtilTest { ...@@ -569,7 +567,7 @@ public class ImaUtilTest {
AdPlaybackState.NONE, AdPlaybackState.NONE,
/* fromPositionUs= */ 0, /* fromPositionUs= */ 0,
/* contentResumeOffsetUs= */ 0, /* contentResumeOffsetUs= */ 0,
/* adDurationsUs...= */ 30_000_000); /* adDurationsUs= */ 30_000_000);
adPlaybackState = adPlaybackState =
ImaUtil.expandAdGroupPlaceholder( ImaUtil.expandAdGroupPlaceholder(
...@@ -594,7 +592,7 @@ public class ImaUtilTest { ...@@ -594,7 +592,7 @@ public class ImaUtilTest {
AdPlaybackState.NONE, AdPlaybackState.NONE,
/* fromPositionUs= */ 0, /* fromPositionUs= */ 0,
/* contentResumeOffsetUs= */ 0, /* contentResumeOffsetUs= */ 0,
/* adDurationsUs...= */ 30_000_000); /* adDurationsUs= */ 30_000_000);
adPlaybackState = adPlaybackState =
ImaUtil.expandAdGroupPlaceholder( ImaUtil.expandAdGroupPlaceholder(
...@@ -619,7 +617,7 @@ public class ImaUtilTest { ...@@ -619,7 +617,7 @@ public class ImaUtilTest {
AdPlaybackState.NONE, AdPlaybackState.NONE,
/* fromPositionUs= */ 0, /* fromPositionUs= */ 0,
/* contentResumeOffsetUs= */ 0, /* contentResumeOffsetUs= */ 0,
/* adDurationsUs...= */ 30_000_000); /* adDurationsUs= */ 30_000_000);
adPlaybackState = adPlaybackState =
ImaUtil.expandAdGroupPlaceholder( ImaUtil.expandAdGroupPlaceholder(
...@@ -644,7 +642,7 @@ public class ImaUtilTest { ...@@ -644,7 +642,7 @@ public class ImaUtilTest {
AdPlaybackState.NONE, AdPlaybackState.NONE,
/* fromPositionUs= */ 0, /* fromPositionUs= */ 0,
/* contentResumeOffsetUs= */ 0, /* contentResumeOffsetUs= */ 0,
/* adDurationsUs...= */ 30_000_000); /* adDurationsUs= */ 30_000_000);
adPlaybackState = adPlaybackState =
ImaUtil.expandAdGroupPlaceholder( ImaUtil.expandAdGroupPlaceholder(
...@@ -667,7 +665,7 @@ public class ImaUtilTest { ...@@ -667,7 +665,7 @@ public class ImaUtilTest {
AdPlaybackState.NONE, AdPlaybackState.NONE,
/* fromPositionUs= */ 0, /* fromPositionUs= */ 0,
/* contentResumeOffsetUs= */ 0, /* contentResumeOffsetUs= */ 0,
/* adDurationsUs...= */ 10_000_001); /* adDurationsUs= */ 10_000_001);
adPlaybackState = adPlaybackState =
ImaUtil.expandAdGroupPlaceholder( ImaUtil.expandAdGroupPlaceholder(
...@@ -690,7 +688,7 @@ public class ImaUtilTest { ...@@ -690,7 +688,7 @@ public class ImaUtilTest {
AdPlaybackState.NONE, AdPlaybackState.NONE,
/* fromPositionUs= */ 0, /* fromPositionUs= */ 0,
/* contentResumeOffsetUs= */ 0, /* contentResumeOffsetUs= */ 0,
/* adDurationsUs...= */ 30_000_000); /* adDurationsUs= */ 30_000_000);
adPlaybackState = adPlaybackState =
ImaUtil.expandAdGroupPlaceholder( ImaUtil.expandAdGroupPlaceholder(
...@@ -714,7 +712,7 @@ public class ImaUtilTest { ...@@ -714,7 +712,7 @@ public class ImaUtilTest {
AdPlaybackState.NONE, AdPlaybackState.NONE,
/* fromPositionUs= */ 0, /* fromPositionUs= */ 0,
/* contentResumeOffsetUs= */ 0, /* contentResumeOffsetUs= */ 0,
/* adDurationsUs...= */ 10_000_000, /* adDurationsUs= */ 10_000_000,
20_000_000, 20_000_000,
0); 0);
...@@ -739,7 +737,7 @@ public class ImaUtilTest { ...@@ -739,7 +737,7 @@ public class ImaUtilTest {
AdPlaybackState.NONE, AdPlaybackState.NONE,
/* fromPositionUs= */ 0, /* fromPositionUs= */ 0,
/* contentResumeOffsetUs= */ 0, /* contentResumeOffsetUs= */ 0,
/* adDurationsUs...= */ 0, /* adDurationsUs= */ 0,
10_000_000, 10_000_000,
20_000_000); 20_000_000);
...@@ -764,7 +762,7 @@ public class ImaUtilTest { ...@@ -764,7 +762,7 @@ public class ImaUtilTest {
AdPlaybackState.NONE, AdPlaybackState.NONE,
/* fromPositionUs= */ 0, /* fromPositionUs= */ 0,
/* contentResumeOffsetUs= */ 0, /* contentResumeOffsetUs= */ 0,
/* adDurationsUs...= */ 5_000_000, /* adDurationsUs= */ 5_000_000,
10_000_000, 10_000_000,
20_000_000); 20_000_000);
......
...@@ -264,7 +264,7 @@ public final class LeanbackPlayerAdapter extends PlayerAdapter implements Runnab ...@@ -264,7 +264,7 @@ public final class LeanbackPlayerAdapter extends PlayerAdapter implements Runnab
// int arguments (int what, int extra). Since PlaybackException defines a single error // int arguments (int what, int extra). Since PlaybackException defines a single error
// code, we pass 0 as the extra. // code, we pass 0 as the extra.
context.getString( context.getString(
R.string.lb_media_player_error, /* formatArgs...= */ error.errorCode, 0)); R.string.lb_media_player_error, /* formatArgs= */ error.errorCode, 0));
} }
} }
......
...@@ -35,6 +35,13 @@ public interface AudioProcessor { ...@@ -35,6 +35,13 @@ public interface AudioProcessor {
/** PCM audio format that may be handled by an audio processor. */ /** PCM audio format that may be handled by an audio processor. */
final class AudioFormat { final class AudioFormat {
/**
* An {@link AudioFormat} instance to represent an unset {@link AudioFormat}. This should not be
* returned by {@link #configure(AudioFormat)} if the processor {@link #isActive()}.
*
* <p>Typically used to represent an inactive {@link AudioProcessor} {@linkplain
* #configure(AudioFormat) output format}.
*/
public static final AudioFormat NOT_SET = public static final AudioFormat NOT_SET =
new AudioFormat( new AudioFormat(
/* sampleRate= */ Format.NO_VALUE, /* sampleRate= */ Format.NO_VALUE,
......
...@@ -327,7 +327,7 @@ public final class GlProgram { ...@@ -327,7 +327,7 @@ public final class GlProgram {
/* unusedLength */ new int[1], /* unusedLength */ new int[1],
/* lengthOffset= */ 0, /* lengthOffset= */ 0,
/* unusedSize */ new int[1], /* unusedSize */ new int[1],
/*sizeOffset= */ 0, /* sizeOffset= */ 0,
type, type,
/* typeOffset= */ 0, /* typeOffset= */ 0,
nameBytes, nameBytes,
......
...@@ -81,7 +81,7 @@ public class AdPlaybackStateTest { ...@@ -81,7 +81,7 @@ public class AdPlaybackStateTest {
@Test @Test
public void withAdGroupTimeUs_updatesAdGroupTimeUs() { public void withAdGroupTimeUs_updatesAdGroupTimeUs() {
AdPlaybackState state = AdPlaybackState state =
new AdPlaybackState(TEST_ADS_ID, /* adGroupTimesUs...= */ 0, 5_000, 10_000) new AdPlaybackState(TEST_ADS_ID, /* adGroupTimesUs= */ 0, 5_000, 10_000)
.withRemovedAdGroupCount(1); .withRemovedAdGroupCount(1);
state = state =
...@@ -97,7 +97,7 @@ public class AdPlaybackStateTest { ...@@ -97,7 +97,7 @@ public class AdPlaybackStateTest {
@Test @Test
public void withNewAdGroup_addsGroupAndKeepsExistingGroups() { public void withNewAdGroup_addsGroupAndKeepsExistingGroups() {
AdPlaybackState state = AdPlaybackState state =
new AdPlaybackState(TEST_ADS_ID, /* adGroupTimesUs...= */ 0, 3_000, 6_000) new AdPlaybackState(TEST_ADS_ID, /* adGroupTimesUs= */ 0, 3_000, 6_000)
.withRemovedAdGroupCount(1) .withRemovedAdGroupCount(1)
.withAdCount(/* adGroupIndex= */ 1, /* adCount= */ 2) .withAdCount(/* adGroupIndex= */ 1, /* adCount= */ 2)
.withAdCount(/* adGroupIndex= */ 2, /* adCount= */ 1) .withAdCount(/* adGroupIndex= */ 2, /* adCount= */ 1)
...@@ -123,12 +123,12 @@ public class AdPlaybackStateTest { ...@@ -123,12 +123,12 @@ public class AdPlaybackStateTest {
@Test @Test
public void withAdDurationsUs_updatesAdDurations() { public void withAdDurationsUs_updatesAdDurations() {
AdPlaybackState state = AdPlaybackState state =
new AdPlaybackState(TEST_ADS_ID, /* adGroupTimesUs...= */ 0, 10_000) new AdPlaybackState(TEST_ADS_ID, /* adGroupTimesUs= */ 0, 10_000)
.withAdCount(/* adGroupIndex= */ 0, /* adCount= */ 2) .withAdCount(/* adGroupIndex= */ 0, /* adCount= */ 2)
.withAdCount(/* adGroupIndex= */ 1, /* adCount= */ 2) .withAdCount(/* adGroupIndex= */ 1, /* adCount= */ 2)
.withAdDurationsUs(new long[][] {new long[] {5_000, 6_000}, new long[] {7_000, 8_000}}); .withAdDurationsUs(new long[][] {new long[] {5_000, 6_000}, new long[] {7_000, 8_000}});
state = state.withAdDurationsUs(/* adGroupIndex= */ 1, /* adDurationsUs...= */ 1_000, 2_000); state = state.withAdDurationsUs(/* adGroupIndex= */ 1, /* adDurationsUs= */ 1_000, 2_000);
assertThat(state.getAdGroup(0).durationsUs[0]).isEqualTo(5_000); assertThat(state.getAdGroup(0).durationsUs[0]).isEqualTo(5_000);
assertThat(state.getAdGroup(0).durationsUs[1]).isEqualTo(6_000); assertThat(state.getAdGroup(0).durationsUs[1]).isEqualTo(6_000);
...@@ -315,7 +315,7 @@ public class AdPlaybackStateTest { ...@@ -315,7 +315,7 @@ public class AdPlaybackStateTest {
@Test @Test
public void withOriginalAdCount() { public void withOriginalAdCount() {
AdPlaybackState state = AdPlaybackState state =
new AdPlaybackState(TEST_ADS_ID, /* adGroupTimesUs...= */ 5_000_000) new AdPlaybackState(TEST_ADS_ID, /* adGroupTimesUs= */ 5_000_000)
.withAdCount(/* adGroupIndex= */ 0, /* adCount= */ 2); .withAdCount(/* adGroupIndex= */ 0, /* adCount= */ 2);
state = state.withOriginalAdCount(/* adGroupIndex= */ 0, /* originalAdCount= */ 3); state = state.withOriginalAdCount(/* adGroupIndex= */ 0, /* originalAdCount= */ 3);
...@@ -327,7 +327,7 @@ public class AdPlaybackStateTest { ...@@ -327,7 +327,7 @@ public class AdPlaybackStateTest {
@Test @Test
public void withOriginalAdCount_unsetValue_defaultsToIndexUnset() { public void withOriginalAdCount_unsetValue_defaultsToIndexUnset() {
AdPlaybackState state = AdPlaybackState state =
new AdPlaybackState(TEST_ADS_ID, /* adGroupTimesUs...= */ 5_000_000) new AdPlaybackState(TEST_ADS_ID, /* adGroupTimesUs= */ 5_000_000)
.withAdCount(/* adGroupIndex= */ 0, /* adCount= */ 2); .withAdCount(/* adGroupIndex= */ 0, /* adCount= */ 2);
assertThat(state.getAdGroup(0).count).isEqualTo(2); assertThat(state.getAdGroup(0).count).isEqualTo(2);
...@@ -336,7 +336,7 @@ public class AdPlaybackStateTest { ...@@ -336,7 +336,7 @@ public class AdPlaybackStateTest {
@Test @Test
public void withLastAdGroupRemoved() { public void withLastAdGroupRemoved() {
AdPlaybackState state = new AdPlaybackState(TEST_ADS_ID, /* adGroupTimesUs...= */ 5_000_000); AdPlaybackState state = new AdPlaybackState(TEST_ADS_ID, /* adGroupTimesUs= */ 5_000_000);
state = state =
state state
.withAdCount(/* adGroupIndex= */ 0, 3) .withAdCount(/* adGroupIndex= */ 0, 3)
...@@ -363,7 +363,7 @@ public class AdPlaybackStateTest { ...@@ -363,7 +363,7 @@ public class AdPlaybackStateTest {
state = state.withAdCount(/* adGroupIndex= */ 1, /* adCount= */ 5); state = state.withAdCount(/* adGroupIndex= */ 1, /* adCount= */ 5);
state = state =
state.withAdDurationsUs( state.withAdDurationsUs(
/* adGroupIndex= */ 1, /* adDurationsUs...= */ 1_000L, 2_000L, 3_000L, 4_000L, 5_000L); /* adGroupIndex= */ 1, /* adDurationsUs= */ 1_000L, 2_000L, 3_000L, 4_000L, 5_000L);
state = state.withAvailableAdUri(/* adGroupIndex= */ 1, /* adIndexInAdGroup= */ 1, TEST_URI); state = state.withAvailableAdUri(/* adGroupIndex= */ 1, /* adIndexInAdGroup= */ 1, TEST_URI);
state = state.withAvailableAdUri(/* adGroupIndex= */ 1, /* adIndexInAdGroup= */ 2, TEST_URI); state = state.withAvailableAdUri(/* adGroupIndex= */ 1, /* adIndexInAdGroup= */ 2, TEST_URI);
state = state.withAvailableAdUri(/* adGroupIndex= */ 1, /* adIndexInAdGroup= */ 3, TEST_URI); state = state.withAvailableAdUri(/* adGroupIndex= */ 1, /* adIndexInAdGroup= */ 3, TEST_URI);
...@@ -419,8 +419,8 @@ public class AdPlaybackStateTest { ...@@ -419,8 +419,8 @@ public class AdPlaybackStateTest {
.withContentResumeOffsetUs(/* adGroupIndex= */ 2, /* contentResumeOffsetUs= */ 3333) .withContentResumeOffsetUs(/* adGroupIndex= */ 2, /* contentResumeOffsetUs= */ 3333)
.withIsServerSideInserted(/* adGroupIndex= */ 1, /* isServerSideInserted= */ true) .withIsServerSideInserted(/* adGroupIndex= */ 1, /* isServerSideInserted= */ true)
.withIsServerSideInserted(/* adGroupIndex= */ 2, /* isServerSideInserted= */ true) .withIsServerSideInserted(/* adGroupIndex= */ 2, /* isServerSideInserted= */ true)
.withAdDurationsUs(/* adGroupIndex= */ 1, /* adDurationsUs...= */ 12) .withAdDurationsUs(/* adGroupIndex= */ 1, /* adDurationsUs= */ 12)
.withAdDurationsUs(/* adGroupIndex= */ 2, /* adDurationsUs...= */ 34, 56) .withAdDurationsUs(/* adGroupIndex= */ 2, /* adDurationsUs= */ 34, 56)
.withAdResumePositionUs(123) .withAdResumePositionUs(123)
.withContentDurationUs(456); .withContentDurationUs(456);
...@@ -457,7 +457,7 @@ public class AdPlaybackStateTest { ...@@ -457,7 +457,7 @@ public class AdPlaybackStateTest {
AdPlaybackState state = AdPlaybackState state =
new AdPlaybackState( new AdPlaybackState(
/* adsId= */ new Object(), /* adsId= */ new Object(),
/* adGroupTimesUs...= */ 0, /* adGroupTimesUs= */ 0,
1000, 1000,
2000, 2000,
3000, 3000,
...@@ -540,7 +540,7 @@ public class AdPlaybackStateTest { ...@@ -540,7 +540,7 @@ public class AdPlaybackStateTest {
@Test @Test
public void getAdGroupIndexAfterPositionUs_withServerSideInsertedAds_returnsNextAdGroup() { public void getAdGroupIndexAfterPositionUs_withServerSideInsertedAds_returnsNextAdGroup() {
AdPlaybackState state = AdPlaybackState state =
new AdPlaybackState(/* adsId= */ new Object(), /* adGroupTimesUs...= */ 0, 1000, 2000) new AdPlaybackState(/* adsId= */ new Object(), /* adGroupTimesUs= */ 0, 1000, 2000)
.withIsServerSideInserted(/* adGroupIndex= */ 0, /* isServerSideInserted= */ true) .withIsServerSideInserted(/* adGroupIndex= */ 0, /* isServerSideInserted= */ true)
.withIsServerSideInserted(/* adGroupIndex= */ 1, /* isServerSideInserted= */ true) .withIsServerSideInserted(/* adGroupIndex= */ 1, /* isServerSideInserted= */ true)
.withIsServerSideInserted(/* adGroupIndex= */ 2, /* isServerSideInserted= */ true) .withIsServerSideInserted(/* adGroupIndex= */ 2, /* isServerSideInserted= */ true)
......
...@@ -185,9 +185,9 @@ public final class TrackSelectionParametersTest { ...@@ -185,9 +185,9 @@ public final class TrackSelectionParametersTest {
TrackSelectionParameters parameters = TrackSelectionParameters parameters =
new TrackSelectionParameters.Builder(getApplicationContext()) new TrackSelectionParameters.Builder(getApplicationContext())
.setViewportSize( .setViewportSize(
/*viewportWidth=*/ 1, /* viewportWidth= */ 1,
/*viewportHeight=*/ 2, /* viewportHeight= */ 2,
/*viewportOrientationMayChange=*/ false) /* viewportOrientationMayChange= */ false)
.clearViewportSizeConstraints() .clearViewportSizeConstraints()
.build(); .build();
......
...@@ -80,7 +80,7 @@ public final class FlagSetTest { ...@@ -80,7 +80,7 @@ public final class FlagSetTest {
public void containsAny_withoutAdd_returnsFalseForAllValues() { public void containsAny_withoutAdd_returnsFalseForAllValues() {
FlagSet flags = new FlagSet.Builder().build(); FlagSet flags = new FlagSet.Builder().build();
assertThat(flags.containsAny(/* flags...= */ -1234, 0, 2, Integer.MAX_VALUE)).isFalse(); assertThat(flags.containsAny(/* flags= */ -1234, 0, 2, Integer.MAX_VALUE)).isFalse();
} }
@Test @Test
...@@ -95,9 +95,9 @@ public final class FlagSetTest { ...@@ -95,9 +95,9 @@ public final class FlagSetTest {
assertThat( assertThat(
flags.containsAny( flags.containsAny(
/* flags...= */ -1235, -1234, 0, 1, 2, Integer.MAX_VALUE - 1, Integer.MAX_VALUE)) /* flags= */ -1235, -1234, 0, 1, 2, Integer.MAX_VALUE - 1, Integer.MAX_VALUE))
.isTrue(); .isTrue();
assertThat(flags.containsAny(/* flags...= */ -1235, 1, Integer.MAX_VALUE - 1)).isFalse(); assertThat(flags.containsAny(/* flags= */ -1235, 1, Integer.MAX_VALUE - 1)).isFalse();
} }
@Test @Test
......
...@@ -394,8 +394,11 @@ public abstract class DecoderAudioRenderer< ...@@ -394,8 +394,11 @@ public abstract class DecoderAudioRenderer<
} }
private boolean drainOutputBuffer() private boolean drainOutputBuffer()
throws ExoPlaybackException, DecoderException, AudioSink.ConfigurationException, throws ExoPlaybackException,
AudioSink.InitializationException, AudioSink.WriteException { DecoderException,
AudioSink.ConfigurationException,
AudioSink.InitializationException,
AudioSink.WriteException {
if (outputBuffer == null) { if (outputBuffer == null) {
outputBuffer = decoder.dequeueOutputBuffer(); outputBuffer = decoder.dequeueOutputBuffer();
if (outputBuffer == null) { if (outputBuffer == null) {
......
...@@ -374,7 +374,7 @@ public final class MaskingMediaSource extends WrappingMediaSource { ...@@ -374,7 +374,7 @@ public final class MaskingMediaSource extends WrappingMediaSource {
/* id= */ setIds ? 0 : null, /* id= */ setIds ? 0 : null,
/* uid= */ setIds ? MaskingTimeline.MASKING_EXTERNAL_PERIOD_UID : null, /* uid= */ setIds ? MaskingTimeline.MASKING_EXTERNAL_PERIOD_UID : null,
/* windowIndex= */ 0, /* windowIndex= */ 0,
/* durationUs = */ C.TIME_UNSET, /* durationUs= */ C.TIME_UNSET,
/* positionInWindowUs= */ 0, /* positionInWindowUs= */ 0,
/* adPlaybackState= */ AdPlaybackState.NONE, /* adPlaybackState= */ AdPlaybackState.NONE,
/* isPlaceholder= */ true); /* isPlaceholder= */ true);
......
...@@ -111,7 +111,7 @@ public final class ExoplayerCuesDecoder implements SubtitleDecoder { ...@@ -111,7 +111,7 @@ public final class ExoplayerCuesDecoder implements SubtitleDecoder {
SingleEventSubtitle subtitle = SingleEventSubtitle subtitle =
new SingleEventSubtitle( new SingleEventSubtitle(
inputBuffer.timeUs, cueDecoder.decode(checkNotNull(inputBuffer.data).array())); inputBuffer.timeUs, cueDecoder.decode(checkNotNull(inputBuffer.data).array()));
outputBuffer.setContent(inputBuffer.timeUs, subtitle, /* subsampleOffsetUs=*/ 0); outputBuffer.setContent(inputBuffer.timeUs, subtitle, /* subsampleOffsetUs= */ 0);
} }
inputBuffer.clear(); inputBuffer.clear();
inputBufferState = INPUT_BUFFER_AVAILABLE; inputBufferState = INPUT_BUFFER_AVAILABLE;
......
...@@ -448,7 +448,7 @@ public class MediaSourceListTest { ...@@ -448,7 +448,7 @@ public class MediaSourceListTest {
@Test @Test
public void setMediaSources_expectTimelineUsesCustomShuffleOrder() { public void setMediaSources_expectTimelineUsesCustomShuffleOrder() {
Timeline timeline = Timeline timeline =
mediaSourceList.setMediaSources(createFakeHolders(), new FakeShuffleOrder(/* length=*/ 4)); mediaSourceList.setMediaSources(createFakeHolders(), new FakeShuffleOrder(/* length= */ 4));
assertTimelineUsesFakeShuffleOrder(timeline); assertTimelineUsesFakeShuffleOrder(timeline);
} }
......
...@@ -1027,7 +1027,7 @@ public final class DefaultAnalyticsCollectorTest { ...@@ -1027,7 +1027,7 @@ public final class DefaultAnalyticsCollectorTest {
new AtomicReference<>( new AtomicReference<>(
FakeTimeline.createAdPlaybackState( FakeTimeline.createAdPlaybackState(
/* adsPerAdGroup= */ 1, /* adsPerAdGroup= */ 1,
/* adGroupTimesUs...= */ windowOffsetInFirstPeriodUs, /* adGroupTimesUs= */ windowOffsetInFirstPeriodUs,
windowOffsetInFirstPeriodUs + 5 * C.MICROS_PER_SECOND, windowOffsetInFirstPeriodUs + 5 * C.MICROS_PER_SECOND,
C.TIME_END_OF_SOURCE)); C.TIME_END_OF_SOURCE));
AtomicInteger playedAdCount = new AtomicInteger(0); AtomicInteger playedAdCount = new AtomicInteger(0);
...@@ -1300,7 +1300,7 @@ public final class DefaultAnalyticsCollectorTest { ...@@ -1300,7 +1300,7 @@ public final class DefaultAnalyticsCollectorTest {
/* isDynamic= */ false, /* isDynamic= */ false,
10 * C.MICROS_PER_SECOND, 10 * C.MICROS_PER_SECOND,
FakeTimeline.createAdPlaybackState( FakeTimeline.createAdPlaybackState(
/* adsPerAdGroup= */ 1, /* adGroupTimesUs...= */ /* adsPerAdGroup= */ 1, /* adGroupTimesUs= */
windowOffsetInFirstPeriodUs + 5 * C.MICROS_PER_SECOND))); windowOffsetInFirstPeriodUs + 5 * C.MICROS_PER_SECOND)));
FakeMediaSource fakeMediaSource = FakeMediaSource fakeMediaSource =
new FakeMediaSource( new FakeMediaSource(
......
...@@ -1285,7 +1285,7 @@ public final class DefaultPlaybackSessionManagerTest { ...@@ -1285,7 +1285,7 @@ public final class DefaultPlaybackSessionManagerTest {
private static EventTime createEventTime( private static EventTime createEventTime(
Timeline timeline, int windowIndex, @Nullable MediaPeriodId mediaPeriodId) { Timeline timeline, int windowIndex, @Nullable MediaPeriodId mediaPeriodId) {
return new EventTime( return new EventTime(
/* realtimeMs = */ 0, /* realtimeMs= */ 0,
timeline, timeline,
windowIndex, windowIndex,
mediaPeriodId, mediaPeriodId,
...@@ -1303,7 +1303,7 @@ public final class DefaultPlaybackSessionManagerTest { ...@@ -1303,7 +1303,7 @@ public final class DefaultPlaybackSessionManagerTest {
@Nullable MediaPeriodId eventMediaPeriodId, @Nullable MediaPeriodId eventMediaPeriodId,
@Nullable MediaPeriodId currentMediaPeriodId) { @Nullable MediaPeriodId currentMediaPeriodId) {
return new EventTime( return new EventTime(
/* realtimeMs = */ 0, /* realtimeMs= */ 0,
timeline, timeline,
windowIndex, windowIndex,
eventMediaPeriodId, eventMediaPeriodId,
......
...@@ -289,11 +289,10 @@ public final class SilenceSkippingAudioProcessorTest { ...@@ -289,11 +289,10 @@ public final class SilenceSkippingAudioProcessorTest {
Pcm16BitAudioBuilder audioBuilder = new Pcm16BitAudioBuilder(channelCount, totalFrameCount); Pcm16BitAudioBuilder audioBuilder = new Pcm16BitAudioBuilder(channelCount, totalFrameCount);
while (!audioBuilder.isFull()) { while (!audioBuilder.isFull()) {
int silenceDurationFrames = (silenceDurationMs * sampleRate) / 1000; int silenceDurationFrames = (silenceDurationMs * sampleRate) / 1000;
audioBuilder.appendFrames( audioBuilder.appendFrames(/* count= */ silenceDurationFrames, /* channelLevels= */ (short) 0);
/* count= */ silenceDurationFrames, /* channelLevels...= */ (short) 0);
int noiseDurationFrames = (noiseDurationMs * sampleRate) / 1000; int noiseDurationFrames = (noiseDurationMs * sampleRate) / 1000;
audioBuilder.appendFrames( audioBuilder.appendFrames(
/* count= */ noiseDurationFrames, /* channelLevels...= */ Short.MAX_VALUE); /* count= */ noiseDurationFrames, /* channelLevels= */ Short.MAX_VALUE);
} }
return new InputBufferProvider(audioBuilder.build()); return new InputBufferProvider(audioBuilder.build());
} }
......
...@@ -363,7 +363,7 @@ public final class ConcatenatingMediaSourceTest { ...@@ -363,7 +363,7 @@ public final class ConcatenatingMediaSourceTest {
new FakeMediaSource(Timeline.EMPTY), new FakeMediaSource(Timeline.EMPTY),
new FakeMediaSource(Timeline.EMPTY), new FakeMediaSource(Timeline.EMPTY),
}; };
Timeline nonEmptyTimeline = new FakeTimeline(/* windowCount = */ 1); Timeline nonEmptyTimeline = new FakeTimeline(/* windowCount= */ 1);
mediaSource.addMediaSources(Arrays.asList(childSources)); mediaSource.addMediaSources(Arrays.asList(childSources));
Timeline timeline = testRunner.prepareSource(); Timeline timeline = testRunner.prepareSource();
......
...@@ -78,7 +78,7 @@ public final class AdsMediaSourceTest { ...@@ -78,7 +78,7 @@ public final class AdsMediaSourceTest {
CONTENT_TIMELINE.getUidOfPeriod(/* periodIndex= */ 0); CONTENT_TIMELINE.getUidOfPeriod(/* periodIndex= */ 0);
private static final AdPlaybackState AD_PLAYBACK_STATE = private static final AdPlaybackState AD_PLAYBACK_STATE =
new AdPlaybackState(/* adsId= */ new Object(), /* adGroupTimesUs...= */ 0) new AdPlaybackState(/* adsId= */ new Object(), /* adGroupTimesUs= */ 0)
.withContentDurationUs(CONTENT_DURATION_US) .withContentDurationUs(CONTENT_DURATION_US)
.withAdCount(/* adGroupIndex= */ 0, /* adCount= */ 1) .withAdCount(/* adGroupIndex= */ 0, /* adCount= */ 1)
.withAvailableAdUri( .withAvailableAdUri(
......
...@@ -90,19 +90,16 @@ public final class ServerSideAdInsertionMediaSourceTest { ...@@ -90,19 +90,16 @@ public final class ServerSideAdInsertionMediaSourceTest {
// Test with one ad group before the window, and the window starting within the second ad group. // Test with one ad group before the window, and the window starting within the second ad group.
AdPlaybackState adPlaybackState = AdPlaybackState adPlaybackState =
new AdPlaybackState( new AdPlaybackState(
/* adsId= */ new Object(), /* adGroupTimesUs...= */ /* adsId= */ new Object(), /* adGroupTimesUs= */ 15_000_000, 41_500_000, 42_200_000)
15_000_000,
41_500_000,
42_200_000)
.withIsServerSideInserted(/* adGroupIndex= */ 0, /* isServerSideInserted= */ true) .withIsServerSideInserted(/* adGroupIndex= */ 0, /* isServerSideInserted= */ true)
.withIsServerSideInserted(/* adGroupIndex= */ 1, /* isServerSideInserted= */ true) .withIsServerSideInserted(/* adGroupIndex= */ 1, /* isServerSideInserted= */ true)
.withIsServerSideInserted(/* adGroupIndex= */ 2, /* isServerSideInserted= */ true) .withIsServerSideInserted(/* adGroupIndex= */ 2, /* isServerSideInserted= */ true)
.withAdCount(/* adGroupIndex= */ 0, /* adCount= */ 1) .withAdCount(/* adGroupIndex= */ 0, /* adCount= */ 1)
.withAdCount(/* adGroupIndex= */ 1, /* adCount= */ 2) .withAdCount(/* adGroupIndex= */ 1, /* adCount= */ 2)
.withAdCount(/* adGroupIndex= */ 2, /* adCount= */ 1) .withAdCount(/* adGroupIndex= */ 2, /* adCount= */ 1)
.withAdDurationsUs(/* adGroupIndex= */ 0, /* adDurationsUs...= */ 500_000) .withAdDurationsUs(/* adGroupIndex= */ 0, /* adDurationsUs= */ 500_000)
.withAdDurationsUs(/* adGroupIndex= */ 1, /* adDurationsUs...= */ 300_000, 100_000) .withAdDurationsUs(/* adGroupIndex= */ 1, /* adDurationsUs= */ 300_000, 100_000)
.withAdDurationsUs(/* adGroupIndex= */ 2, /* adDurationsUs...= */ 400_000) .withAdDurationsUs(/* adGroupIndex= */ 2, /* adDurationsUs= */ 400_000)
.withContentResumeOffsetUs(/* adGroupIndex= */ 0, /* contentResumeOffsetUs= */ 100_000) .withContentResumeOffsetUs(/* adGroupIndex= */ 0, /* contentResumeOffsetUs= */ 100_000)
.withContentResumeOffsetUs(/* adGroupIndex= */ 1, /* contentResumeOffsetUs= */ 400_000) .withContentResumeOffsetUs(/* adGroupIndex= */ 1, /* contentResumeOffsetUs= */ 400_000)
.withContentResumeOffsetUs(/* adGroupIndex= */ 2, /* contentResumeOffsetUs= */ 200_000); .withContentResumeOffsetUs(/* adGroupIndex= */ 2, /* contentResumeOffsetUs= */ 200_000);
...@@ -183,19 +180,19 @@ public final class ServerSideAdInsertionMediaSourceTest { ...@@ -183,19 +180,19 @@ public final class ServerSideAdInsertionMediaSourceTest {
adPlaybackState, adPlaybackState,
/* fromPositionUs= */ 0, /* fromPositionUs= */ 0,
/* contentResumeOffsetUs= */ 0, /* contentResumeOffsetUs= */ 0,
/* adDurationsUs...= */ 200_000); /* adDurationsUs= */ 200_000);
adPlaybackState = adPlaybackState =
addAdGroupToAdPlaybackState( addAdGroupToAdPlaybackState(
adPlaybackState, adPlaybackState,
/* fromPositionUs= */ 400_000, /* fromPositionUs= */ 400_000,
/* contentResumeOffsetUs= */ 1_000_000, /* contentResumeOffsetUs= */ 1_000_000,
/* adDurationsUs...= */ 300_000); /* adDurationsUs= */ 300_000);
AdPlaybackState firstAdPlaybackState = AdPlaybackState firstAdPlaybackState =
addAdGroupToAdPlaybackState( addAdGroupToAdPlaybackState(
adPlaybackState, adPlaybackState,
/* fromPositionUs= */ 900_000, /* fromPositionUs= */ 900_000,
/* contentResumeOffsetUs= */ 0, /* contentResumeOffsetUs= */ 0,
/* adDurationsUs...= */ 100_000); /* adDurationsUs= */ 100_000);
AtomicReference<ServerSideAdInsertionMediaSource> mediaSourceRef = new AtomicReference<>(); AtomicReference<ServerSideAdInsertionMediaSource> mediaSourceRef = new AtomicReference<>();
mediaSourceRef.set( mediaSourceRef.set(
...@@ -253,7 +250,7 @@ public final class ServerSideAdInsertionMediaSourceTest { ...@@ -253,7 +250,7 @@ public final class ServerSideAdInsertionMediaSourceTest {
new AdPlaybackState(/* adsId= */ new Object()), new AdPlaybackState(/* adsId= */ new Object()),
/* fromPositionUs= */ 900_000, /* fromPositionUs= */ 900_000,
/* contentResumeOffsetUs= */ 0, /* contentResumeOffsetUs= */ 0,
/* adDurationsUs...= */ 100_000); /* adDurationsUs= */ 100_000);
AtomicReference<ServerSideAdInsertionMediaSource> mediaSourceRef = new AtomicReference<>(); AtomicReference<ServerSideAdInsertionMediaSource> mediaSourceRef = new AtomicReference<>();
mediaSourceRef.set( mediaSourceRef.set(
new ServerSideAdInsertionMediaSource( new ServerSideAdInsertionMediaSource(
...@@ -281,7 +278,7 @@ public final class ServerSideAdInsertionMediaSourceTest { ...@@ -281,7 +278,7 @@ public final class ServerSideAdInsertionMediaSourceTest {
firstAdPlaybackState, firstAdPlaybackState,
/* fromPositionUs= */ 0, /* fromPositionUs= */ 0,
/* contentResumeOffsetUs= */ 0, /* contentResumeOffsetUs= */ 0,
/* adDurationsUs...= */ 500_000); /* adDurationsUs= */ 500_000);
mediaSourceRef mediaSourceRef
.get() .get()
.setAdPlaybackStates(ImmutableMap.of(periodUid.get(), secondAdPlaybackState)); .setAdPlaybackStates(ImmutableMap.of(periodUid.get(), secondAdPlaybackState));
...@@ -324,7 +321,7 @@ public final class ServerSideAdInsertionMediaSourceTest { ...@@ -324,7 +321,7 @@ public final class ServerSideAdInsertionMediaSourceTest {
new AdPlaybackState(/* adsId= */ new Object()), new AdPlaybackState(/* adsId= */ new Object()),
/* fromPositionUs= */ 0, /* fromPositionUs= */ 0,
/* contentResumeOffsetUs= */ 0, /* contentResumeOffsetUs= */ 0,
/* adDurationsUs...= */ 500_000); /* adDurationsUs= */ 500_000);
AtomicReference<ServerSideAdInsertionMediaSource> mediaSourceRef = new AtomicReference<>(); AtomicReference<ServerSideAdInsertionMediaSource> mediaSourceRef = new AtomicReference<>();
mediaSourceRef.set( mediaSourceRef.set(
new ServerSideAdInsertionMediaSource( new ServerSideAdInsertionMediaSource(
...@@ -354,7 +351,7 @@ public final class ServerSideAdInsertionMediaSourceTest { ...@@ -354,7 +351,7 @@ public final class ServerSideAdInsertionMediaSourceTest {
firstAdPlaybackState firstAdPlaybackState
.withAdCount(/* adGroupIndex= */ 0, /* adCount= */ 3) .withAdCount(/* adGroupIndex= */ 0, /* adCount= */ 3)
.withAdDurationsUs( .withAdDurationsUs(
/* adGroupIndex= */ 0, /* adDurationsUs...= */ 50_000, 250_000, 200_000); /* adGroupIndex= */ 0, /* adDurationsUs= */ 50_000, 250_000, 200_000);
mediaSourceRef mediaSourceRef
.get() .get()
.setAdPlaybackStates(ImmutableMap.of(periodUid.get(), secondAdPlaybackState)); .setAdPlaybackStates(ImmutableMap.of(periodUid.get(), secondAdPlaybackState));
...@@ -392,19 +389,19 @@ public final class ServerSideAdInsertionMediaSourceTest { ...@@ -392,19 +389,19 @@ public final class ServerSideAdInsertionMediaSourceTest {
adPlaybackState, adPlaybackState,
/* fromPositionUs= */ 0, /* fromPositionUs= */ 0,
/* contentResumeOffsetUs= */ 0, /* contentResumeOffsetUs= */ 0,
/* adDurationsUs...= */ 100_000); /* adDurationsUs= */ 100_000);
adPlaybackState = adPlaybackState =
addAdGroupToAdPlaybackState( addAdGroupToAdPlaybackState(
adPlaybackState, adPlaybackState,
/* fromPositionUs= */ 600_000, /* fromPositionUs= */ 600_000,
/* contentResumeOffsetUs= */ 1_000_000, /* contentResumeOffsetUs= */ 1_000_000,
/* adDurationsUs...= */ 100_000); /* adDurationsUs= */ 100_000);
AdPlaybackState firstAdPlaybackState = AdPlaybackState firstAdPlaybackState =
addAdGroupToAdPlaybackState( addAdGroupToAdPlaybackState(
adPlaybackState, adPlaybackState,
/* fromPositionUs= */ 900_000, /* fromPositionUs= */ 900_000,
/* contentResumeOffsetUs= */ 0, /* contentResumeOffsetUs= */ 0,
/* adDurationsUs...= */ 100_000); /* adDurationsUs= */ 100_000);
AtomicReference<ServerSideAdInsertionMediaSource> mediaSourceRef = new AtomicReference<>(); AtomicReference<ServerSideAdInsertionMediaSource> mediaSourceRef = new AtomicReference<>();
mediaSourceRef.set( mediaSourceRef.set(
......
...@@ -48,14 +48,14 @@ public class ExoplayerCuesDecoderTest { ...@@ -48,14 +48,14 @@ public class ExoplayerCuesDecoderTest {
@Test @Test
public void decoder_outputsSubtitle() throws Exception { public void decoder_outputsSubtitle() throws Exception {
SubtitleInputBuffer inputBuffer = decoder.dequeueInputBuffer(); SubtitleInputBuffer inputBuffer = decoder.dequeueInputBuffer();
writeDataToInputBuffer(inputBuffer, /* timeUs=*/ 1000, ENCODED_CUES); writeDataToInputBuffer(inputBuffer, /* timeUs= */ 1000, ENCODED_CUES);
decoder.queueInputBuffer(inputBuffer); decoder.queueInputBuffer(inputBuffer);
SubtitleOutputBuffer outputBuffer = decoder.dequeueOutputBuffer(); SubtitleOutputBuffer outputBuffer = decoder.dequeueOutputBuffer();
assertThat(outputBuffer.getCues(/* timeUs=*/ 999)).isEmpty(); assertThat(outputBuffer.getCues(/* timeUs= */ 999)).isEmpty();
assertThat(outputBuffer.getCues(1001)).hasSize(1); assertThat(outputBuffer.getCues(1001)).hasSize(1);
assertThat(outputBuffer.getCues(/* timeUs=*/ 1000)).hasSize(1); assertThat(outputBuffer.getCues(/* timeUs= */ 1000)).hasSize(1);
assertThat(outputBuffer.getCues(/* timeUs=*/ 1000).get(0).text.toString()).isEqualTo("text"); assertThat(outputBuffer.getCues(/* timeUs= */ 1000).get(0).text.toString()).isEqualTo("text");
outputBuffer.release(); outputBuffer.release();
} }
...@@ -70,7 +70,7 @@ public class ExoplayerCuesDecoderTest { ...@@ -70,7 +70,7 @@ public class ExoplayerCuesDecoderTest {
// Returns null before input has been queued // Returns null before input has been queued
assertThat(decoder.dequeueOutputBuffer()).isNull(); assertThat(decoder.dequeueOutputBuffer()).isNull();
writeDataToInputBuffer(inputBuffer, /* timeUs=*/ 1000, ENCODED_CUES); writeDataToInputBuffer(inputBuffer, /* timeUs= */ 1000, ENCODED_CUES);
decoder.queueInputBuffer(inputBuffer); decoder.queueInputBuffer(inputBuffer);
// Returns buffer when the input buffer is queued and output buffer is available // Returns buffer when the input buffer is queued and output buffer is available
...@@ -84,7 +84,7 @@ public class ExoplayerCuesDecoderTest { ...@@ -84,7 +84,7 @@ public class ExoplayerCuesDecoderTest {
public void dequeueOutputBuffer_releasedOutputAndQueuedNextInput_returnsOutputBuffer() public void dequeueOutputBuffer_releasedOutputAndQueuedNextInput_returnsOutputBuffer()
throws Exception { throws Exception {
SubtitleInputBuffer inputBuffer = decoder.dequeueInputBuffer(); SubtitleInputBuffer inputBuffer = decoder.dequeueInputBuffer();
writeDataToInputBuffer(inputBuffer, /* timeUs=*/ 1000, ENCODED_CUES); writeDataToInputBuffer(inputBuffer, /* timeUs= */ 1000, ENCODED_CUES);
decoder.queueInputBuffer(inputBuffer); decoder.queueInputBuffer(inputBuffer);
SubtitleOutputBuffer outputBuffer = decoder.dequeueOutputBuffer(); SubtitleOutputBuffer outputBuffer = decoder.dequeueOutputBuffer();
exhaustAllOutputBuffers(decoder); exhaustAllOutputBuffers(decoder);
...@@ -108,7 +108,7 @@ public class ExoplayerCuesDecoderTest { ...@@ -108,7 +108,7 @@ public class ExoplayerCuesDecoderTest {
@Test @Test
public void dequeueInputBuffer_withQueuedInput_returnsNull() throws Exception { public void dequeueInputBuffer_withQueuedInput_returnsNull() throws Exception {
SubtitleInputBuffer inputBuffer = decoder.dequeueInputBuffer(); SubtitleInputBuffer inputBuffer = decoder.dequeueInputBuffer();
writeDataToInputBuffer(inputBuffer, /* timeUs=*/ 1000, ENCODED_CUES); writeDataToInputBuffer(inputBuffer, /* timeUs= */ 1000, ENCODED_CUES);
decoder.queueInputBuffer(inputBuffer); decoder.queueInputBuffer(inputBuffer);
assertThat(decoder.dequeueInputBuffer()).isNull(); assertThat(decoder.dequeueInputBuffer()).isNull();
...@@ -131,7 +131,7 @@ public class ExoplayerCuesDecoderTest { ...@@ -131,7 +131,7 @@ public class ExoplayerCuesDecoderTest {
@Test @Test
public void releaseOutputBuffer_calledTwice_fails() throws Exception { public void releaseOutputBuffer_calledTwice_fails() throws Exception {
SubtitleInputBuffer inputBuffer = decoder.dequeueInputBuffer(); SubtitleInputBuffer inputBuffer = decoder.dequeueInputBuffer();
writeDataToInputBuffer(inputBuffer, /* timeUs=*/ 1000, ENCODED_CUES); writeDataToInputBuffer(inputBuffer, /* timeUs= */ 1000, ENCODED_CUES);
decoder.queueInputBuffer(inputBuffer); decoder.queueInputBuffer(inputBuffer);
SubtitleOutputBuffer outputBuffer = decoder.dequeueOutputBuffer(); SubtitleOutputBuffer outputBuffer = decoder.dequeueOutputBuffer();
outputBuffer.release(); outputBuffer.release();
...@@ -142,14 +142,14 @@ public class ExoplayerCuesDecoderTest { ...@@ -142,14 +142,14 @@ public class ExoplayerCuesDecoderTest {
@Test @Test
public void flush_doesNotInfluenceOutputBufferAvailability() throws Exception { public void flush_doesNotInfluenceOutputBufferAvailability() throws Exception {
SubtitleInputBuffer inputBuffer = decoder.dequeueInputBuffer(); SubtitleInputBuffer inputBuffer = decoder.dequeueInputBuffer();
writeDataToInputBuffer(inputBuffer, /* timeUs=*/ 1000, ENCODED_CUES); writeDataToInputBuffer(inputBuffer, /* timeUs= */ 1000, ENCODED_CUES);
decoder.queueInputBuffer(inputBuffer); decoder.queueInputBuffer(inputBuffer);
SubtitleOutputBuffer outputBuffer = decoder.dequeueOutputBuffer(); SubtitleOutputBuffer outputBuffer = decoder.dequeueOutputBuffer();
assertThat(outputBuffer).isNotNull(); assertThat(outputBuffer).isNotNull();
exhaustAllOutputBuffers(decoder); exhaustAllOutputBuffers(decoder);
decoder.flush(); decoder.flush();
inputBuffer = decoder.dequeueInputBuffer(); inputBuffer = decoder.dequeueInputBuffer();
writeDataToInputBuffer(inputBuffer, /* timeUs=*/ 1000, ENCODED_CUES); writeDataToInputBuffer(inputBuffer, /* timeUs= */ 1000, ENCODED_CUES);
assertThat(decoder.dequeueOutputBuffer()).isNull(); assertThat(decoder.dequeueOutputBuffer()).isNull();
} }
...@@ -164,7 +164,7 @@ public class ExoplayerCuesDecoderTest { ...@@ -164,7 +164,7 @@ public class ExoplayerCuesDecoderTest {
inputBuffer = decoder.dequeueInputBuffer(); inputBuffer = decoder.dequeueInputBuffer();
} }
for (int i = 0; i < inputBuffers.size(); i++) { for (int i = 0; i < inputBuffers.size(); i++) {
writeDataToInputBuffer(inputBuffers.get(i), /* timeUs=*/ 1000, ENCODED_CUES); writeDataToInputBuffer(inputBuffers.get(i), /* timeUs= */ 1000, ENCODED_CUES);
decoder.queueInputBuffer(inputBuffers.get(i)); decoder.queueInputBuffer(inputBuffers.get(i));
} }
decoder.flush(); decoder.flush();
...@@ -180,7 +180,7 @@ public class ExoplayerCuesDecoderTest { ...@@ -180,7 +180,7 @@ public class ExoplayerCuesDecoderTest {
do { do {
inputBuffer = decoder.dequeueInputBuffer(); inputBuffer = decoder.dequeueInputBuffer();
if (inputBuffer != null) { if (inputBuffer != null) {
writeDataToInputBuffer(inputBuffer, /* timeUs=*/ 1000, ENCODED_CUES); writeDataToInputBuffer(inputBuffer, /* timeUs= */ 1000, ENCODED_CUES);
decoder.queueInputBuffer(inputBuffer); decoder.queueInputBuffer(inputBuffer);
} }
} while (decoder.dequeueOutputBuffer() != null); } while (decoder.dequeueOutputBuffer() != null);
......
...@@ -570,9 +570,9 @@ public final class AdaptiveTrackSelectionTest { ...@@ -570,9 +570,9 @@ public final class AdaptiveTrackSelectionTest {
TrackGroup trackGroupMultipleFixed = new TrackGroup(formatFixed1, formatFixed2); TrackGroup trackGroupMultipleFixed = new TrackGroup(formatFixed1, formatFixed2);
TrackGroup trackGroupAdaptive = TrackGroup trackGroupAdaptive =
new TrackGroup(formatAdaptive1, formatAdaptive2, formatAdaptive3, formatAdaptive4); new TrackGroup(formatAdaptive1, formatAdaptive2, formatAdaptive3, formatAdaptive4);
Definition definitionFixed1 = new Definition(trackGroupMultipleFixed, /* tracks...= */ 0); Definition definitionFixed1 = new Definition(trackGroupMultipleFixed, /* tracks= */ 0);
Definition definitionFixed2 = new Definition(trackGroupMultipleFixed, /* tracks...= */ 1); Definition definitionFixed2 = new Definition(trackGroupMultipleFixed, /* tracks= */ 1);
Definition definitionAdaptive = new Definition(trackGroupAdaptive, /* tracks...= */ 1, 2, 3); Definition definitionAdaptive = new Definition(trackGroupAdaptive, /* tracks= */ 1, 2, 3);
List<List<AdaptationCheckpoint>> checkPoints = new ArrayList<>(); List<List<AdaptationCheckpoint>> checkPoints = new ArrayList<>();
AdaptiveTrackSelection.Factory factory = AdaptiveTrackSelection.Factory factory =
new AdaptiveTrackSelection.Factory() { new AdaptiveTrackSelection.Factory() {
...@@ -621,9 +621,9 @@ public final class AdaptiveTrackSelectionTest { ...@@ -621,9 +621,9 @@ public final class AdaptiveTrackSelectionTest {
TrackGroup trackGroup2 = TrackGroup trackGroup2 =
new TrackGroup(group2Format1, group2Format2, group2Format3, group2UnusedFormat); new TrackGroup(group2Format1, group2Format2, group2Format3, group2UnusedFormat);
TrackGroup fixedGroup = new TrackGroup(fixedFormat); TrackGroup fixedGroup = new TrackGroup(fixedFormat);
Definition definition1 = new Definition(trackGroup1, /* tracks...= */ 0, 1); Definition definition1 = new Definition(trackGroup1, /* tracks= */ 0, 1);
Definition definition2 = new Definition(trackGroup2, /* tracks...= */ 0, 1, 2); Definition definition2 = new Definition(trackGroup2, /* tracks= */ 0, 1, 2);
Definition fixedDefinition = new Definition(fixedGroup, /* tracks...= */ 0); Definition fixedDefinition = new Definition(fixedGroup, /* tracks= */ 0);
List<List<AdaptationCheckpoint>> checkPoints = new ArrayList<>(); List<List<AdaptationCheckpoint>> checkPoints = new ArrayList<>();
AdaptiveTrackSelection.Factory factory = AdaptiveTrackSelection.Factory factory =
new AdaptiveTrackSelection.Factory() { new AdaptiveTrackSelection.Factory() {
......
...@@ -2171,10 +2171,8 @@ public final class DefaultTrackSelectorTest { ...@@ -2171,10 +2171,8 @@ public final class DefaultTrackSelectorTest {
TIMELINE); TIMELINE);
assertThat(result.length).isEqualTo(2); assertThat(result.length).isEqualTo(2);
assertAdaptiveSelection( assertAdaptiveSelection(result.selections[0], trackGroups.get(0), /* expectedTracks= */ 1, 0);
result.selections[0], trackGroups.get(0), /* expectedTracks...= */ 1, 0); assertAdaptiveSelection(result.selections[1], trackGroups.get(1), /* expectedTracks= */ 1, 0);
assertAdaptiveSelection(
result.selections[1], trackGroups.get(1), /* expectedTracks...= */ 1, 0);
// Multiple adaptive selection disallowed. // Multiple adaptive selection disallowed.
trackSelector.setParameters( trackSelector.setParameters(
...@@ -2187,8 +2185,7 @@ public final class DefaultTrackSelectorTest { ...@@ -2187,8 +2185,7 @@ public final class DefaultTrackSelectorTest {
TIMELINE); TIMELINE);
assertThat(result.length).isEqualTo(2); assertThat(result.length).isEqualTo(2);
assertAdaptiveSelection( assertAdaptiveSelection(result.selections[0], trackGroups.get(0), /* expectedTracks= */ 1, 0);
result.selections[0], trackGroups.get(0), /* expectedTracks...= */ 1, 0);
assertFixedSelection(result.selections[1], trackGroups.get(1), /* expectedTrack= */ 1); assertFixedSelection(result.selections[1], trackGroups.get(1), /* expectedTrack= */ 1);
} }
...@@ -2232,7 +2229,7 @@ public final class DefaultTrackSelectorTest { ...@@ -2232,7 +2229,7 @@ public final class DefaultTrackSelectorTest {
trackSelector.selectTracks( trackSelector.selectTracks(
new RendererCapabilities[] {VIDEO_CAPABILITIES}, trackGroups, periodId, TIMELINE); new RendererCapabilities[] {VIDEO_CAPABILITIES}, trackGroups, periodId, TIMELINE);
assertThat(result.length).isEqualTo(1); assertThat(result.length).isEqualTo(1);
assertAdaptiveSelection(result.selections[0], adaptiveGroup, /* expectedTracks...= */ 1, 0); assertAdaptiveSelection(result.selections[0], adaptiveGroup, /* expectedTracks= */ 1, 0);
// Select default (=most tracks) if no preference is specified. // Select default (=most tracks) if no preference is specified.
trackSelector.setParameters(defaultParameters.buildUpon().setPreferredVideoMimeType(null)); trackSelector.setParameters(defaultParameters.buildUpon().setPreferredVideoMimeType(null));
...@@ -2240,7 +2237,7 @@ public final class DefaultTrackSelectorTest { ...@@ -2240,7 +2237,7 @@ public final class DefaultTrackSelectorTest {
trackSelector.selectTracks( trackSelector.selectTracks(
new RendererCapabilities[] {VIDEO_CAPABILITIES}, trackGroups, periodId, TIMELINE); new RendererCapabilities[] {VIDEO_CAPABILITIES}, trackGroups, periodId, TIMELINE);
assertThat(result.length).isEqualTo(1); assertThat(result.length).isEqualTo(1);
assertAdaptiveSelection(result.selections[0], adaptiveGroup, /* expectedTracks...= */ 1, 0); assertAdaptiveSelection(result.selections[0], adaptiveGroup, /* expectedTracks= */ 1, 0);
} }
/** /**
...@@ -2419,7 +2416,7 @@ public final class DefaultTrackSelectorTest { ...@@ -2419,7 +2416,7 @@ public final class DefaultTrackSelectorTest {
@Test @Test
public void roundTripViaBundle_ofSelectionOverride_yieldsEqualInstance() { public void roundTripViaBundle_ofSelectionOverride_yieldsEqualInstance() {
SelectionOverride selectionOverrideToBundle = SelectionOverride selectionOverrideToBundle =
new SelectionOverride(/* groupIndex= */ 1, /* tracks...= */ 2, 3); new SelectionOverride(/* groupIndex= */ 1, /* tracks= */ 2, 3);
SelectionOverride selectionOverrideFromBundle = SelectionOverride selectionOverrideFromBundle =
DefaultTrackSelector.SelectionOverride.CREATOR.fromBundle( DefaultTrackSelector.SelectionOverride.CREATOR.fromBundle(
......
...@@ -104,7 +104,7 @@ public class ContrastPixelTest { ...@@ -104,7 +104,7 @@ public class ContrastPixelTest {
setupOutputTexture(outputSize.first, outputSize.second); setupOutputTexture(outputSize.first, outputSize.second);
Bitmap expectedBitmap = readBitmap(ORIGINAL_PNG_ASSET_PATH); Bitmap expectedBitmap = readBitmap(ORIGINAL_PNG_ASSET_PATH);
contrastProcessor.drawFrame(inputTexId, /* presentationTimeUs = */ 0); contrastProcessor.drawFrame(inputTexId, /* presentationTimeUs= */ 0);
Bitmap actualBitmap = Bitmap actualBitmap =
createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.first, outputSize.second); createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.first, outputSize.second);
...@@ -128,7 +128,7 @@ public class ContrastPixelTest { ...@@ -128,7 +128,7 @@ public class ContrastPixelTest {
Color.rgb( Color.rgb(
OPENGL_NEUTRAL_RGB_VALUE, OPENGL_NEUTRAL_RGB_VALUE, OPENGL_NEUTRAL_RGB_VALUE)); OPENGL_NEUTRAL_RGB_VALUE, OPENGL_NEUTRAL_RGB_VALUE, OPENGL_NEUTRAL_RGB_VALUE));
contrastProcessor.drawFrame(inputTexId, /* presentationTimeUs = */ 0); contrastProcessor.drawFrame(inputTexId, /* presentationTimeUs= */ 0);
Bitmap actualBitmap = Bitmap actualBitmap =
createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.first, outputSize.second); createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.first, outputSize.second);
...@@ -187,7 +187,7 @@ public class ContrastPixelTest { ...@@ -187,7 +187,7 @@ public class ContrastPixelTest {
setupOutputTexture(outputSize.first, outputSize.second); setupOutputTexture(outputSize.first, outputSize.second);
Bitmap expectedBitmap = readBitmap(MAXIMUM_CONTRAST_PNG_ASSET_PATH); Bitmap expectedBitmap = readBitmap(MAXIMUM_CONTRAST_PNG_ASSET_PATH);
contrastProcessor.drawFrame(inputTexId, /* presentationTimeUs = */ 0); contrastProcessor.drawFrame(inputTexId, /* presentationTimeUs= */ 0);
Bitmap actualBitmap = Bitmap actualBitmap =
createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.first, outputSize.second); createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.first, outputSize.second);
......
...@@ -105,7 +105,7 @@ public class SingleColorLutPixelTest { ...@@ -105,7 +105,7 @@ public class SingleColorLutPixelTest {
setupOutputTexture(outputSize.first, outputSize.second); setupOutputTexture(outputSize.first, outputSize.second);
Bitmap expectedBitmap = readBitmap(ORIGINAL_PNG_ASSET_PATH); Bitmap expectedBitmap = readBitmap(ORIGINAL_PNG_ASSET_PATH);
colorLutProcessor.drawFrame(inputTexId, /* presentationTimeUs = */ 0); colorLutProcessor.drawFrame(inputTexId, /* presentationTimeUs= */ 0);
Bitmap actualBitmap = Bitmap actualBitmap =
createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.first, outputSize.second); createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.first, outputSize.second);
...@@ -126,7 +126,7 @@ public class SingleColorLutPixelTest { ...@@ -126,7 +126,7 @@ public class SingleColorLutPixelTest {
setupOutputTexture(outputSize.first, outputSize.second); setupOutputTexture(outputSize.first, outputSize.second);
Bitmap expectedBitmap = readBitmap(ORIGINAL_PNG_ASSET_PATH); Bitmap expectedBitmap = readBitmap(ORIGINAL_PNG_ASSET_PATH);
colorLutProcessor.drawFrame(inputTexId, /* presentationTimeUs = */ 0); colorLutProcessor.drawFrame(inputTexId, /* presentationTimeUs= */ 0);
Bitmap actualBitmap = Bitmap actualBitmap =
createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.first, outputSize.second); createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.first, outputSize.second);
...@@ -147,7 +147,7 @@ public class SingleColorLutPixelTest { ...@@ -147,7 +147,7 @@ public class SingleColorLutPixelTest {
setupOutputTexture(outputSize.first, outputSize.second); setupOutputTexture(outputSize.first, outputSize.second);
Bitmap expectedBitmap = readBitmap(ORIGINAL_PNG_ASSET_PATH); Bitmap expectedBitmap = readBitmap(ORIGINAL_PNG_ASSET_PATH);
colorLutProcessor.drawFrame(inputTexId, /* presentationTimeUs = */ 0); colorLutProcessor.drawFrame(inputTexId, /* presentationTimeUs= */ 0);
Bitmap actualBitmap = Bitmap actualBitmap =
createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.first, outputSize.second); createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.first, outputSize.second);
...@@ -168,7 +168,7 @@ public class SingleColorLutPixelTest { ...@@ -168,7 +168,7 @@ public class SingleColorLutPixelTest {
setupOutputTexture(outputSize.first, outputSize.second); setupOutputTexture(outputSize.first, outputSize.second);
Bitmap expectedBitmap = readBitmap(ORIGINAL_PNG_ASSET_PATH); Bitmap expectedBitmap = readBitmap(ORIGINAL_PNG_ASSET_PATH);
colorLutProcessor.drawFrame(inputTexId, /* presentationTimeUs = */ 0); colorLutProcessor.drawFrame(inputTexId, /* presentationTimeUs= */ 0);
Bitmap actualBitmap = Bitmap actualBitmap =
createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.first, outputSize.second); createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.first, outputSize.second);
...@@ -189,7 +189,7 @@ public class SingleColorLutPixelTest { ...@@ -189,7 +189,7 @@ public class SingleColorLutPixelTest {
setupOutputTexture(outputSize.first, outputSize.second); setupOutputTexture(outputSize.first, outputSize.second);
Bitmap expectedBitmap = readBitmap(ORIGINAL_PNG_ASSET_PATH); Bitmap expectedBitmap = readBitmap(ORIGINAL_PNG_ASSET_PATH);
colorLutProcessor.drawFrame(inputTexId, /* presentationTimeUs = */ 0); colorLutProcessor.drawFrame(inputTexId, /* presentationTimeUs= */ 0);
Bitmap actualBitmap = Bitmap actualBitmap =
createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.first, outputSize.second); createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.first, outputSize.second);
...@@ -212,7 +212,7 @@ public class SingleColorLutPixelTest { ...@@ -212,7 +212,7 @@ public class SingleColorLutPixelTest {
setupOutputTexture(outputSize.first, outputSize.second); setupOutputTexture(outputSize.first, outputSize.second);
Bitmap expectedBitmap = readBitmap(LUT_MAP_WHITE_TO_GREEN_ASSET_PATH); Bitmap expectedBitmap = readBitmap(LUT_MAP_WHITE_TO_GREEN_ASSET_PATH);
colorLutProcessor.drawFrame(inputTexId, /* presentationTimeUs = */ 0); colorLutProcessor.drawFrame(inputTexId, /* presentationTimeUs= */ 0);
Bitmap actualBitmap = Bitmap actualBitmap =
createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.first, outputSize.second); createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.first, outputSize.second);
...@@ -233,7 +233,7 @@ public class SingleColorLutPixelTest { ...@@ -233,7 +233,7 @@ public class SingleColorLutPixelTest {
setupOutputTexture(outputSize.first, outputSize.second); setupOutputTexture(outputSize.first, outputSize.second);
Bitmap expectedBitmap = readBitmap(INVERT_PNG_ASSET_PATH); Bitmap expectedBitmap = readBitmap(INVERT_PNG_ASSET_PATH);
colorLutProcessor.drawFrame(inputTexId, /* presentationTimeUs = */ 0); colorLutProcessor.drawFrame(inputTexId, /* presentationTimeUs= */ 0);
Bitmap actualBitmap = Bitmap actualBitmap =
createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.first, outputSize.second); createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.first, outputSize.second);
...@@ -254,7 +254,7 @@ public class SingleColorLutPixelTest { ...@@ -254,7 +254,7 @@ public class SingleColorLutPixelTest {
setupOutputTexture(outputSize.first, outputSize.second); setupOutputTexture(outputSize.first, outputSize.second);
Bitmap expectedBitmap = readBitmap(GRAYSCALE_PNG_ASSET_PATH); Bitmap expectedBitmap = readBitmap(GRAYSCALE_PNG_ASSET_PATH);
colorLutProcessor.drawFrame(inputTexId, /* presentationTimeUs = */ 0); colorLutProcessor.drawFrame(inputTexId, /* presentationTimeUs= */ 0);
Bitmap actualBitmap = Bitmap actualBitmap =
createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.first, outputSize.second); createArgb8888BitmapFromCurrentGlFramebuffer(outputSize.first, outputSize.second);
......
...@@ -447,7 +447,9 @@ public final class DefaultExtractorsFactory implements ExtractorsFactory { ...@@ -447,7 +447,9 @@ public final class DefaultExtractorsFactory implements ExtractorsFactory {
@Nullable @Nullable
private static Constructor<? extends Extractor> getFlacExtractorConstructor() private static Constructor<? extends Extractor> getFlacExtractorConstructor()
throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, throws ClassNotFoundException,
NoSuchMethodException,
InvocationTargetException,
IllegalAccessException { IllegalAccessException {
@SuppressWarnings("nullness:argument") @SuppressWarnings("nullness:argument")
boolean isFlacNativeLibraryAvailable = boolean isFlacNativeLibraryAvailable =
...@@ -468,7 +470,9 @@ public final class DefaultExtractorsFactory implements ExtractorsFactory { ...@@ -468,7 +470,9 @@ public final class DefaultExtractorsFactory implements ExtractorsFactory {
public interface ConstructorSupplier { public interface ConstructorSupplier {
@Nullable @Nullable
Constructor<? extends Extractor> getConstructor() Constructor<? extends Extractor> getConstructor()
throws InvocationTargetException, IllegalAccessException, NoSuchMethodException, throws InvocationTargetException,
IllegalAccessException,
NoSuchMethodException,
ClassNotFoundException; ClassNotFoundException;
} }
......
...@@ -654,7 +654,7 @@ public class FragmentedMp4Extractor implements Extractor { ...@@ -654,7 +654,7 @@ public class FragmentedMp4Extractor implements Extractor {
} }
byte[] messageData = new byte[atom.bytesLeft()]; byte[] messageData = new byte[atom.bytesLeft()];
atom.readBytes(messageData, /*offset=*/ 0, atom.bytesLeft()); atom.readBytes(messageData, /* offset= */ 0, atom.bytesLeft());
EventMessage eventMessage = new EventMessage(schemeIdUri, value, durationMs, id, messageData); EventMessage eventMessage = new EventMessage(schemeIdUri, value, durationMs, id, messageData);
ParsableByteArray encodedEventMessage = ParsableByteArray encodedEventMessage =
new ParsableByteArray(eventMessageEncoder.encode(eventMessage)); new ParsableByteArray(eventMessageEncoder.encode(eventMessage));
......
...@@ -687,7 +687,7 @@ public final class HlsMediaPeriod implements MediaPeriod, HlsPlaylistTracker.Pla ...@@ -687,7 +687,7 @@ public final class HlsMediaPeriod implements MediaPeriod, HlsPlaylistTracker.Pla
sampleStreamWrapper.prepareWithMultivariantPlaylistInfo( sampleStreamWrapper.prepareWithMultivariantPlaylistInfo(
muxedTrackGroups.toArray(new TrackGroup[0]), muxedTrackGroups.toArray(new TrackGroup[0]),
/* primaryTrackGroupIndex= */ 0, /* primaryTrackGroupIndex= */ 0,
/* optionalTrackGroupsIndices...= */ muxedTrackGroups.indexOf(id3TrackGroup)); /* optionalTrackGroupsIndices= */ muxedTrackGroups.indexOf(id3TrackGroup));
} }
} }
......
...@@ -107,7 +107,7 @@ public class FakeAdaptiveMediaPeriod ...@@ -107,7 +107,7 @@ public class FakeAdaptiveMediaPeriod
C.SELECTION_REASON_UNKNOWN, C.SELECTION_REASON_UNKNOWN,
/* trackSelectionData= */ null, /* trackSelectionData= */ null,
/* mediaStartTimeUs= */ 0, /* mediaStartTimeUs= */ 0,
/* mediaEndTimeUs = */ C.TIME_UNSET); /* mediaEndTimeUs= */ C.TIME_UNSET);
this.callback = callback; this.callback = callback;
prepared = true; prepared = true;
Util.castNonNull(this.callback).onPrepared(this); Util.castNonNull(this.callback).onPrepared(this);
...@@ -126,7 +126,7 @@ public class FakeAdaptiveMediaPeriod ...@@ -126,7 +126,7 @@ public class FakeAdaptiveMediaPeriod
C.SELECTION_REASON_UNKNOWN, C.SELECTION_REASON_UNKNOWN,
/* trackSelectionData= */ null, /* trackSelectionData= */ null,
/* mediaStartTimeUs= */ 0, /* mediaStartTimeUs= */ 0,
/* mediaEndTimeUs = */ C.TIME_UNSET); /* mediaEndTimeUs= */ C.TIME_UNSET);
} }
@Override @Override
......
...@@ -232,7 +232,7 @@ public class FakeMediaPeriod implements MediaPeriod { ...@@ -232,7 +232,7 @@ public class FakeMediaPeriod implements MediaPeriod {
C.SELECTION_REASON_UNKNOWN, C.SELECTION_REASON_UNKNOWN,
/* trackSelectionData= */ null, /* trackSelectionData= */ null,
/* mediaStartTimeUs= */ 0, /* mediaStartTimeUs= */ 0,
/* mediaEndTimeUs = */ C.TIME_UNSET); /* mediaEndTimeUs= */ C.TIME_UNSET);
prepareCallback = callback; prepareCallback = callback;
if (deferOnPrepared) { if (deferOnPrepared) {
playerHandler = Util.createHandlerForCurrentLooper(); playerHandler = Util.createHandlerForCurrentLooper();
...@@ -416,7 +416,7 @@ public class FakeMediaPeriod implements MediaPeriod { ...@@ -416,7 +416,7 @@ public class FakeMediaPeriod implements MediaPeriod {
C.SELECTION_REASON_UNKNOWN, C.SELECTION_REASON_UNKNOWN,
/* trackSelectionData= */ null, /* trackSelectionData= */ null,
/* mediaStartTimeUs= */ 0, /* mediaStartTimeUs= */ 0,
/* mediaEndTimeUs = */ C.TIME_UNSET); /* mediaEndTimeUs= */ C.TIME_UNSET);
} }
private boolean isLoadingFinished() { private boolean isLoadingFinished() {
......
...@@ -387,7 +387,7 @@ public class FakeMediaSource extends BaseMediaSource { ...@@ -387,7 +387,7 @@ public class FakeMediaSource extends BaseMediaSource {
C.SELECTION_REASON_UNKNOWN, C.SELECTION_REASON_UNKNOWN,
/* trackSelectionData= */ null, /* trackSelectionData= */ null,
/* mediaStartTimeMs= */ C.TIME_UNSET, /* mediaStartTimeMs= */ C.TIME_UNSET,
/* mediaEndTimeMs = */ C.TIME_UNSET); /* mediaEndTimeMs= */ C.TIME_UNSET);
long elapsedRealTimeMs = SystemClock.elapsedRealtime(); long elapsedRealTimeMs = SystemClock.elapsedRealtime();
MediaSourceEventListener.EventDispatcher eventDispatcher = MediaSourceEventListener.EventDispatcher eventDispatcher =
createEventDispatcher(/* mediaPeriodId= */ null); createEventDispatcher(/* mediaPeriodId= */ null);
......
...@@ -67,7 +67,7 @@ public class FakeTrackSelector extends DefaultTrackSelector { ...@@ -67,7 +67,7 @@ public class FakeTrackSelector extends DefaultTrackSelector {
boolean hasTracks = trackGroupArray.length > 0; boolean hasTracks = trackGroupArray.length > 0;
definitions[i] = definitions[i] =
hasTracks hasTracks
? new ExoTrackSelection.Definition(trackGroupArray.get(0), /* tracks...= */ 0) ? new ExoTrackSelection.Definition(trackGroupArray.get(0), /* tracks= */ 0)
: null; : null;
} }
return definitions; return definitions;
......
...@@ -82,17 +82,17 @@ public final class FakeClockTest { ...@@ -82,17 +82,17 @@ public final class FakeClockTest {
handler.obtainMessage(/* what= */ 2, /* obj= */ testObject).sendToTarget(); handler.obtainMessage(/* what= */ 2, /* obj= */ testObject).sendToTarget();
handler.obtainMessage(/* what= */ 3, /* arg1= */ 99, /* arg2= */ 44).sendToTarget(); handler.obtainMessage(/* what= */ 3, /* arg1= */ 99, /* arg2= */ 44).sendToTarget();
handler handler
.obtainMessage(/* what= */ 4, /* arg1= */ 88, /* arg2= */ 33, /* obj=*/ testObject) .obtainMessage(/* what= */ 4, /* arg1= */ 88, /* arg2= */ 33, /* obj= */ testObject)
.sendToTarget(); .sendToTarget();
ShadowLooper.idleMainLooper(); ShadowLooper.idleMainLooper();
shadowOf(handler.getLooper()).idle(); shadowOf(handler.getLooper()).idle();
assertThat(callback.messages) assertThat(callback.messages)
.containsExactly( .containsExactly(
new MessageData(/* what= */ 1, /* arg1= */ 0, /* arg2= */ 0, /* obj=*/ null), new MessageData(/* what= */ 1, /* arg1= */ 0, /* arg2= */ 0, /* obj= */ null),
new MessageData(/* what= */ 2, /* arg1= */ 0, /* arg2= */ 0, /* obj=*/ testObject), new MessageData(/* what= */ 2, /* arg1= */ 0, /* arg2= */ 0, /* obj= */ testObject),
new MessageData(/* what= */ 3, /* arg1= */ 99, /* arg2= */ 44, /* obj=*/ null), new MessageData(/* what= */ 3, /* arg1= */ 99, /* arg2= */ 44, /* obj= */ null),
new MessageData(/* what= */ 4, /* arg1= */ 88, /* arg2= */ 33, /* obj=*/ testObject)) new MessageData(/* what= */ 4, /* arg1= */ 88, /* arg2= */ 33, /* obj= */ testObject))
.inOrder(); .inOrder();
} }
...@@ -113,8 +113,8 @@ public final class FakeClockTest { ...@@ -113,8 +113,8 @@ public final class FakeClockTest {
assertThat(callback.messages) assertThat(callback.messages)
.containsExactly( .containsExactly(
new MessageData(/* what= */ 1, /* arg1= */ 0, /* arg2= */ 0, /* obj=*/ null), new MessageData(/* what= */ 1, /* arg1= */ 0, /* arg2= */ 0, /* obj= */ null),
new MessageData(/* what= */ 4, /* arg1= */ 0, /* arg2= */ 0, /* obj=*/ null)) new MessageData(/* what= */ 4, /* arg1= */ 0, /* arg2= */ 0, /* obj= */ null))
.inOrder(); .inOrder();
fakeClock.advanceTime(50); fakeClock.advanceTime(50);
...@@ -122,14 +122,14 @@ public final class FakeClockTest { ...@@ -122,14 +122,14 @@ public final class FakeClockTest {
assertThat(callback.messages).hasSize(3); assertThat(callback.messages).hasSize(3);
assertThat(Iterables.getLast(callback.messages)) assertThat(Iterables.getLast(callback.messages))
.isEqualTo(new MessageData(/* what= */ 3, /* arg1= */ 0, /* arg2= */ 0, /* obj=*/ null)); .isEqualTo(new MessageData(/* what= */ 3, /* arg1= */ 0, /* arg2= */ 0, /* obj= */ null));
fakeClock.advanceTime(50); fakeClock.advanceTime(50);
shadowOf(handler.getLooper()).idle(); shadowOf(handler.getLooper()).idle();
assertThat(callback.messages).hasSize(4); assertThat(callback.messages).hasSize(4);
assertThat(Iterables.getLast(callback.messages)) assertThat(Iterables.getLast(callback.messages))
.isEqualTo(new MessageData(/* what= */ 2, /* arg1= */ 0, /* arg2= */ 0, /* obj=*/ null)); .isEqualTo(new MessageData(/* what= */ 2, /* arg1= */ 0, /* arg2= */ 0, /* obj= */ null));
} }
@Test @Test
...@@ -149,10 +149,10 @@ public final class FakeClockTest { ...@@ -149,10 +149,10 @@ public final class FakeClockTest {
assertThat(callback.messages) assertThat(callback.messages)
.containsExactly( .containsExactly(
new MessageData(/* what= */ 3, /* arg1= */ 0, /* arg2= */ 0, /* obj=*/ null), new MessageData(/* what= */ 3, /* arg1= */ 0, /* arg2= */ 0, /* obj= */ null),
new MessageData(/* what= */ 2, /* arg1= */ 0, /* arg2= */ 0, /* obj=*/ null), new MessageData(/* what= */ 2, /* arg1= */ 0, /* arg2= */ 0, /* obj= */ null),
new MessageData(/* what= */ 1, /* arg1= */ 0, /* arg2= */ 0, /* obj=*/ null), new MessageData(/* what= */ 1, /* arg1= */ 0, /* arg2= */ 0, /* obj= */ null),
new MessageData(/* what= */ 4, /* arg1= */ 0, /* arg2= */ 0, /* obj=*/ null)) new MessageData(/* what= */ 4, /* arg1= */ 0, /* arg2= */ 0, /* obj= */ null))
.inOrder(); .inOrder();
} }
...@@ -223,14 +223,14 @@ public final class FakeClockTest { ...@@ -223,14 +223,14 @@ public final class FakeClockTest {
assertThat(callback.messages) assertThat(callback.messages)
.containsExactly( .containsExactly(
new MessageData(/* what= */ 3, /* arg1= */ 0, /* arg2= */ 0, /* obj=*/ null)); new MessageData(/* what= */ 3, /* arg1= */ 0, /* arg2= */ 0, /* obj= */ null));
assertThat(testRunnable1.hasRun).isTrue(); assertThat(testRunnable1.hasRun).isTrue();
assertThat(testRunnable2.hasRun).isTrue(); assertThat(testRunnable2.hasRun).isTrue();
// Assert that message with same "what" on other handler wasn't removed. // Assert that message with same "what" on other handler wasn't removed.
assertThat(otherCallback.messages) assertThat(otherCallback.messages)
.containsExactly( .containsExactly(
new MessageData(/* what= */ 2, /* arg1= */ 0, /* arg2= */ 0, /* obj=*/ null)); new MessageData(/* what= */ 2, /* arg1= */ 0, /* arg2= */ 0, /* obj= */ null));
} }
@Test @Test
...@@ -266,7 +266,7 @@ public final class FakeClockTest { ...@@ -266,7 +266,7 @@ public final class FakeClockTest {
// Assert that message on other handler wasn't removed. // Assert that message on other handler wasn't removed.
assertThat(otherCallback.messages) assertThat(otherCallback.messages)
.containsExactly( .containsExactly(
new MessageData(/* what= */ 1, /* arg1= */ 0, /* arg2= */ 0, /* obj=*/ null)); new MessageData(/* what= */ 1, /* arg1= */ 0, /* arg2= */ 0, /* obj= */ null));
} }
@Test @Test
......
...@@ -39,7 +39,7 @@ public class FakeTimelineTest { ...@@ -39,7 +39,7 @@ public class FakeTimelineTest {
FakeTimeline.createMultiPeriodAdTimeline( FakeTimeline.createMultiPeriodAdTimeline(
windowId, windowId,
numberOfPlayedAds, numberOfPlayedAds,
/* isAdPeriodFlags...= */ true, /* isAdPeriodFlags= */ true,
false, false,
true, true,
true, true,
...@@ -94,7 +94,7 @@ public class FakeTimelineTest { ...@@ -94,7 +94,7 @@ public class FakeTimelineTest {
FakeTimeline.createMultiPeriodAdTimeline( FakeTimeline.createMultiPeriodAdTimeline(
/* windowId= */ new Object(), /* windowId= */ new Object(),
/* numberOfPlayedAds= */ 0, /* numberOfPlayedAds= */ 0,
/* isAdPeriodFlags...= */ false, /* isAdPeriodFlags= */ false,
true, true,
true, true,
false); false);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment