mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Fix review comments
This commit is contained in:
parent
7d3e6b0f27
commit
683a5b8403
@ -845,7 +845,7 @@ public interface AnalyticsListener {
|
||||
|
||||
/**
|
||||
* @deprecated Implement {@link #onLoadStarted(EventTime, LoadEventInfo, MediaLoadData, int)}
|
||||
* instead.
|
||||
* instead, and check for {@code retryCount == 0} for equivalent behavior.
|
||||
*/
|
||||
@UnstableApi
|
||||
@Deprecated
|
||||
|
@ -407,14 +407,13 @@ public class DefaultAnalyticsCollector implements AnalyticsCollector {
|
||||
MediaLoadData mediaLoadData,
|
||||
int retryCount) {
|
||||
EventTime eventTime = generateMediaPeriodEventTime(windowIndex, mediaPeriodId);
|
||||
sendEvent(
|
||||
eventTime,
|
||||
/* eventFlag= */ C.INDEX_UNSET,
|
||||
listener -> listener.onLoadStarted(eventTime, loadEventInfo, mediaLoadData));
|
||||
sendEvent(
|
||||
eventTime,
|
||||
AnalyticsListener.EVENT_LOAD_STARTED,
|
||||
listener -> listener.onLoadStarted(eventTime, loadEventInfo, mediaLoadData, retryCount));
|
||||
listener -> {
|
||||
listener.onLoadStarted(eventTime, loadEventInfo, mediaLoadData);
|
||||
listener.onLoadStarted(eventTime, loadEventInfo, mediaLoadData, retryCount);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -223,6 +223,15 @@ public interface MediaSourceEventListener {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {link {@link #loadStarted(LoadEventInfo, int, int)} instead to pass {@code
|
||||
* retryCount}.
|
||||
*/
|
||||
@Deprecated
|
||||
public void loadStarted(LoadEventInfo loadEventInfo, @DataType int dataType) {
|
||||
loadStarted(loadEventInfo, dataType, /* retryCount= */ 0);
|
||||
}
|
||||
|
||||
/** Dispatches {@link #onLoadStarted(int, MediaPeriodId, LoadEventInfo, MediaLoadData, int)}. */
|
||||
public void loadStarted(LoadEventInfo loadEventInfo, @DataType int dataType, int retryCount) {
|
||||
loadStarted(
|
||||
@ -237,6 +246,32 @@ public interface MediaSourceEventListener {
|
||||
retryCount);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {link {@link #loadStarted(LoadEventInfo, int, int, Format, int, Object, long,
|
||||
* long, int)} )} instead to pass {@code retryCount}.
|
||||
*/
|
||||
@Deprecated
|
||||
public void loadStarted(
|
||||
LoadEventInfo loadEventInfo,
|
||||
@DataType int dataType,
|
||||
@C.TrackType int trackType,
|
||||
@Nullable Format trackFormat,
|
||||
@C.SelectionReason int trackSelectionReason,
|
||||
@Nullable Object trackSelectionData,
|
||||
long mediaStartTimeUs,
|
||||
long mediaEndTimeUs) {
|
||||
loadStarted(
|
||||
loadEventInfo,
|
||||
new MediaLoadData(
|
||||
dataType,
|
||||
trackType,
|
||||
trackFormat,
|
||||
trackSelectionReason,
|
||||
trackSelectionData,
|
||||
usToMs(mediaStartTimeUs),
|
||||
usToMs(mediaEndTimeUs)));
|
||||
}
|
||||
|
||||
/** Dispatches {@link #onLoadStarted(int, MediaPeriodId, LoadEventInfo, MediaLoadData, int)}. */
|
||||
public void loadStarted(
|
||||
LoadEventInfo loadEventInfo,
|
||||
@ -261,6 +296,15 @@ public interface MediaSourceEventListener {
|
||||
retryCount);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {link {@link #loadStarted(LoadEventInfo, MediaLoadData, int)} instead to pass
|
||||
* {@code retryCount}.
|
||||
*/
|
||||
@Deprecated
|
||||
public void loadStarted(LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData) {
|
||||
loadStarted(loadEventInfo, mediaLoadData, /* retryCount= */ 0);
|
||||
}
|
||||
|
||||
/** Dispatches {@link #onLoadStarted(int, MediaPeriodId, LoadEventInfo, MediaLoadData, int)}. */
|
||||
public void loadStarted(
|
||||
LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData, int retryCount) {
|
||||
|
@ -609,7 +609,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
dataSource.getLastResponseHeaders(),
|
||||
elapsedRealtimeMs,
|
||||
loadDurationMs,
|
||||
/* bytesLoaded= */ 0);
|
||||
dataSource.getBytesRead());
|
||||
mediaSourceEventDispatcher.loadStarted(
|
||||
loadEventInfo,
|
||||
C.DATA_TYPE_MEDIA,
|
||||
|
@ -209,7 +209,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
dataSource.getLastResponseHeaders(),
|
||||
elapsedRealtimeMs,
|
||||
loadDurationMs,
|
||||
/* bytesLoaded= */ 0);
|
||||
dataSource.getBytesRead());
|
||||
eventDispatcher.loadStarted(
|
||||
loadEventInfo,
|
||||
C.DATA_TYPE_MEDIA,
|
||||
|
@ -429,7 +429,7 @@ public final class ServerSideAdInsertionMediaSource extends BaseMediaSource
|
||||
LoadEventInfo loadEventInfo,
|
||||
MediaLoadData mediaLoadData,
|
||||
int retryCount) {
|
||||
// TODO file a bug to track updating this.
|
||||
// TODO: b/375408535 - Update this to support non-zero retry counts.
|
||||
if (retryCount == 0) {
|
||||
@Nullable
|
||||
MediaPeriodImpl mediaPeriod =
|
||||
|
@ -440,7 +440,7 @@ public class ChunkSampleStream<T extends ChunkSource>
|
||||
loadable.getResponseHeaders(),
|
||||
elapsedRealtimeMs,
|
||||
loadDurationMs,
|
||||
/* bytesLoaded= */ 0),
|
||||
loadable.dataSource.getBytesRead()),
|
||||
loadable.type,
|
||||
primaryTrackType,
|
||||
loadable.trackFormat,
|
||||
|
@ -146,10 +146,9 @@ import org.mockito.InOrder;
|
||||
public final class DefaultAnalyticsCollectorTest {
|
||||
|
||||
// Deprecated event constants.
|
||||
private static final long EVENT_PLAYER_STATE_CHANGED = 1L << 63;
|
||||
private static final long EVENT_SEEK_STARTED = 1L << 62;
|
||||
// Start from +1 of the MIN because it will collide with 1L << 63
|
||||
private static final long DEPRECATED_EVENT_LOAD_STARTED = Long.MIN_VALUE + 1;
|
||||
private static final long EVENT_PLAYER_STATE_CHANGED = Long.MIN_VALUE;
|
||||
private static final long EVENT_SEEK_STARTED = Long.MIN_VALUE + 1;
|
||||
private static final long DEPRECATED_EVENT_LOAD_STARTED = Long.MIN_VALUE + 2;
|
||||
|
||||
private static final UUID DRM_SCHEME_UUID =
|
||||
UUID.nameUUIDFromBytes(TestUtil.createByteArray(7, 8, 9));
|
||||
|
@ -642,7 +642,7 @@ public final class DashMediaSource extends BaseMediaSource {
|
||||
loadable.getResponseHeaders(),
|
||||
elapsedRealtimeMs,
|
||||
loadDurationMs,
|
||||
/* bytesLoaded= */ 0),
|
||||
loadable.bytesLoaded()),
|
||||
loadable.type,
|
||||
retryCount);
|
||||
}
|
||||
|
@ -861,7 +861,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
|
||||
loadable.getResponseHeaders(),
|
||||
elapsedRealtimeMs,
|
||||
loadDurationMs,
|
||||
/* bytesLoaded= */ 0),
|
||||
loadable.bytesLoaded()),
|
||||
loadable.type,
|
||||
trackType,
|
||||
loadable.trackFormat,
|
||||
|
@ -260,7 +260,7 @@ public final class DefaultHlsPlaylistTracker
|
||||
loadable.getResponseHeaders(),
|
||||
elapsedRealtimeMs,
|
||||
loadDurationMs,
|
||||
/* bytesLoaded= */ 0),
|
||||
loadable.bytesLoaded()),
|
||||
loadable.type,
|
||||
retryCount);
|
||||
}
|
||||
|
@ -511,9 +511,9 @@ public final class SsMediaSource extends BaseMediaSource
|
||||
loadable.getResponseHeaders(),
|
||||
elapsedRealtimeMs,
|
||||
loadDurationMs,
|
||||
/* bytesLoaded= */ 0),
|
||||
loadable.bytesLoaded()),
|
||||
loadable.type,
|
||||
/* retryCount= */ 0);
|
||||
retryCount);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -678,12 +678,7 @@ public final class SsMediaSource extends BaseMediaSource
|
||||
ParsingLoadable<SsManifest> loadable =
|
||||
new ParsingLoadable<>(
|
||||
manifestDataSource, manifestUri, C.DATA_TYPE_MANIFEST, manifestParser);
|
||||
long elapsedRealtimeMs =
|
||||
manifestLoader.startLoading(
|
||||
loadable, this, loadErrorHandlingPolicy.getMinimumLoadableRetryCount(loadable.type));
|
||||
manifestEventDispatcher.loadStarted(
|
||||
new LoadEventInfo(loadable.loadTaskId, loadable.dataSpec, elapsedRealtimeMs),
|
||||
loadable.type,
|
||||
/* retryCount= */ 0);
|
||||
manifestLoader.startLoading(
|
||||
loadable, this, loadErrorHandlingPolicy.getMinimumLoadableRetryCount(loadable.type));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user