From e482aa2be8388cefc3553ad6b0c2d32af4076d99 Mon Sep 17 00:00:00 2001 From: andrewlewis Date: Tue, 12 May 2020 08:55:27 +0100 Subject: [PATCH] Fix method ordering in ImaAdsLoader Put static methods at the end. Also add a couple of missing parameter name comments. PiperOrigin-RevId: 311077684 --- .../exoplayer2/ext/ima/ImaAdsLoader.java | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) 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 84bdc8e8a3..0b9a8d747b 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 @@ -237,7 +237,7 @@ public final class ImaAdsLoader context, adTagUri, imaSdkSettings, - null, + /* adsResponse= */ null, vastLoadTimeoutMs, mediaLoadTimeoutMs, mediaBitrate, @@ -257,7 +257,7 @@ public final class ImaAdsLoader public ImaAdsLoader buildForAdsResponse(String adsResponse) { return new ImaAdsLoader( context, - null, + /* adTagUri= */ null, imaSdkSettings, adsResponse, vastLoadTimeoutMs, @@ -1350,17 +1350,6 @@ public final class ImaAdsLoader } } - private static DataSpec getAdsDataSpec(@Nullable Uri adTagUri) { - return new DataSpec(adTagUri != null ? adTagUri : Uri.EMPTY); - } - - private static long getContentPeriodPositionMs( - Player player, Timeline timeline, Timeline.Period period) { - long contentWindowPositionMs = player.getContentPosition(); - return contentWindowPositionMs - - timeline.getPeriod(/* periodIndex= */ 0, period).getPositionInWindowMs(); - } - private int getAdGroupIndex(AdPodInfo adPodInfo) { if (adPodInfo.getPodIndex() == -1) { // This is a postroll ad. @@ -1377,6 +1366,22 @@ public final class ImaAdsLoader throw new IllegalStateException("Failed to find cue point"); } + private String getAdMediaInfoString(AdMediaInfo adMediaInfo) { + @Nullable AdInfo adInfo = adInfoByAdMediaInfo.get(adMediaInfo); + return "AdMediaInfo[" + adMediaInfo.getUrl() + (adInfo != null ? ", " + adInfo : "") + "]"; + } + + private static DataSpec getAdsDataSpec(@Nullable Uri adTagUri) { + return new DataSpec(adTagUri != null ? adTagUri : Uri.EMPTY); + } + + private static long getContentPeriodPositionMs( + Player player, Timeline timeline, Timeline.Period period) { + long contentWindowPositionMs = player.getContentPosition(); + return contentWindowPositionMs + - timeline.getPeriod(/* periodIndex= */ 0, period).getPositionInWindowMs(); + } + private static long[] getAdGroupTimesUs(List cuePoints) { if (cuePoints.isEmpty()) { // If no cue points are specified, there is a preroll ad. @@ -1440,11 +1445,6 @@ public final class ImaAdsLoader Context context, ImaSdkSettings imaSdkSettings, AdDisplayContainer adDisplayContainer); } - private String getAdMediaInfoString(AdMediaInfo adMediaInfo) { - @Nullable AdInfo adInfo = adInfoByAdMediaInfo.get(adMediaInfo); - return "AdMediaInfo[" + adMediaInfo.getUrl() + (adInfo != null ? ", " + adInfo : "") + "]"; - } - // TODO: Consider moving this into AdPlaybackState. private static final class AdInfo { public final int adGroupIndex;