Fix parameter names on overridden methods

The dokka javadoc generation tool complains when parameter names don't match between a method and its override. This change updates occurrences where there is currently a mismatch.

Notable renamings that might be controversial:
- `onPlaybackStateChanged(int state)` to `onPlaybackStateChanged(int playbackState)` affected a lot of lines but seems more consistent with other '-Changed' methods.
- `handleMessage(int messageType, Object payload)` to `handleMessage(int messageType, Object message)`
- `ExtractorInput` and `DataSource` inherit `DataReader` which had `read(byte[] target, ...`, while data sources normally called the first parameter `buffer`. I have standardized these all to use `buffer` even though it looks out of place in the `ExtractorInput` interface (which has more `read` methods with `target`).

PiperOrigin-RevId: 387290360
This commit is contained in:
andrewlewis 2021-07-28 08:47:34 +01:00 committed by Andrew Lewis
parent 41fe5aa1e3
commit 9c27cfcda7
89 changed files with 303 additions and 300 deletions

View File

@ -423,8 +423,8 @@ public class PlayerActivity extends AppCompatActivity
} }
@Override @Override
public void onPlayerError(@NonNull PlaybackException e) { public void onPlayerError(@NonNull PlaybackException error) {
if (e.errorCode == PlaybackException.ERROR_CODE_BEHIND_LIVE_WINDOW) { if (error.errorCode == PlaybackException.ERROR_CODE_BEHIND_LIVE_WINDOW) {
player.seekToDefaultPosition(); player.seekToDefaultPosition();
player.prepare(); player.prepare();
} else { } else {

View File

@ -142,8 +142,8 @@ the demo app exemplifies this approach.
~~~ ~~~
@Override @Override
public void onPlayerError(PlaybackException e) { public void onPlayerError(PlaybackException error) {
if (e.errorCode == PlaybackException.ERROR_CODE_BEHIND_LIVE_WINDOW) { if (eror.errorCode == PlaybackException.ERROR_CODE_BEHIND_LIVE_WINDOW) {
// Re-initialize player at the current live window default position. // Re-initialize player at the current live window default position.
player.seekToDefaultPosition(); player.seekToDefaultPosition();
player.prepare(); player.prepare();

View File

@ -43,29 +43,29 @@ public final class DefaultMediaItemConverter implements MediaItemConverter {
private static final String KEY_REQUEST_HEADERS = "requestHeaders"; private static final String KEY_REQUEST_HEADERS = "requestHeaders";
@Override @Override
public MediaItem toMediaItem(MediaQueueItem item) { public MediaItem toMediaItem(MediaQueueItem mediaQueueItem) {
// `item` came from `toMediaQueueItem()` so the custom JSON data must be set. // `item` came from `toMediaQueueItem()` so the custom JSON data must be set.
MediaInfo mediaInfo = item.getMedia(); MediaInfo mediaInfo = mediaQueueItem.getMedia();
Assertions.checkNotNull(mediaInfo); Assertions.checkNotNull(mediaInfo);
return getMediaItem(Assertions.checkNotNull(mediaInfo.getCustomData())); return getMediaItem(Assertions.checkNotNull(mediaInfo.getCustomData()));
} }
@Override @Override
public MediaQueueItem toMediaQueueItem(MediaItem item) { public MediaQueueItem toMediaQueueItem(MediaItem mediaItem) {
Assertions.checkNotNull(item.playbackProperties); Assertions.checkNotNull(mediaItem.playbackProperties);
if (item.playbackProperties.mimeType == null) { if (mediaItem.playbackProperties.mimeType == null) {
throw new IllegalArgumentException("The item must specify its mimeType"); throw new IllegalArgumentException("The item must specify its mimeType");
} }
MediaMetadata metadata = new MediaMetadata(MediaMetadata.MEDIA_TYPE_MOVIE); MediaMetadata metadata = new MediaMetadata(MediaMetadata.MEDIA_TYPE_MOVIE);
if (item.mediaMetadata.title != null) { if (mediaItem.mediaMetadata.title != null) {
metadata.putString(MediaMetadata.KEY_TITLE, item.mediaMetadata.title.toString()); metadata.putString(MediaMetadata.KEY_TITLE, mediaItem.mediaMetadata.title.toString());
} }
MediaInfo mediaInfo = MediaInfo mediaInfo =
new MediaInfo.Builder(item.playbackProperties.uri.toString()) new MediaInfo.Builder(mediaItem.playbackProperties.uri.toString())
.setStreamType(MediaInfo.STREAM_TYPE_BUFFERED) .setStreamType(MediaInfo.STREAM_TYPE_BUFFERED)
.setContentType(item.playbackProperties.mimeType) .setContentType(mediaItem.playbackProperties.mimeType)
.setMetadata(metadata) .setMetadata(metadata)
.setCustomData(getCustomData(item)) .setCustomData(getCustomData(mediaItem))
.build(); .build();
return new MediaQueueItem.Builder(mediaInfo).build(); return new MediaQueueItem.Builder(mediaInfo).build();
} }

View File

@ -767,10 +767,10 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource {
} }
@Override @Override
public int read(byte[] buffer, int offset, int readLength) throws HttpDataSourceException { public int read(byte[] buffer, int offset, int length) throws HttpDataSourceException {
Assertions.checkState(opened); Assertions.checkState(opened);
if (readLength == 0) { if (length == 0) {
return 0; return 0;
} else if (bytesRemaining == 0) { } else if (bytesRemaining == 0) {
return C.RESULT_END_OF_INPUT; return C.RESULT_END_OF_INPUT;
@ -801,7 +801,7 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource {
Longs.min( Longs.min(
bytesRemaining != C.LENGTH_UNSET ? bytesRemaining : Long.MAX_VALUE, bytesRemaining != C.LENGTH_UNSET ? bytesRemaining : Long.MAX_VALUE,
readBuffer.remaining(), readBuffer.remaining(),
readLength); length);
readBuffer.get(buffer, offset, bytesRead); readBuffer.get(buffer, offset, bytesRead);

View File

@ -127,11 +127,12 @@ public class GvrAudioProcessor implements AudioProcessor {
} }
@Override @Override
public void queueInput(ByteBuffer input) { public void queueInput(ByteBuffer inputBuffer) {
int position = input.position(); int position = inputBuffer.position();
Assertions.checkNotNull(gvrAudioSurround); Assertions.checkNotNull(gvrAudioSurround);
int readBytes = gvrAudioSurround.addInput(input, position, input.limit() - position); int readBytes =
input.position(position + readBytes); gvrAudioSurround.addInput(inputBuffer, position, inputBuffer.limit() - position);
inputBuffer.position(position + readBytes);
} }
@Override @Override

View File

@ -258,20 +258,20 @@ public final class LeanbackPlayerAdapter extends PlayerAdapter implements Runnab
} }
@Override @Override
public void onPlayerError(PlaybackException exception) { public void onPlayerError(PlaybackException error) {
Callback callback = getCallback(); Callback callback = getCallback();
if (errorMessageProvider != null) { if (errorMessageProvider != null) {
Pair<Integer, String> errorMessage = errorMessageProvider.getErrorMessage(exception); Pair<Integer, String> errorMessage = errorMessageProvider.getErrorMessage(error);
callback.onError(LeanbackPlayerAdapter.this, errorMessage.first, errorMessage.second); callback.onError(LeanbackPlayerAdapter.this, errorMessage.first, errorMessage.second);
} else { } else {
callback.onError( callback.onError(
LeanbackPlayerAdapter.this, LeanbackPlayerAdapter.this,
exception.errorCode, error.errorCode,
// This string was probably tailored for MediaPlayer, whose callback takes 2 ints as // This string was probably tailored for MediaPlayer, whose callback takes 2 ints as
// error code. Since ExoPlayer provides a single error code, we just pass 0 as the // error code. Since ExoPlayer provides a single error code, we just pass 0 as the
// extra. // extra.
context.getString( context.getString(
R.string.lb_media_player_error, /* formatArgs...= */ exception.errorCode, 0)); R.string.lb_media_player_error, /* formatArgs...= */ error.errorCode, 0));
} }
} }

View File

@ -165,8 +165,8 @@ import org.junit.rules.ExternalResource;
} }
@Override @Override
public int read(byte[] target, int offset, int length) throws IOException { public int read(byte[] buffer, int offset, int length) throws IOException {
return wrappedDataSource.read(target, offset, length); return wrappedDataSource.read(buffer, offset, length);
} }
@Override @Override

View File

@ -594,7 +594,7 @@ import java.util.List;
} }
@Override @Override
public void onPlaybackStateChanged(@Player.State int state) { public void onPlaybackStateChanged(@Player.State int playbackState) {
handlePlayerStateChanged(); handlePlayerStateChanged();
} }

View File

@ -97,14 +97,14 @@ public final class SessionCallbackBuilder {
* @param session The media session. * @param session The media session.
* @param controllerInfo The {@link ControllerInfo} for the controller for which allowed * @param controllerInfo The {@link ControllerInfo} for the controller for which allowed
* commands are being queried. * commands are being queried.
* @param baseAllowedSessionCommand Base allowed session commands for customization. * @param baseAllowedSessionCommands Base allowed session commands for customization.
* @return The allowed commands for the controller. * @return The allowed commands for the controller.
* @see MediaSession.SessionCallback#onConnect(MediaSession, ControllerInfo) * @see MediaSession.SessionCallback#onConnect(MediaSession, ControllerInfo)
*/ */
SessionCommandGroup getAllowedCommands( SessionCommandGroup getAllowedCommands(
MediaSession session, MediaSession session,
ControllerInfo controllerInfo, ControllerInfo controllerInfo,
SessionCommandGroup baseAllowedSessionCommand); SessionCommandGroup baseAllowedSessionCommands);
/** /**
* Called when a {@link MediaController} has called an API that controls {@link SessionPlayer} * Called when a {@link MediaController} has called an API that controls {@link SessionPlayer}

View File

@ -374,9 +374,9 @@ public class OkHttpDataSource extends BaseDataSource implements HttpDataSource {
} }
@Override @Override
public int read(byte[] buffer, int offset, int readLength) throws HttpDataSourceException { public int read(byte[] buffer, int offset, int length) throws HttpDataSourceException {
try { try {
return readInternal(buffer, offset, readLength); return readInternal(buffer, offset, length);
} catch (IOException e) { } catch (IOException e) {
throw new HttpDataSourceException( throw new HttpDataSourceException(
e, e,

View File

@ -85,8 +85,8 @@ public final class RtmpDataSource extends BaseDataSource {
} }
@Override @Override
public int read(byte[] buffer, int offset, int readLength) throws IOException { public int read(byte[] buffer, int offset, int length) throws IOException {
int bytesRead = castNonNull(rtmpClient).read(buffer, offset, readLength); int bytesRead = castNonNull(rtmpClient).read(buffer, offset, length);
if (bytesRead == -1) { if (bytesRead == -1) {
return C.RESULT_END_OF_INPUT; return C.RESULT_END_OF_INPUT;
} }

View File

@ -680,8 +680,8 @@ public class ForwardingPlayer implements Player {
} }
@Override @Override
public void onPlaybackStateChanged(@State int state) { public void onPlaybackStateChanged(@State int playbackState) {
eventListener.onPlaybackStateChanged(state); eventListener.onPlaybackStateChanged(playbackState);
} }
@Override @Override

View File

@ -192,9 +192,9 @@ public interface Player {
* <p>{@link #onEvents(Player, Events)} will also be called to report this event along with * <p>{@link #onEvents(Player, Events)} will also be called to report this event along with
* other events that happen in the same {@link Looper} message queue iteration. * other events that happen in the same {@link Looper} message queue iteration.
* *
* @param state The new playback {@link State state}. * @param playbackState The new playback {@link State state}.
*/ */
default void onPlaybackStateChanged(@State int state) {} default void onPlaybackStateChanged(@State int playbackState) {}
/** /**
* Called when the value returned from {@link #getPlayWhenReady()} changes. * Called when the value returned from {@link #getPlayWhenReady()} changes.
@ -899,7 +899,7 @@ public interface Player {
default void onAvailableCommandsChanged(Commands availableCommands) {} default void onAvailableCommandsChanged(Commands availableCommands) {}
@Override @Override
default void onPlaybackStateChanged(@State int state) {} default void onPlaybackStateChanged(@State int playbackState) {}
@Override @Override
default void onPlayWhenReadyChanged( default void onPlayWhenReadyChanged(

View File

@ -28,7 +28,7 @@ public interface DataReader {
* Otherwise, the call will block until at least one byte of data has been read and the number of * Otherwise, the call will block until at least one byte of data has been read and the number of
* bytes read is returned. * bytes read is returned.
* *
* @param target A target array into which data should be written. * @param buffer A target array into which data should be written.
* @param offset The offset into the target array at which to write. * @param offset The offset into the target array at which to write.
* @param length The maximum number of bytes to read from the input. * @param length The maximum number of bytes to read from the input.
* @return The number of bytes read, or {@link C#RESULT_END_OF_INPUT} if the input has ended. This * @return The number of bytes read, or {@link C#RESULT_END_OF_INPUT} if the input has ended. This
@ -36,5 +36,5 @@ public interface DataReader {
* reached, the method was interrupted, or the operation was aborted early for another reason. * reached, the method was interrupted, or the operation was aborted early for another reason.
* @throws IOException If an error occurs reading from the input. * @throws IOException If an error occurs reading from the input.
*/ */
int read(byte[] target, int offset, int length) throws IOException; int read(byte[] buffer, int offset, int length) throws IOException;
} }

View File

@ -475,9 +475,9 @@ public class DefaultHttpDataSource extends BaseDataSource implements HttpDataSou
} }
@Override @Override
public int read(byte[] buffer, int offset, int readLength) throws HttpDataSourceException { public int read(byte[] buffer, int offset, int length) throws HttpDataSourceException {
try { try {
return readInternal(buffer, offset, readLength); return readInternal(buffer, offset, length);
} catch (IOException e) { } catch (IOException e) {
throw new HttpDataSourceException( throw new HttpDataSourceException(
e, e,

View File

@ -454,7 +454,7 @@ public interface HttpDataSource extends DataSource {
void close() throws HttpDataSourceException; void close() throws HttpDataSourceException;
@Override @Override
int read(byte[] buffer, int offset, int readLength) throws HttpDataSourceException; int read(byte[] buffer, int offset, int length) throws HttpDataSourceException;
/** /**
* Sets the value of a request header. The value will be used for subsequent connections * Sets the value of a request header. The value will be used for subsequent connections

View File

@ -61,7 +61,7 @@ public interface TransferListener {
* @param source The source performing the transfer. * @param source The source performing the transfer.
* @param dataSpec Describes the data being transferred. * @param dataSpec Describes the data being transferred.
* @param isNetwork Whether the data is transferred through a network. * @param isNetwork Whether the data is transferred through a network.
* @param bytesTransferred The number of bytes transferred since the previous call to this method * @param bytesTransferred The number of bytes transferred since the previous call to this method.
*/ */
void onBytesTransferred( void onBytesTransferred(
DataSource source, DataSpec dataSpec, boolean isNetwork, int bytesTransferred); DataSource source, DataSpec dataSpec, boolean isNetwork, int bytesTransferred);

View File

@ -101,9 +101,9 @@ public class BaseDataSourceTest {
} }
@Override @Override
public int read(byte[] buffer, int offset, int readLength) throws IOException { public int read(byte[] buffer, int offset, int length) throws IOException {
bytesTransferred(readLength); bytesTransferred(length);
return readLength; return length;
} }
@Override @Override

View File

@ -68,8 +68,8 @@ public final class ClippedPlaybackTest {
.addListener( .addListener(
new Player.Listener() { new Player.Listener() {
@Override @Override
public void onPlaybackStateChanged(@Player.State int state) { public void onPlaybackStateChanged(@Player.State int playbackState) {
if (state == Player.STATE_ENDED) { if (playbackState == Player.STATE_ENDED) {
playbackEnded.open(); playbackEnded.open();
} }
} }
@ -122,8 +122,8 @@ public final class ClippedPlaybackTest {
.addListener( .addListener(
new Player.Listener() { new Player.Listener() {
@Override @Override
public void onPlaybackStateChanged(@Player.State int state) { public void onPlaybackStateChanged(@Player.State int playbackState) {
if (state == Player.STATE_ENDED) { if (playbackState == Player.STATE_ENDED) {
playbackEnded.open(); playbackEnded.open();
} }
} }

View File

@ -207,14 +207,14 @@ public abstract class AbstractConcatenatedTimeline extends Timeline {
} }
@Override @Override
public final Period getPeriodByUid(Object uid, Period period) { public final Period getPeriodByUid(Object periodUid, Period period) {
Object childUid = getChildTimelineUidFromConcatenatedUid(uid); Object childUid = getChildTimelineUidFromConcatenatedUid(periodUid);
Object periodUid = getChildPeriodUidFromConcatenatedUid(uid); Object childPeriodUid = getChildPeriodUidFromConcatenatedUid(periodUid);
int childIndex = getChildIndexByChildUid(childUid); int childIndex = getChildIndexByChildUid(childUid);
int firstWindowIndexInChild = getFirstWindowIndexByChildIndex(childIndex); int firstWindowIndexInChild = getFirstWindowIndexByChildIndex(childIndex);
getTimelineByChildIndex(childIndex).getPeriodByUid(periodUid, period); getTimelineByChildIndex(childIndex).getPeriodByUid(childPeriodUid, period);
period.windowIndex += firstWindowIndexInChild; period.windowIndex += firstWindowIndexInChild;
period.uid = uid; period.uid = periodUid;
return period; return period;
} }
@ -240,12 +240,12 @@ public abstract class AbstractConcatenatedTimeline extends Timeline {
return C.INDEX_UNSET; return C.INDEX_UNSET;
} }
Object childUid = getChildTimelineUidFromConcatenatedUid(uid); Object childUid = getChildTimelineUidFromConcatenatedUid(uid);
Object periodUid = getChildPeriodUidFromConcatenatedUid(uid); Object childPeriodUid = getChildPeriodUidFromConcatenatedUid(uid);
int childIndex = getChildIndexByChildUid(childUid); int childIndex = getChildIndexByChildUid(childUid);
if (childIndex == C.INDEX_UNSET) { if (childIndex == C.INDEX_UNSET) {
return C.INDEX_UNSET; return C.INDEX_UNSET;
} }
int periodIndexInChild = getTimelineByChildIndex(childIndex).getIndexOfPeriod(periodUid); int periodIndexInChild = getTimelineByChildIndex(childIndex).getIndexOfPeriod(childPeriodUid);
return periodIndexInChild == C.INDEX_UNSET return periodIndexInChild == C.INDEX_UNSET
? C.INDEX_UNSET ? C.INDEX_UNSET
: getFirstPeriodIndexByChildIndex(childIndex) + periodIndexInChild; : getFirstPeriodIndexByChildIndex(childIndex) + periodIndexInChild;

View File

@ -196,7 +196,7 @@ public abstract class BaseRenderer implements Renderer, RendererCapabilities {
// PlayerMessage.Target implementation. // PlayerMessage.Target implementation.
@Override @Override
public void handleMessage(int messageType, @Nullable Object payload) throws ExoPlaybackException { public void handleMessage(int messageType, @Nullable Object message) throws ExoPlaybackException {
// Do nothing. // Do nothing.
} }

View File

@ -179,7 +179,7 @@ public abstract class NoSampleRenderer implements Renderer, RendererCapabilities
// PlayerMessage.Target implementation. // PlayerMessage.Target implementation.
@Override @Override
public void handleMessage(int what, @Nullable Object object) throws ExoPlaybackException { public void handleMessage(int messageType, @Nullable Object message) throws ExoPlaybackException {
// Do nothing. // Do nothing.
} }

View File

@ -35,11 +35,11 @@ public final class PlayerMessage {
* Handles a message delivered to the target. * Handles a message delivered to the target.
* *
* @param messageType The message type. * @param messageType The message type.
* @param payload The message payload. * @param message The message payload.
* @throws ExoPlaybackException If an error occurred whilst handling the message. Should only be * @throws ExoPlaybackException If an error occurred whilst handling the message. Should only be
* thrown by targets that handle messages on the playback thread. * thrown by targets that handle messages on the playback thread.
*/ */
void handleMessage(int messageType, @Nullable Object payload) throws ExoPlaybackException; void handleMessage(int messageType, @Nullable Object message) throws ExoPlaybackException;
} }
/** A sender for messages. */ /** A sender for messages. */

View File

@ -1303,17 +1303,17 @@ public class SimpleExoPlayer extends BasePlayer
@Deprecated @Deprecated
@Override @Override
public void addMetadataOutput(MetadataOutput listener) { public void addMetadataOutput(MetadataOutput output) {
// Don't verify application thread. We allow calls to this method from any thread. // Don't verify application thread. We allow calls to this method from any thread.
Assertions.checkNotNull(listener); Assertions.checkNotNull(output);
metadataOutputs.add(listener); metadataOutputs.add(output);
} }
@Deprecated @Deprecated
@Override @Override
public void removeMetadataOutput(MetadataOutput listener) { public void removeMetadataOutput(MetadataOutput output) {
// Don't verify application thread. We allow calls to this method from any thread. // Don't verify application thread. We allow calls to this method from any thread.
metadataOutputs.remove(listener); metadataOutputs.remove(output);
} }
// ExoPlayer implementation // ExoPlayer implementation
@ -2497,16 +2497,16 @@ public class SimpleExoPlayer extends BasePlayer
@Nullable private CameraMotionListener internalCameraMotionListener; @Nullable private CameraMotionListener internalCameraMotionListener;
@Override @Override
public void handleMessage(int messageType, @Nullable Object payload) { public void handleMessage(int messageType, @Nullable Object message) {
switch (messageType) { switch (messageType) {
case MSG_SET_VIDEO_FRAME_METADATA_LISTENER: case MSG_SET_VIDEO_FRAME_METADATA_LISTENER:
videoFrameMetadataListener = (VideoFrameMetadataListener) payload; videoFrameMetadataListener = (VideoFrameMetadataListener) message;
break; break;
case MSG_SET_CAMERA_MOTION_LISTENER: case MSG_SET_CAMERA_MOTION_LISTENER:
cameraMotionListener = (CameraMotionListener) payload; cameraMotionListener = (CameraMotionListener) message;
break; break;
case MSG_SET_SPHERICAL_SURFACE_VIEW: case MSG_SET_SPHERICAL_SURFACE_VIEW:
SphericalGLSurfaceView surfaceView = (SphericalGLSurfaceView) payload; SphericalGLSurfaceView surfaceView = (SphericalGLSurfaceView) message;
if (surfaceView == null) { if (surfaceView == null) {
internalVideoFrameMetadataListener = null; internalVideoFrameMetadataListener = null;
internalCameraMotionListener = null; internalCameraMotionListener = null;

View File

@ -638,12 +638,12 @@ public class AnalyticsCollector
} }
@Override @Override
public final void onPlaybackStateChanged(@Player.State int state) { public final void onPlaybackStateChanged(@Player.State int playbackState) {
EventTime eventTime = generateCurrentPlayerMediaPeriodEventTime(); EventTime eventTime = generateCurrentPlayerMediaPeriodEventTime();
sendEvent( sendEvent(
eventTime, eventTime,
AnalyticsListener.EVENT_PLAYBACK_STATE_CHANGED, AnalyticsListener.EVENT_PLAYBACK_STATE_CHANGED,
listener -> listener.onPlaybackStateChanged(eventTime, state)); listener -> listener.onPlaybackStateChanged(eventTime, playbackState));
} }
@Override @Override
@ -809,12 +809,12 @@ public class AnalyticsCollector
// BandwidthMeter.EventListener implementation. // BandwidthMeter.EventListener implementation.
@Override @Override
public final void onBandwidthSample(int elapsedMs, long bytes, long bitrate) { public final void onBandwidthSample(int elapsedMs, long bytesTransferred, long bitrate) {
EventTime eventTime = generateLoadingMediaPeriodEventTime(); EventTime eventTime = generateLoadingMediaPeriodEventTime();
sendEvent( sendEvent(
eventTime, eventTime,
AnalyticsListener.EVENT_BANDWIDTH_ESTIMATE, AnalyticsListener.EVENT_BANDWIDTH_ESTIMATE,
listener -> listener.onBandwidthEstimate(eventTime, elapsedMs, bytes, bitrate)); listener -> listener.onBandwidthEstimate(eventTime, elapsedMs, bytesTransferred, bitrate));
} }
// DrmSessionEventListener implementation. // DrmSessionEventListener implementation.

View File

@ -828,10 +828,10 @@ public interface AnalyticsListener {
* Called when an audio renderer is enabled. * Called when an audio renderer is enabled.
* *
* @param eventTime The event time. * @param eventTime The event time.
* @param counters {@link DecoderCounters} that will be updated by the renderer for as long as it * @param decoderCounters {@link DecoderCounters} that will be updated by the renderer for as long
* remains enabled. * as it remains enabled.
*/ */
default void onAudioEnabled(EventTime eventTime, DecoderCounters counters) {} default void onAudioEnabled(EventTime eventTime, DecoderCounters decoderCounters) {}
/** /**
* Called when an audio renderer creates a decoder. * Called when an audio renderer creates a decoder.
@ -907,9 +907,9 @@ public interface AnalyticsListener {
* Called when an audio renderer is disabled. * Called when an audio renderer is disabled.
* *
* @param eventTime The event time. * @param eventTime The event time.
* @param counters {@link DecoderCounters} that were updated by the renderer. * @param decoderCounters {@link DecoderCounters} that were updated by the renderer.
*/ */
default void onAudioDisabled(EventTime eventTime, DecoderCounters counters) {} default void onAudioDisabled(EventTime eventTime, DecoderCounters decoderCounters) {}
/** /**
* Called when the audio session ID changes. * Called when the audio session ID changes.
@ -980,10 +980,10 @@ public interface AnalyticsListener {
* Called when a video renderer is enabled. * Called when a video renderer is enabled.
* *
* @param eventTime The event time. * @param eventTime The event time.
* @param counters {@link DecoderCounters} that will be updated by the renderer for as long as it * @param decoderCounters {@link DecoderCounters} that will be updated by the renderer for as long
* remains enabled. * as it remains enabled.
*/ */
default void onVideoEnabled(EventTime eventTime, DecoderCounters counters) {} default void onVideoEnabled(EventTime eventTime, DecoderCounters decoderCounters) {}
/** /**
* Called when a video renderer creates a decoder. * Called when a video renderer creates a decoder.
@ -1048,9 +1048,9 @@ public interface AnalyticsListener {
* Called when a video renderer is disabled. * Called when a video renderer is disabled.
* *
* @param eventTime The event time. * @param eventTime The event time.
* @param counters {@link DecoderCounters} that were updated by the renderer. * @param decoderCounters {@link DecoderCounters} that were updated by the renderer.
*/ */
default void onVideoDisabled(EventTime eventTime, DecoderCounters counters) {} default void onVideoDisabled(EventTime eventTime, DecoderCounters decoderCounters) {}
/** /**
* Called when there is an update to the video frame processing offset reported by a video * Called when there is an update to the video frame processing offset reported by a video

View File

@ -147,29 +147,33 @@ public final class PlaybackStatsListener
// PlaybackSessionManager.Listener implementation. // PlaybackSessionManager.Listener implementation.
@Override @Override
public void onSessionCreated(EventTime eventTime, String session) { public void onSessionCreated(EventTime eventTime, String sessionId) {
PlaybackStatsTracker tracker = new PlaybackStatsTracker(keepHistory, eventTime); PlaybackStatsTracker tracker = new PlaybackStatsTracker(keepHistory, eventTime);
playbackStatsTrackers.put(session, tracker); playbackStatsTrackers.put(sessionId, tracker);
sessionStartEventTimes.put(session, eventTime); sessionStartEventTimes.put(sessionId, eventTime);
} }
@Override @Override
public void onSessionActive(EventTime eventTime, String session) { public void onSessionActive(EventTime eventTime, String sessionId) {
checkNotNull(playbackStatsTrackers.get(session)).onForeground(); checkNotNull(playbackStatsTrackers.get(sessionId)).onForeground();
} }
@Override @Override
public void onAdPlaybackStarted(EventTime eventTime, String contentSession, String adSession) { public void onAdPlaybackStarted(
checkNotNull(playbackStatsTrackers.get(contentSession)).onInterruptedByAd(); EventTime eventTime, String contentSessionId, String adSessionId) {
checkNotNull(playbackStatsTrackers.get(contentSessionId)).onInterruptedByAd();
} }
@Override @Override
public void onSessionFinished(EventTime eventTime, String session, boolean automaticTransition) { public void onSessionFinished(
PlaybackStatsTracker tracker = checkNotNull(playbackStatsTrackers.remove(session)); EventTime eventTime, String sessionId, boolean automaticTransitionToNextPlayback) {
EventTime startEventTime = checkNotNull(sessionStartEventTimes.remove(session)); PlaybackStatsTracker tracker = checkNotNull(playbackStatsTrackers.remove(sessionId));
EventTime startEventTime = checkNotNull(sessionStartEventTimes.remove(sessionId));
long discontinuityFromPositionMs = long discontinuityFromPositionMs =
session.equals(discontinuityFromSession) ? this.discontinuityFromPositionMs : C.TIME_UNSET; sessionId.equals(discontinuityFromSession)
tracker.onFinished(eventTime, automaticTransition, discontinuityFromPositionMs); ? this.discontinuityFromPositionMs
: C.TIME_UNSET;
tracker.onFinished(eventTime, automaticTransitionToNextPlayback, discontinuityFromPositionMs);
PlaybackStats playbackStats = tracker.build(/* isFinal= */ true); PlaybackStats playbackStats = tracker.build(/* isFinal= */ true);
finishedPlaybackStats = PlaybackStats.merge(finishedPlaybackStats, playbackStats); finishedPlaybackStats = PlaybackStats.merge(finishedPlaybackStats, playbackStats);
if (callback != null) { if (callback != null) {
@ -182,12 +186,12 @@ public final class PlaybackStatsListener
@Override @Override
public void onPositionDiscontinuity( public void onPositionDiscontinuity(
EventTime eventTime, EventTime eventTime,
Player.PositionInfo oldPositionInfo, Player.PositionInfo oldPosition,
Player.PositionInfo newPositionInfo, Player.PositionInfo newPosition,
@Player.DiscontinuityReason int reason) { @Player.DiscontinuityReason int reason) {
if (discontinuityFromSession == null) { if (discontinuityFromSession == null) {
discontinuityFromSession = sessionManager.getActiveSessionId(); discontinuityFromSession = sessionManager.getActiveSessionId();
discontinuityFromPositionMs = oldPositionInfo.positionMs; discontinuityFromPositionMs = oldPosition.positionMs;
} }
discontinuityReason = reason; discontinuityReason = reason;
} }

View File

@ -108,9 +108,9 @@ public interface AudioProcessor {
* The caller retains ownership of the provided buffer. Calling this method invalidates any * The caller retains ownership of the provided buffer. Calling this method invalidates any
* previous buffer returned by {@link #getOutput()}. * previous buffer returned by {@link #getOutput()}.
* *
* @param buffer The input buffer to process. * @param inputBuffer The input buffer to process.
*/ */
void queueInput(ByteBuffer buffer); void queueInput(ByteBuffer inputBuffer);
/** /**
* Queues an end of stream signal. After this method has been called, {@link * Queues an end of stream signal. After this method has been called, {@link

View File

@ -292,7 +292,7 @@ public final class FrameworkMediaDrm implements ExoMediaDrm {
} }
@Override @Override
public FrameworkMediaCrypto createMediaCrypto(byte[] initData) throws MediaCryptoException { public FrameworkMediaCrypto createMediaCrypto(byte[] sessionId) throws MediaCryptoException {
// Work around a bug prior to Lollipop where L1 Widevine forced into L3 mode would still // Work around a bug prior to Lollipop where L1 Widevine forced into L3 mode would still
// indicate that it required secure video decoders [Internal ref: b/11428937]. // indicate that it required secure video decoders [Internal ref: b/11428937].
boolean forceAllowInsecureDecoderComponents = boolean forceAllowInsecureDecoderComponents =
@ -300,7 +300,7 @@ public final class FrameworkMediaDrm implements ExoMediaDrm {
&& C.WIDEVINE_UUID.equals(uuid) && C.WIDEVINE_UUID.equals(uuid)
&& "L3".equals(getPropertyString("securityLevel")); && "L3".equals(getPropertyString("securityLevel"));
return new FrameworkMediaCrypto( return new FrameworkMediaCrypto(
adjustUuid(uuid), initData, forceAllowInsecureDecoderComponents); adjustUuid(uuid), sessionId, forceAllowInsecureDecoderComponents);
} }
@Override @Override

View File

@ -21,8 +21,8 @@ public interface DownloaderFactory {
/** /**
* Creates a {@link Downloader} to perform the given {@link DownloadRequest}. * Creates a {@link Downloader} to perform the given {@link DownloadRequest}.
* *
* @param action The action. * @param request The download request.
* @return The downloader. * @return The downloader.
*/ */
Downloader createDownloader(DownloadRequest action); Downloader createDownloader(DownloadRequest request);
} }

View File

@ -79,7 +79,7 @@ import java.util.Map;
} }
@Override @Override
public int read(byte[] buffer, int offset, int readLength) throws IOException { public int read(byte[] buffer, int offset, int length) throws IOException {
if (bytesUntilMetadata == 0) { if (bytesUntilMetadata == 0) {
if (readMetadata()) { if (readMetadata()) {
bytesUntilMetadata = metadataIntervalBytes; bytesUntilMetadata = metadataIntervalBytes;
@ -87,7 +87,7 @@ import java.util.Map;
return C.RESULT_END_OF_INPUT; return C.RESULT_END_OF_INPUT;
} }
} }
int bytesRead = upstream.read(buffer, offset, min(bytesUntilMetadata, readLength)); int bytesRead = upstream.read(buffer, offset, min(bytesUntilMetadata, length));
if (bytesRead != C.RESULT_END_OF_INPUT) { if (bytesRead != C.RESULT_END_OF_INPUT) {
bytesUntilMetadata -= bytesRead; bytesUntilMetadata -= bytesRead;
} }

View File

@ -139,7 +139,7 @@ public final class MaskingMediaPeriod implements MediaPeriod, MediaPeriod.Callba
} }
@Override @Override
public void prepare(Callback callback, long preparePositionUs) { public void prepare(Callback callback, long positionUs) {
this.callback = callback; this.callback = callback;
if (mediaPeriod != null) { if (mediaPeriod != null) {
mediaPeriod.prepare( mediaPeriod.prepare(

View File

@ -581,8 +581,8 @@ public class SampleQueue implements TrackOutput {
@Override @Override
public final void sampleData( public final void sampleData(
ParsableByteArray buffer, int length, @SampleDataPart int sampleDataPart) { ParsableByteArray data, int length, @SampleDataPart int sampleDataPart) {
sampleDataQueue.sampleData(buffer, length); sampleDataQueue.sampleData(data, length);
} }
@Override @Override

View File

@ -137,9 +137,9 @@ public final class MediaParserChunkExtractor implements ChunkExtractor {
} }
@Override @Override
public boolean read(ExtractorInput extractorInput) throws IOException { public boolean read(ExtractorInput input) throws IOException {
maybeExecutePendingSeek(); maybeExecutePendingSeek();
inputReaderAdapter.setDataReader(extractorInput, extractorInput.getLength()); inputReaderAdapter.setDataReader(input, input.getLength());
return mediaParser.advance(inputReaderAdapter); return mediaParser.advance(inputReaderAdapter);
} }

View File

@ -684,8 +684,8 @@ public final class OutputConsumerAdapterV30 implements MediaParser.OutputConsume
@Nullable public MediaParser.InputReader input; @Nullable public MediaParser.InputReader input;
@Override @Override
public int read(byte[] target, int offset, int length) throws IOException { public int read(byte[] buffer, int offset, int length) throws IOException {
return Util.castNonNull(input).read(target, offset, length); return Util.castNonNull(input).read(buffer, offset, length);
} }
} }
} }

View File

@ -42,7 +42,7 @@ public abstract class SimpleSubtitleDecoder
} }
@Override @Override
public void setPositionUs(long timeUs) { public void setPositionUs(long positionUs) {
// Do nothing // Do nothing
} }

View File

@ -134,9 +134,9 @@ public interface ExoTrackSelection extends TrackSelection {
* Called to notify the selection of the current playback speed. The playback speed may affect * Called to notify the selection of the current playback speed. The playback speed may affect
* adaptive track selection. * adaptive track selection.
* *
* @param speed The factor by which playback is sped up. * @param playbackSpeed The factor by which playback is sped up.
*/ */
void onPlaybackSpeed(float speed); void onPlaybackSpeed(float playbackSpeed);
/** /**
* Called to notify the selection of a position discontinuity. * Called to notify the selection of a position discontinuity.

View File

@ -325,7 +325,7 @@ public abstract class MappingTrackSelector extends TrackSelector {
public final TrackSelectorResult selectTracks( public final TrackSelectorResult selectTracks(
RendererCapabilities[] rendererCapabilities, RendererCapabilities[] rendererCapabilities,
TrackGroupArray trackGroups, TrackGroupArray trackGroups,
MediaPeriodId mediaPeriodId, MediaPeriodId periodId,
Timeline timeline) Timeline timeline)
throws ExoPlaybackException { throws ExoPlaybackException {
// Structures into which data will be written during the selection. The extra item at the end // Structures into which data will be written during the selection. The extra item at the end
@ -404,7 +404,7 @@ public abstract class MappingTrackSelector extends TrackSelector {
mappedTrackInfo, mappedTrackInfo,
rendererFormatSupports, rendererFormatSupports,
rendererMixedMimeTypeAdaptationSupports, rendererMixedMimeTypeAdaptationSupports,
mediaPeriodId, periodId,
timeline); timeline);
return new TrackSelectorResult(result.first, result.second, mappedTrackInfo); return new TrackSelectorResult(result.first, result.second, mappedTrackInfo);
} }

View File

@ -103,8 +103,8 @@ public final class AssetDataSource extends BaseDataSource {
} }
@Override @Override
public int read(byte[] buffer, int offset, int readLength) throws AssetDataSourceException { public int read(byte[] buffer, int offset, int length) throws AssetDataSourceException {
if (readLength == 0) { if (length == 0) {
return 0; return 0;
} else if (bytesRemaining == 0) { } else if (bytesRemaining == 0) {
return C.RESULT_END_OF_INPUT; return C.RESULT_END_OF_INPUT;
@ -113,7 +113,7 @@ public final class AssetDataSource extends BaseDataSource {
int bytesRead; int bytesRead;
try { try {
int bytesToRead = int bytesToRead =
bytesRemaining == C.LENGTH_UNSET ? readLength : (int) min(bytesRemaining, readLength); bytesRemaining == C.LENGTH_UNSET ? length : (int) min(bytesRemaining, length);
bytesRead = castNonNull(inputStream).read(buffer, offset, bytesToRead); bytesRead = castNonNull(inputStream).read(buffer, offset, bytesToRead);
} catch (IOException e) { } catch (IOException e) {
throw new AssetDataSourceException(e, PlaybackException.ERROR_CODE_IO_UNSPECIFIED); throw new AssetDataSourceException(e, PlaybackException.ERROR_CODE_IO_UNSPECIFIED);

View File

@ -60,19 +60,19 @@ public final class ByteArrayDataSource extends BaseDataSource {
} }
@Override @Override
public int read(byte[] buffer, int offset, int readLength) { public int read(byte[] buffer, int offset, int length) {
if (readLength == 0) { if (length == 0) {
return 0; return 0;
} else if (bytesRemaining == 0) { } else if (bytesRemaining == 0) {
return C.RESULT_END_OF_INPUT; return C.RESULT_END_OF_INPUT;
} }
readLength = min(readLength, bytesRemaining); length = min(length, bytesRemaining);
System.arraycopy(data, readPosition, buffer, offset, readLength); System.arraycopy(data, readPosition, buffer, offset, length);
readPosition += readLength; readPosition += length;
bytesRemaining -= readLength; bytesRemaining -= length;
bytesTransferred(readLength); bytesTransferred(length);
return readLength; return length;
} }
@Override @Override

View File

@ -139,8 +139,8 @@ public final class ContentDataSource extends BaseDataSource {
} }
@Override @Override
public int read(byte[] buffer, int offset, int readLength) throws ContentDataSourceException { public int read(byte[] buffer, int offset, int length) throws ContentDataSourceException {
if (readLength == 0) { if (length == 0) {
return 0; return 0;
} else if (bytesRemaining == 0) { } else if (bytesRemaining == 0) {
return C.RESULT_END_OF_INPUT; return C.RESULT_END_OF_INPUT;
@ -149,7 +149,7 @@ public final class ContentDataSource extends BaseDataSource {
int bytesRead; int bytesRead;
try { try {
int bytesToRead = int bytesToRead =
bytesRemaining == C.LENGTH_UNSET ? readLength : (int) min(bytesRemaining, readLength); bytesRemaining == C.LENGTH_UNSET ? length : (int) min(bytesRemaining, length);
bytesRead = castNonNull(inputStream).read(buffer, offset, bytesToRead); bytesRead = castNonNull(inputStream).read(buffer, offset, bytesToRead);
} catch (IOException e) { } catch (IOException e) {
throw new ContentDataSourceException(e, PlaybackException.ERROR_CODE_IO_UNSPECIFIED); throw new ContentDataSourceException(e, PlaybackException.ERROR_CODE_IO_UNSPECIFIED);

View File

@ -82,19 +82,19 @@ public final class DataSchemeDataSource extends BaseDataSource {
} }
@Override @Override
public int read(byte[] buffer, int offset, int readLength) { public int read(byte[] buffer, int offset, int length) {
if (readLength == 0) { if (length == 0) {
return 0; return 0;
} }
if (bytesRemaining == 0) { if (bytesRemaining == 0) {
return C.RESULT_END_OF_INPUT; return C.RESULT_END_OF_INPUT;
} }
readLength = min(readLength, bytesRemaining); length = min(length, bytesRemaining);
System.arraycopy(castNonNull(data), readPosition, buffer, offset, readLength); System.arraycopy(castNonNull(data), readPosition, buffer, offset, length);
readPosition += readLength; readPosition += length;
bytesRemaining -= readLength; bytesRemaining -= length;
bytesTransferred(readLength); bytesTransferred(length);
return readLength; return length;
} }
@Override @Override

View File

@ -372,11 +372,11 @@ public final class DefaultBandwidthMeter implements BandwidthMeter, TransferList
@Override @Override
public synchronized void onBytesTransferred( public synchronized void onBytesTransferred(
DataSource source, DataSpec dataSpec, boolean isNetwork, int bytes) { DataSource source, DataSpec dataSpec, boolean isNetwork, int bytesTransferred) {
if (!isTransferAtFullNetworkSpeed(dataSpec, isNetwork)) { if (!isTransferAtFullNetworkSpeed(dataSpec, isNetwork)) {
return; return;
} }
sampleBytesTransferred += bytes; sampleBytesTransferred += bytesTransferred;
} }
@Override @Override

View File

@ -202,8 +202,8 @@ public final class DefaultDataSource implements DataSource {
} }
@Override @Override
public int read(byte[] buffer, int offset, int readLength) throws IOException { public int read(byte[] buffer, int offset, int length) throws IOException {
return Assertions.checkNotNull(dataSource).read(buffer, offset, readLength); return Assertions.checkNotNull(dataSource).read(buffer, offset, length);
} }
@Override @Override

View File

@ -40,7 +40,7 @@ public final class DummyDataSource implements DataSource {
} }
@Override @Override
public int read(byte[] buffer, int offset, int readLength) { public int read(byte[] buffer, int offset, int length) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }

View File

@ -128,15 +128,15 @@ public final class FileDataSource extends BaseDataSource {
} }
@Override @Override
public int read(byte[] buffer, int offset, int readLength) throws FileDataSourceException { public int read(byte[] buffer, int offset, int length) throws FileDataSourceException {
if (readLength == 0) { if (length == 0) {
return 0; return 0;
} else if (bytesRemaining == 0) { } else if (bytesRemaining == 0) {
return C.RESULT_END_OF_INPUT; return C.RESULT_END_OF_INPUT;
} else { } else {
int bytesRead; int bytesRead;
try { try {
bytesRead = castNonNull(file).read(buffer, offset, (int) min(bytesRemaining, readLength)); bytesRead = castNonNull(file).read(buffer, offset, (int) min(bytesRemaining, length));
} catch (IOException e) { } catch (IOException e) {
throw new FileDataSourceException(e, PlaybackException.ERROR_CODE_IO_UNSPECIFIED); throw new FileDataSourceException(e, PlaybackException.ERROR_CODE_IO_UNSPECIFIED);
} }

View File

@ -67,9 +67,9 @@ public final class PriorityDataSource implements DataSource {
} }
@Override @Override
public int read(byte[] buffer, int offset, int max) throws IOException { public int read(byte[] buffer, int offset, int length) throws IOException {
priorityTaskManager.proceedOrThrow(priority); priorityTaskManager.proceedOrThrow(priority);
return upstream.read(buffer, offset, max); return upstream.read(buffer, offset, length);
} }
@Override @Override

View File

@ -232,8 +232,8 @@ public final class RawResourceDataSource extends BaseDataSource {
} }
@Override @Override
public int read(byte[] buffer, int offset, int readLength) throws RawResourceDataSourceException { public int read(byte[] buffer, int offset, int length) throws RawResourceDataSourceException {
if (readLength == 0) { if (length == 0) {
return 0; return 0;
} else if (bytesRemaining == 0) { } else if (bytesRemaining == 0) {
return C.RESULT_END_OF_INPUT; return C.RESULT_END_OF_INPUT;
@ -242,7 +242,7 @@ public final class RawResourceDataSource extends BaseDataSource {
int bytesRead; int bytesRead;
try { try {
int bytesToRead = int bytesToRead =
bytesRemaining == C.LENGTH_UNSET ? readLength : (int) min(bytesRemaining, readLength); bytesRemaining == C.LENGTH_UNSET ? length : (int) min(bytesRemaining, length);
bytesRead = castNonNull(inputStream).read(buffer, offset, bytesToRead); bytesRead = castNonNull(inputStream).read(buffer, offset, bytesToRead);
} catch (IOException e) { } catch (IOException e) {
throw new RawResourceDataSourceException(e, PlaybackException.ERROR_CODE_IO_UNSPECIFIED); throw new RawResourceDataSourceException(e, PlaybackException.ERROR_CODE_IO_UNSPECIFIED);

View File

@ -109,8 +109,8 @@ public final class ResolvingDataSource implements DataSource {
} }
@Override @Override
public int read(byte[] buffer, int offset, int readLength) throws IOException { public int read(byte[] buffer, int offset, int length) throws IOException {
return upstreamDataSource.read(buffer, offset, readLength); return upstreamDataSource.read(buffer, offset, length);
} }
@Override @Override

View File

@ -88,8 +88,8 @@ public final class StatsDataSource implements DataSource {
} }
@Override @Override
public int read(byte[] buffer, int offset, int readLength) throws IOException { public int read(byte[] buffer, int offset, int length) throws IOException {
int bytesRead = dataSource.read(buffer, offset, readLength); int bytesRead = dataSource.read(buffer, offset, length);
if (bytesRead != C.RESULT_END_OF_INPUT) { if (bytesRead != C.RESULT_END_OF_INPUT) {
this.bytesRead += bytesRead; this.bytesRead += bytesRead;
} }

View File

@ -63,11 +63,11 @@ public final class TeeDataSource implements DataSource {
} }
@Override @Override
public int read(byte[] buffer, int offset, int max) throws IOException { public int read(byte[] buffer, int offset, int length) throws IOException {
if (bytesRemaining == 0) { if (bytesRemaining == 0) {
return C.RESULT_END_OF_INPUT; return C.RESULT_END_OF_INPUT;
} }
int bytesRead = upstream.read(buffer, offset, max); int bytesRead = upstream.read(buffer, offset, length);
if (bytesRead > 0) { if (bytesRead > 0) {
// TODO: Consider continuing even if writes to the sink fail. // TODO: Consider continuing even if writes to the sink fail.
dataSink.write(buffer, offset, bytesRead); dataSink.write(buffer, offset, bytesRead);

View File

@ -130,8 +130,8 @@ public final class UdpDataSource extends BaseDataSource {
} }
@Override @Override
public int read(byte[] buffer, int offset, int readLength) throws UdpDataSourceException { public int read(byte[] buffer, int offset, int length) throws UdpDataSourceException {
if (readLength == 0) { if (length == 0) {
return 0; return 0;
} }
@ -147,7 +147,7 @@ public final class UdpDataSource extends BaseDataSource {
} }
int packetOffset = packet.getLength() - packetRemaining; int packetOffset = packet.getLength() - packetRemaining;
int bytesToRead = min(packetRemaining, readLength); int bytesToRead = min(packetRemaining, length);
System.arraycopy(packetBuffer, packetOffset, buffer, offset, bytesToRead); System.arraycopy(packetBuffer, packetOffset, buffer, offset, bytesToRead);
packetRemaining -= bytesToRead; packetRemaining -= bytesToRead;
return bytesToRead; return bytesToRead;

View File

@ -596,10 +596,10 @@ public final class CacheDataSource implements DataSource {
} }
@Override @Override
public int read(byte[] buffer, int offset, int readLength) throws IOException { public int read(byte[] buffer, int offset, int length) throws IOException {
DataSpec requestDataSpec = checkNotNull(this.requestDataSpec); DataSpec requestDataSpec = checkNotNull(this.requestDataSpec);
DataSpec currentDataSpec = checkNotNull(this.currentDataSpec); DataSpec currentDataSpec = checkNotNull(this.currentDataSpec);
if (readLength == 0) { if (length == 0) {
return 0; return 0;
} }
if (bytesRemaining == 0) { if (bytesRemaining == 0) {
@ -609,7 +609,7 @@ public final class CacheDataSource implements DataSource {
if (readPosition >= checkCachePosition) { if (readPosition >= checkCachePosition) {
openNextSource(requestDataSpec, true); openNextSource(requestDataSpec, true);
} }
int bytesRead = checkNotNull(currentDataSource).read(buffer, offset, readLength); int bytesRead = checkNotNull(currentDataSource).read(buffer, offset, length);
if (bytesRead != C.RESULT_END_OF_INPUT) { if (bytesRead != C.RESULT_END_OF_INPUT) {
if (isReadingFromCache()) { if (isReadingFromCache()) {
totalCachedBytesRead += bytesRead; totalCachedBytesRead += bytesRead;
@ -629,7 +629,7 @@ public final class CacheDataSource implements DataSource {
} else if (bytesRemaining > 0 || bytesRemaining == C.LENGTH_UNSET) { } else if (bytesRemaining > 0 || bytesRemaining == C.LENGTH_UNSET) {
closeCurrentSource(); closeCurrentSource();
openNextSource(requestDataSpec, false); openNextSource(requestDataSpec, false);
return read(buffer, offset, readLength); return read(buffer, offset, length);
} }
return bytesRead; return bytesRead;
} catch (Throwable e) { } catch (Throwable e) {

View File

@ -65,8 +65,8 @@ public final class DefaultContentMetadata implements ContentMetadata {
@Override @Override
@Nullable @Nullable
public final byte[] get(String name, @Nullable byte[] defaultValue) { public final byte[] get(String key, @Nullable byte[] defaultValue) {
@Nullable byte[] bytes = metadata.get(name); @Nullable byte[] bytes = metadata.get(key);
if (bytes != null) { if (bytes != null) {
return Arrays.copyOf(bytes, bytes.length); return Arrays.copyOf(bytes, bytes.length);
} else { } else {
@ -76,8 +76,8 @@ public final class DefaultContentMetadata implements ContentMetadata {
@Override @Override
@Nullable @Nullable
public final String get(String name, @Nullable String defaultValue) { public final String get(String key, @Nullable String defaultValue) {
@Nullable byte[] bytes = metadata.get(name); @Nullable byte[] bytes = metadata.get(key);
if (bytes != null) { if (bytes != null) {
return new String(bytes, Charsets.UTF_8); return new String(bytes, Charsets.UTF_8);
} else { } else {
@ -86,8 +86,8 @@ public final class DefaultContentMetadata implements ContentMetadata {
} }
@Override @Override
public final long get(String name, long defaultValue) { public final long get(String key, long defaultValue) {
@Nullable byte[] bytes = metadata.get(name); @Nullable byte[] bytes = metadata.get(key);
if (bytes != null) { if (bytes != null) {
return ByteBuffer.wrap(bytes).getLong(); return ByteBuffer.wrap(bytes).getLong();
} else { } else {
@ -96,8 +96,8 @@ public final class DefaultContentMetadata implements ContentMetadata {
} }
@Override @Override
public final boolean contains(String name) { public final boolean contains(String key) {
return metadata.containsKey(name); return metadata.containsKey(key);
} }
@Override @Override

View File

@ -34,7 +34,7 @@ public final class NoOpCacheEvictor implements CacheEvictor {
} }
@Override @Override
public void onStartFile(Cache cache, String key, long position, long maxLength) { public void onStartFile(Cache cache, String key, long position, long length) {
// Do nothing. // Do nothing.
} }

View File

@ -59,15 +59,15 @@ public final class AesCipherDataSource implements DataSource {
} }
@Override @Override
public int read(byte[] data, int offset, int readLength) throws IOException { public int read(byte[] buffer, int offset, int length) throws IOException {
if (readLength == 0) { if (length == 0) {
return 0; return 0;
} }
int read = upstream.read(data, offset, readLength); int read = upstream.read(buffer, offset, length);
if (read == C.RESULT_END_OF_INPUT) { if (read == C.RESULT_END_OF_INPUT) {
return C.RESULT_END_OF_INPUT; return C.RESULT_END_OF_INPUT;
} }
castNonNull(cipher).updateInPlace(data, offset, read); castNonNull(cipher).updateInPlace(buffer, offset, read);
return read; return read;
} }

View File

@ -84,7 +84,7 @@ public class DebugTextViewHelper implements Player.Listener, Runnable {
@Override @Override
public final void onPlayWhenReadyChanged( public final void onPlayWhenReadyChanged(
boolean playWhenReady, @Player.PlayWhenReadyChangeReason int playbackState) { boolean playWhenReady, @Player.PlayWhenReadyChangeReason int reason) {
updateAndPost(); updateAndPost();
} }

View File

@ -243,13 +243,13 @@ public class EventLogger implements AnalyticsListener {
} }
@Override @Override
public void onPlayerError(EventTime eventTime, PlaybackException e) { public void onPlayerError(EventTime eventTime, PlaybackException error) {
loge(eventTime, "playerFailed", e); loge(eventTime, "playerFailed", error);
} }
@Override @Override
public void onTracksChanged( public void onTracksChanged(
EventTime eventTime, TrackGroupArray ignored, TrackSelectionArray trackSelections) { EventTime eventTime, TrackGroupArray trackGroups, TrackSelectionArray trackSelections) {
MappedTrackInfo mappedTrackInfo = MappedTrackInfo mappedTrackInfo =
trackSelector != null ? trackSelector.getCurrentMappedTrackInfo() : null; trackSelector != null ? trackSelector.getCurrentMappedTrackInfo() : null;
if (mappedTrackInfo == null) { if (mappedTrackInfo == null) {
@ -341,7 +341,7 @@ public class EventLogger implements AnalyticsListener {
} }
@Override @Override
public void onAudioEnabled(EventTime eventTime, DecoderCounters counters) { public void onAudioEnabled(EventTime eventTime, DecoderCounters decoderCounters) {
logd(eventTime, "audioEnabled"); logd(eventTime, "audioEnabled");
} }
@ -373,7 +373,7 @@ public class EventLogger implements AnalyticsListener {
} }
@Override @Override
public void onAudioDisabled(EventTime eventTime, DecoderCounters counters) { public void onAudioDisabled(EventTime eventTime, DecoderCounters decoderCounters) {
logd(eventTime, "audioDisabled"); logd(eventTime, "audioDisabled");
} }
@ -407,7 +407,7 @@ public class EventLogger implements AnalyticsListener {
} }
@Override @Override
public void onVideoEnabled(EventTime eventTime, DecoderCounters counters) { public void onVideoEnabled(EventTime eventTime, DecoderCounters decoderCounters) {
logd(eventTime, "videoEnabled"); logd(eventTime, "videoEnabled");
} }
@ -424,8 +424,8 @@ public class EventLogger implements AnalyticsListener {
} }
@Override @Override
public void onDroppedVideoFrames(EventTime eventTime, int count, long elapsedMs) { public void onDroppedVideoFrames(EventTime eventTime, int droppedFrames, long elapsedMs) {
logd(eventTime, "droppedFrames", Integer.toString(count)); logd(eventTime, "droppedFrames", Integer.toString(droppedFrames));
} }
@Override @Override
@ -434,7 +434,7 @@ public class EventLogger implements AnalyticsListener {
} }
@Override @Override
public void onVideoDisabled(EventTime eventTime, DecoderCounters counters) { public void onVideoDisabled(EventTime eventTime, DecoderCounters decoderCounters) {
logd(eventTime, "videoDisabled"); logd(eventTime, "videoDisabled");
} }
@ -503,8 +503,8 @@ public class EventLogger implements AnalyticsListener {
} }
@Override @Override
public void onDrmSessionManagerError(EventTime eventTime, Exception e) { public void onDrmSessionManagerError(EventTime eventTime, Exception error) {
printInternalError(eventTime, "drmSessionManagerError", e); printInternalError(eventTime, "drmSessionManagerError", error);
} }
@Override @Override

View File

@ -2570,9 +2570,10 @@ public final class ExoPlayerTest {
Renderer videoRenderer = Renderer videoRenderer =
new FakeRenderer(C.TRACK_TYPE_VIDEO) { new FakeRenderer(C.TRACK_TYPE_VIDEO) {
@Override @Override
public void handleMessage(int what, @Nullable Object object) throws ExoPlaybackException { public void handleMessage(int messageType, @Nullable Object message)
super.handleMessage(what, object); throws ExoPlaybackException {
rendererMessages.add(what); super.handleMessage(messageType, message);
rendererMessages.add(messageType);
} }
}; };
ActionSchedule actionSchedule = addSurfaceSwitch(new ActionSchedule.Builder(TAG)).build(); ActionSchedule actionSchedule = addSurfaceSwitch(new ActionSchedule.Builder(TAG)).build();
@ -3019,8 +3020,8 @@ public final class ExoPlayerTest {
final Player.Listener playerListener = final Player.Listener playerListener =
new Player.Listener() { new Player.Listener() {
@Override @Override
public void onPlaybackStateChanged(int state) { public void onPlaybackStateChanged(int playbackState) {
if (state == Player.STATE_IDLE) { if (playbackState == Player.STATE_IDLE) {
playerReference.get().setMediaSource(secondMediaSource); playerReference.get().setMediaSource(secondMediaSource);
} }
} }
@ -10925,12 +10926,13 @@ public final class ExoPlayerTest {
} }
@Override @Override
public void handleMessage(int what, @Nullable Object object) throws ExoPlaybackException { public void handleMessage(int messageType, @Nullable Object message)
if (what == MSG_SET_WAKEUP_LISTENER) { throws ExoPlaybackException {
assertThat(object).isNotNull(); if (messageType == MSG_SET_WAKEUP_LISTENER) {
wakeupListenerReceiver.set((WakeupListener) object); assertThat(message).isNotNull();
wakeupListenerReceiver.set((WakeupListener) message);
} }
super.handleMessage(what, object); super.handleMessage(messageType, message);
} }
@Override @Override
@ -10947,7 +10949,7 @@ public final class ExoPlayerTest {
public int messageCount; public int messageCount;
@Override @Override
public void handleMessage(int x, @Nullable Object message) { public void handleMessage(int messageType, @Nullable Object message) {
messageCount++; messageCount++;
} }
} }

View File

@ -2244,7 +2244,7 @@ public final class AnalyticsCollectorTest {
} }
@Override @Override
public void onAudioEnabled(EventTime eventTime, DecoderCounters counters) { public void onAudioEnabled(EventTime eventTime, DecoderCounters decoderCounters) {
reportedEvents.add(new ReportedEvent(EVENT_AUDIO_ENABLED, eventTime)); reportedEvents.add(new ReportedEvent(EVENT_AUDIO_ENABLED, eventTime));
} }
@ -2263,7 +2263,7 @@ public final class AnalyticsCollectorTest {
} }
@Override @Override
public void onAudioDisabled(EventTime eventTime, DecoderCounters counters) { public void onAudioDisabled(EventTime eventTime, DecoderCounters decoderCounters) {
reportedEvents.add(new ReportedEvent(EVENT_AUDIO_DISABLED, eventTime)); reportedEvents.add(new ReportedEvent(EVENT_AUDIO_DISABLED, eventTime));
} }
@ -2284,7 +2284,7 @@ public final class AnalyticsCollectorTest {
} }
@Override @Override
public void onVideoEnabled(EventTime eventTime, DecoderCounters counters) { public void onVideoEnabled(EventTime eventTime, DecoderCounters decoderCounters) {
reportedEvents.add(new ReportedEvent(EVENT_VIDEO_ENABLED, eventTime)); reportedEvents.add(new ReportedEvent(EVENT_VIDEO_ENABLED, eventTime));
} }
@ -2308,7 +2308,7 @@ public final class AnalyticsCollectorTest {
} }
@Override @Override
public void onVideoDisabled(EventTime eventTime, DecoderCounters counters) { public void onVideoDisabled(EventTime eventTime, DecoderCounters decoderCounters) {
reportedEvents.add(new ReportedEvent(EVENT_VIDEO_DISABLED, eventTime)); reportedEvents.add(new ReportedEvent(EVENT_VIDEO_DISABLED, eventTime));
} }

View File

@ -564,12 +564,11 @@ public final class DashMediaSource extends BaseMediaSource {
} }
@Override @Override
public MediaPeriod createPeriod( public MediaPeriod createPeriod(MediaPeriodId id, Allocator allocator, long startPositionUs) {
MediaPeriodId periodId, Allocator allocator, long startPositionUs) { int periodIndex = (Integer) id.periodUid - firstPeriodId;
int periodIndex = (Integer) periodId.periodUid - firstPeriodId;
MediaSourceEventListener.EventDispatcher periodEventDispatcher = MediaSourceEventListener.EventDispatcher periodEventDispatcher =
createEventDispatcher(periodId, manifest.getPeriod(periodIndex).startMs); createEventDispatcher(id, manifest.getPeriod(periodIndex).startMs);
DrmSessionEventListener.EventDispatcher drmEventDispatcher = createDrmEventDispatcher(periodId); DrmSessionEventListener.EventDispatcher drmEventDispatcher = createDrmEventDispatcher(id);
DashMediaPeriod mediaPeriod = DashMediaPeriod mediaPeriod =
new DashMediaPeriod( new DashMediaPeriod(
firstPeriodId + periodIndex, firstPeriodId + periodIndex,

View File

@ -290,8 +290,8 @@ public final class PlayerEmsgHandler implements Handler.Callback {
@Override @Override
public void sampleMetadata( public void sampleMetadata(
long timeUs, int flags, int size, int offset, @Nullable CryptoData encryptionData) { long timeUs, int flags, int size, int offset, @Nullable CryptoData cryptoData) {
sampleQueue.sampleMetadata(timeUs, flags, size, offset, encryptionData); sampleQueue.sampleMetadata(timeUs, flags, size, offset, cryptoData);
parseAndDiscardSamples(); parseAndDiscardSamples();
} }

View File

@ -302,8 +302,8 @@ public abstract class Representation {
// DashSegmentIndex implementation. // DashSegmentIndex implementation.
@Override @Override
public RangedUri getSegmentUrl(long segmentIndex) { public RangedUri getSegmentUrl(long segmentNum) {
return segmentBase.getSegmentUrl(this, segmentIndex); return segmentBase.getSegmentUrl(this, segmentNum);
} }
@Override @Override
@ -312,13 +312,13 @@ public abstract class Representation {
} }
@Override @Override
public long getTimeUs(long segmentIndex) { public long getTimeUs(long segmentNum) {
return segmentBase.getSegmentTimeUs(segmentIndex); return segmentBase.getSegmentTimeUs(segmentNum);
} }
@Override @Override
public long getDurationUs(long segmentIndex, long periodDurationUs) { public long getDurationUs(long segmentNum, long periodDurationUs) {
return segmentBase.getSegmentDurationUs(segmentIndex, periodDurationUs); return segmentBase.getSegmentDurationUs(segmentNum, periodDurationUs);
} }
@Override @Override

View File

@ -56,12 +56,12 @@ public final class DefaultExtractorInput implements ExtractorInput {
} }
@Override @Override
public int read(byte[] target, int offset, int length) throws IOException { public int read(byte[] buffer, int offset, int length) throws IOException {
int bytesRead = readFromPeekBuffer(target, offset, length); int bytesRead = readFromPeekBuffer(buffer, offset, length);
if (bytesRead == 0) { if (bytesRead == 0) {
bytesRead = bytesRead =
readFromUpstream( readFromUpstream(
target, offset, length, /* bytesAlreadyRead= */ 0, /* allowEndOfInput= */ true); buffer, offset, length, /* bytesAlreadyRead= */ 0, /* allowEndOfInput= */ true);
} }
commitBytesRead(bytesRead); commitBytesRead(bytesRead);
return bytesRead; return bytesRead;

View File

@ -72,14 +72,14 @@ public interface ExtractorInput extends DataReader {
* <p>This method blocks until at least one byte of data can be read, the end of the input is * <p>This method blocks until at least one byte of data can be read, the end of the input is
* detected, or an exception is thrown. * detected, or an exception is thrown.
* *
* @param target A target array into which data should be written. * @param buffer A target array into which data should be written.
* @param offset The offset into the target array at which to write. * @param offset The offset into the target array at which to write.
* @param length The maximum number of bytes to read from the input. * @param length The maximum number of bytes to read from the input.
* @return The number of bytes read, or {@link C#RESULT_END_OF_INPUT} if the input has ended. * @return The number of bytes read, or {@link C#RESULT_END_OF_INPUT} if the input has ended.
* @throws IOException If an error occurs reading from the input. * @throws IOException If an error occurs reading from the input.
*/ */
@Override @Override
int read(byte[] target, int offset, int length) throws IOException; int read(byte[] buffer, int offset, int length) throws IOException;
/** /**
* Like {@link #read(byte[], int, int)}, but reads the requested {@code length} in full. * Like {@link #read(byte[], int, int)}, but reads the requested {@code length} in full.

View File

@ -27,8 +27,8 @@ public class ForwardingExtractorInput implements ExtractorInput {
} }
@Override @Override
public int read(byte[] target, int offset, int length) throws IOException { public int read(byte[] buffer, int offset, int length) throws IOException {
return input.read(target, offset, length); return input.read(buffer, offset, length);
} }
@Override @Override

View File

@ -198,12 +198,8 @@ public interface TrackOutput {
* @param offset The number of bytes that have been passed to {@link #sampleData(DataReader, int, * @param offset The number of bytes that have been passed to {@link #sampleData(DataReader, int,
* boolean)} or {@link #sampleData(ParsableByteArray, int)} since the last byte belonging to * boolean)} or {@link #sampleData(ParsableByteArray, int)} since the last byte belonging to
* the sample whose metadata is being passed. * the sample whose metadata is being passed.
* @param encryptionData The encryption data required to decrypt the sample. May be null. * @param cryptoData The encryption data required to decrypt the sample. May be null.
*/ */
void sampleMetadata( void sampleMetadata(
long timeUs, long timeUs, @C.BufferFlags int flags, int size, int offset, @Nullable CryptoData cryptoData);
@C.BufferFlags int flags,
int size,
int offset,
@Nullable CryptoData encryptionData);
} }

View File

@ -165,10 +165,10 @@ public final class AmrExtractor implements Extractor {
} }
@Override @Override
public void init(ExtractorOutput extractorOutput) { public void init(ExtractorOutput output) {
this.extractorOutput = extractorOutput; this.extractorOutput = output;
trackOutput = extractorOutput.track(/* id= */ 0, C.TRACK_TYPE_AUDIO); trackOutput = output.track(/* id= */ 0, C.TRACK_TYPE_AUDIO);
extractorOutput.endTracks(); output.endTracks();
} }
@Override @Override

View File

@ -96,10 +96,10 @@ public final class Ac3Reader implements ElementaryStreamReader {
} }
@Override @Override
public void createTracks(ExtractorOutput extractorOutput, TrackIdGenerator generator) { public void createTracks(ExtractorOutput extractorOutput, TrackIdGenerator idGenerator) {
generator.generateNewId(); idGenerator.generateNewId();
formatId = generator.getFormatId(); formatId = idGenerator.getFormatId();
output = extractorOutput.track(generator.getTrackId(), C.TRACK_TYPE_AUDIO); output = extractorOutput.track(idGenerator.getTrackId(), C.TRACK_TYPE_AUDIO);
} }
@Override @Override

View File

@ -99,10 +99,10 @@ public final class Ac4Reader implements ElementaryStreamReader {
} }
@Override @Override
public void createTracks(ExtractorOutput extractorOutput, TrackIdGenerator generator) { public void createTracks(ExtractorOutput extractorOutput, TrackIdGenerator idGenerator) {
generator.generateNewId(); idGenerator.generateNewId();
formatId = generator.getFormatId(); formatId = idGenerator.getFormatId();
output = extractorOutput.track(generator.getTrackId(), C.TRACK_TYPE_AUDIO); output = extractorOutput.track(idGenerator.getTrackId(), C.TRACK_TYPE_AUDIO);
} }
@Override @Override

View File

@ -96,9 +96,9 @@ import javax.crypto.spec.SecretKeySpec;
} }
@Override @Override
public final int read(byte[] buffer, int offset, int readLength) throws IOException { public final int read(byte[] buffer, int offset, int length) throws IOException {
Assertions.checkNotNull(cipherInputStream); Assertions.checkNotNull(cipherInputStream);
int bytesRead = cipherInputStream.read(buffer, offset, readLength); int bytesRead = cipherInputStream.read(buffer, offset, length);
if (bytesRead < 0) { if (bytesRead < 0) {
return C.RESULT_END_OF_INPUT; return C.RESULT_END_OF_INPUT;
} }

View File

@ -94,7 +94,7 @@ public final class DefaultHlsExtractorFactory implements HlsExtractorFactory {
@Nullable List<Format> muxedCaptionFormats, @Nullable List<Format> muxedCaptionFormats,
TimestampAdjuster timestampAdjuster, TimestampAdjuster timestampAdjuster,
Map<String, List<String>> responseHeaders, Map<String, List<String>> responseHeaders,
ExtractorInput extractorInput) ExtractorInput sniffingExtractorInput)
throws IOException { throws IOException {
@FileTypes.Type @FileTypes.Type
int formatInferredFileType = FileTypes.inferFileTypeFromMimeType(format.sampleMimeType); int formatInferredFileType = FileTypes.inferFileTypeFromMimeType(format.sampleMimeType);
@ -115,13 +115,13 @@ public final class DefaultHlsExtractorFactory implements HlsExtractorFactory {
// Extractor to be used if the type is not recognized. // Extractor to be used if the type is not recognized.
@Nullable Extractor fallBackExtractor = null; @Nullable Extractor fallBackExtractor = null;
extractorInput.resetPeekPosition(); sniffingExtractorInput.resetPeekPosition();
for (int i = 0; i < fileTypeOrder.size(); i++) { for (int i = 0; i < fileTypeOrder.size(); i++) {
int fileType = fileTypeOrder.get(i); int fileType = fileTypeOrder.get(i);
Extractor extractor = Extractor extractor =
checkNotNull( checkNotNull(
createExtractorByFileType(fileType, format, muxedCaptionFormats, timestampAdjuster)); createExtractorByFileType(fileType, format, muxedCaptionFormats, timestampAdjuster));
if (sniffQuietly(extractor, extractorInput)) { if (sniffQuietly(extractor, sniffingExtractorInput)) {
return new BundledHlsMediaChunkExtractor(extractor, format, timestampAdjuster); return new BundledHlsMediaChunkExtractor(extractor, format, timestampAdjuster);
} }
if (fallBackExtractor == null if (fallBackExtractor == null

View File

@ -502,24 +502,25 @@ public final class HlsMediaSource extends BaseMediaSource
} }
@Override @Override
public void onPrimaryPlaylistRefreshed(HlsMediaPlaylist playlist) { public void onPrimaryPlaylistRefreshed(HlsMediaPlaylist mediaPlaylist) {
long windowStartTimeMs = long windowStartTimeMs =
playlist.hasProgramDateTime ? C.usToMs(playlist.startTimeUs) : C.TIME_UNSET; mediaPlaylist.hasProgramDateTime ? C.usToMs(mediaPlaylist.startTimeUs) : C.TIME_UNSET;
// For playlist types EVENT and VOD we know segments are never removed, so the presentation // For playlist types EVENT and VOD we know segments are never removed, so the presentation
// started at the same time as the window. Otherwise, we don't know the presentation start time. // started at the same time as the window. Otherwise, we don't know the presentation start time.
long presentationStartTimeMs = long presentationStartTimeMs =
playlist.playlistType == HlsMediaPlaylist.PLAYLIST_TYPE_EVENT mediaPlaylist.playlistType == HlsMediaPlaylist.PLAYLIST_TYPE_EVENT
|| playlist.playlistType == HlsMediaPlaylist.PLAYLIST_TYPE_VOD || mediaPlaylist.playlistType == HlsMediaPlaylist.PLAYLIST_TYPE_VOD
? windowStartTimeMs ? windowStartTimeMs
: C.TIME_UNSET; : C.TIME_UNSET;
// The master playlist is non-null because the first playlist has been fetched by now. // The master playlist is non-null because the first playlist has been fetched by now.
HlsManifest manifest = HlsManifest manifest =
new HlsManifest(checkNotNull(playlistTracker.getMasterPlaylist()), playlist); new HlsManifest(checkNotNull(playlistTracker.getMasterPlaylist()), mediaPlaylist);
SinglePeriodTimeline timeline = SinglePeriodTimeline timeline =
playlistTracker.isLive() playlistTracker.isLive()
? createTimelineForLive(playlist, presentationStartTimeMs, windowStartTimeMs, manifest) ? createTimelineForLive(
mediaPlaylist, presentationStartTimeMs, windowStartTimeMs, manifest)
: createTimelineForOnDemand( : createTimelineForOnDemand(
playlist, presentationStartTimeMs, windowStartTimeMs, manifest); mediaPlaylist, presentationStartTimeMs, windowStartTimeMs, manifest);
refreshSourceInfo(timeline); refreshSourceInfo(timeline);
} }

View File

@ -1781,10 +1781,9 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
} }
@Override @Override
public void sampleData( public void sampleData(ParsableByteArray data, int length, @SampleDataPart int sampleDataPart) {
ParsableByteArray buffer, int length, @SampleDataPart int sampleDataPart) {
ensureBufferCapacity(bufferPosition + length); ensureBufferCapacity(bufferPosition + length);
buffer.readBytes(this.buffer, bufferPosition, length); data.readBytes(this.buffer, bufferPosition, length);
bufferPosition += length; bufferPosition += length;
} }

View File

@ -123,10 +123,12 @@ public interface HlsPlaylistTracker {
* @param initialPlaylistUri Uri of the HLS stream. Can point to a media playlist or a master * @param initialPlaylistUri Uri of the HLS stream. Can point to a media playlist or a master
* playlist. * playlist.
* @param eventDispatcher A dispatcher to notify of events. * @param eventDispatcher A dispatcher to notify of events.
* @param listener A callback for the primary playlist change events. * @param primaryPlaylistListener A callback for the primary playlist change events.
*/ */
void start( void start(
Uri initialPlaylistUri, EventDispatcher eventDispatcher, PrimaryPlaylistListener listener); Uri initialPlaylistUri,
EventDispatcher eventDispatcher,
PrimaryPlaylistListener primaryPlaylistListener);
/** /**
* Stops the playlist tracker and releases any acquired resources. * Stops the playlist tracker and releases any acquired resources.

View File

@ -109,7 +109,7 @@ public class Aes128DataSourceTest {
} }
@Override @Override
public int read(byte[] buffer, int offset, int readLength) { public int read(byte[] buffer, int offset, int length) {
return C.RESULT_END_OF_INPUT; return C.RESULT_END_OF_INPUT;
} }

View File

@ -88,14 +88,14 @@ import java.util.concurrent.LinkedBlockingQueue;
} }
@Override @Override
public int read(byte[] target, int offset, int length) { public int read(byte[] buffer, int offset, int length) {
if (length == 0) { if (length == 0) {
return 0; return 0;
} }
int bytesRead = 0; int bytesRead = 0;
int bytesToRead = min(length, unreadData.length); int bytesToRead = min(length, unreadData.length);
System.arraycopy(unreadData, /* srcPos= */ 0, target, offset, bytesToRead); System.arraycopy(unreadData, /* srcPos= */ 0, buffer, offset, bytesToRead);
bytesRead += bytesToRead; bytesRead += bytesToRead;
unreadData = Arrays.copyOfRange(unreadData, bytesToRead, unreadData.length); unreadData = Arrays.copyOfRange(unreadData, bytesToRead, unreadData.length);
@ -115,7 +115,7 @@ import java.util.concurrent.LinkedBlockingQueue;
} }
bytesToRead = min(length - bytesRead, data.length); bytesToRead = min(length - bytesRead, data.length);
System.arraycopy(data, /* srcPos= */ 0, target, offset + bytesRead, bytesToRead); System.arraycopy(data, /* srcPos= */ 0, buffer, offset + bytesRead, bytesToRead);
if (bytesToRead < data.length) { if (bytesToRead < data.length) {
unreadData = Arrays.copyOfRange(data, bytesToRead, data.length); unreadData = Arrays.copyOfRange(data, bytesToRead, data.length);
} }

View File

@ -94,9 +94,9 @@ import java.io.IOException;
} }
@Override @Override
public int read(byte[] target, int offset, int length) throws IOException { public int read(byte[] buffer, int offset, int length) throws IOException {
try { try {
return dataSource.read(target, offset, length); return dataSource.read(buffer, offset, length);
} catch (UdpDataSource.UdpDataSourceException e) { } catch (UdpDataSource.UdpDataSourceException e) {
if (e.reason == PlaybackException.ERROR_CODE_IO_NETWORK_CONNECTION_TIMEOUT) { if (e.reason == PlaybackException.ERROR_CODE_IO_NETWORK_CONNECTION_TIMEOUT) {
return C.RESULT_END_OF_INPUT; return C.RESULT_END_OF_INPUT;

View File

@ -86,7 +86,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
@Override @Override
public void consume( public void consume(
ParsableByteArray data, long timestamp, int sequenceNumber, boolean isFrameBoundary) { ParsableByteArray data, long timestamp, int sequenceNumber, boolean rtpMarker) {
/* /*
AAC as RTP payload (RFC3640): AAC as RTP payload (RFC3640):
+---------+-----------+-----------+---------------+ +---------+-----------+-----------+---------------+
@ -120,7 +120,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
// Outputs all the received data, whether fragmented or not. // Outputs all the received data, whether fragmented or not.
trackOutput.sampleData(data, data.bytesLeft()); trackOutput.sampleData(data, data.bytesLeft());
if (isFrameBoundary) { if (rtpMarker) {
outputSampleMetadata(trackOutput, sampleTimeUs, auSize); outputSampleMetadata(trackOutput, sampleTimeUs, auSize);
} }
} else { } else {

View File

@ -73,7 +73,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
@Override @Override
public void consume( public void consume(
ParsableByteArray data, long timestamp, int sequenceNumber, boolean isFrameBoundary) { ParsableByteArray data, long timestamp, int sequenceNumber, boolean rtpMarker) {
/* /*
AC-3 payload as an RTP payload (RFC4184). AC-3 payload as an RTP payload (RFC4184).
+-+-+-+-+-+-+-+-+-+-+-+-+-+- .. +-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+- .. +-+-+-+-+-+-+-+
@ -115,7 +115,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
// Falls through. // Falls through.
case AC3_FRAME_TYPE_NON_INITIAL_FRAGMENT: case AC3_FRAME_TYPE_NON_INITIAL_FRAGMENT:
// The content of an AC3 frame is split into multiple RTP packets. // The content of an AC3 frame is split into multiple RTP packets.
processFragmentedPacket(data, isFrameBoundary, frameType, sampleTimeUs); processFragmentedPacket(data, rtpMarker, frameType, sampleTimeUs);
break; break;
default: default:

View File

@ -86,8 +86,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
public void onReceivingFirstPacket(long timestamp, int sequenceNumber) {} public void onReceivingFirstPacket(long timestamp, int sequenceNumber) {}
@Override @Override
public void consume( public void consume(ParsableByteArray data, long timestamp, int sequenceNumber, boolean rtpMarker)
ParsableByteArray data, long timestamp, int sequenceNumber, boolean isAuBoundary)
throws ParserException { throws ParserException {
int rtpH264PacketMode; int rtpH264PacketMode;
@ -111,7 +110,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
/* cause= */ null); /* cause= */ null);
} }
if (isAuBoundary) { if (rtpMarker) {
if (firstReceivedTimestamp == C.TIME_UNSET) { if (firstReceivedTimestamp == C.TIME_UNSET) {
firstReceivedTimestamp = timestamp; firstReceivedTimestamp = timestamp;
} }

View File

@ -285,7 +285,7 @@ public final class RtspPlaybackTest {
public void close() {} public void close() {}
@Override @Override
public int read(byte[] target, int offset, int length) { public int read(byte[] buffer, int offset, int length) {
if (length == 0) { if (length == 0) {
return 0; return 0;
} }
@ -301,7 +301,7 @@ public final class RtspPlaybackTest {
} }
int byteToRead = min(length, data.length); int byteToRead = min(length, data.length);
System.arraycopy(data, /* srcPos= */ 0, target, offset, byteToRead); System.arraycopy(data, /* srcPos= */ 0, buffer, offset, byteToRead);
return byteToRead; return byteToRead;
} }
} }

View File

@ -62,7 +62,7 @@ public class DefaultSsChunkSource implements SsChunkSource {
public SsChunkSource createChunkSource( public SsChunkSource createChunkSource(
LoaderErrorThrower manifestLoaderErrorThrower, LoaderErrorThrower manifestLoaderErrorThrower,
SsManifest manifest, SsManifest manifest,
int elementIndex, int streamElementIndex,
ExoTrackSelection trackSelection, ExoTrackSelection trackSelection,
@Nullable TransferListener transferListener) { @Nullable TransferListener transferListener) {
DataSource dataSource = dataSourceFactory.createDataSource(); DataSource dataSource = dataSourceFactory.createDataSource();
@ -70,7 +70,7 @@ public class DefaultSsChunkSource implements SsChunkSource {
dataSource.addTransferListener(transferListener); dataSource.addTransferListener(transferListener);
} }
return new DefaultSsChunkSource( return new DefaultSsChunkSource(
manifestLoaderErrorThrower, manifest, elementIndex, trackSelection, dataSource); manifestLoaderErrorThrower, manifest, streamElementIndex, trackSelection, dataSource);
} }
} }

View File

@ -1507,7 +1507,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
} }
@Override @Override
public void onTracksChanged(TrackGroupArray tracks, TrackSelectionArray selections) { public void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray selections) {
// Suppress the update if transitioning to an unprepared period within the same window. This // Suppress the update if transitioning to an unprepared period within the same window. This
// is necessary to avoid closing the shutter when such a transition occurs. See: // is necessary to avoid closing the shutter when such a transition occurs. See:
// https://github.com/google/ExoPlayer/issues/5507. // https://github.com/google/ExoPlayer/issues/5507.

View File

@ -1548,7 +1548,7 @@ public class StyledPlayerView extends FrameLayout implements AdViewProvider {
} }
@Override @Override
public void onTracksChanged(TrackGroupArray tracks, TrackSelectionArray selections) { public void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray selections) {
// Suppress the update if transitioning to an unprepared period within the same window. This // Suppress the update if transitioning to an unprepared period within the same window. This
// is necessary to avoid closing the shutter when such a transition occurs. See: // is necessary to avoid closing the shutter when such a transition occurs. See:
// https://github.com/google/ExoPlayer/issues/5507. // https://github.com/google/ExoPlayer/issues/5507.

View File

@ -148,7 +148,7 @@ public class FakeDataSource extends BaseDataSource {
} }
@Override @Override
public final int read(byte[] buffer, int offset, int readLength) throws IOException { public final int read(byte[] buffer, int offset, int length) throws IOException {
Assertions.checkState(sourceOpened); Assertions.checkState(sourceOpened);
while (true) { while (true) {
FakeData fakeData = Util.castNonNull(this.fakeData); FakeData fakeData = Util.castNonNull(this.fakeData);
@ -168,22 +168,22 @@ public class FakeDataSource extends BaseDataSource {
Util.castNonNull(current.action).run(); Util.castNonNull(current.action).run();
} else { } else {
// Read at most bytesRemaining. // Read at most bytesRemaining.
readLength = (int) min(readLength, bytesRemaining); length = (int) min(length, bytesRemaining);
// Do not allow crossing of the segment boundary. // Do not allow crossing of the segment boundary.
readLength = min(readLength, current.length - current.bytesRead); length = min(length, current.length - current.bytesRead);
// Perform the read and return. // Perform the read and return.
Assertions.checkArgument(buffer.length - offset >= readLength); Assertions.checkArgument(buffer.length - offset >= length);
if (current.data != null) { if (current.data != null) {
System.arraycopy(current.data, current.bytesRead, buffer, offset, readLength); System.arraycopy(current.data, current.bytesRead, buffer, offset, length);
} }
onDataRead(readLength); onDataRead(length);
bytesTransferred(readLength); bytesTransferred(length);
bytesRemaining -= readLength; bytesRemaining -= length;
current.bytesRead += readLength; current.bytesRead += length;
if (current.bytesRead == current.length) { if (current.bytesRead == current.length) {
currentSegmentIndex++; currentSegmentIndex++;
} }
return readLength; return length;
} }
} }
} }

View File

@ -107,10 +107,10 @@ public final class FakeExtractorInput implements ExtractorInput {
} }
@Override @Override
public int read(byte[] target, int offset, int length) throws IOException { public int read(byte[] buffer, int offset, int length) throws IOException {
checkIOException(readPosition, failedReadPositions); checkIOException(readPosition, failedReadPositions);
length = getLengthToRead(readPosition, length, partiallySatisfiedTargetReadPositions); length = getLengthToRead(readPosition, length, partiallySatisfiedTargetReadPositions);
return readFullyInternal(target, offset, length, true) ? length : C.RESULT_END_OF_INPUT; return readFullyInternal(buffer, offset, length, true) ? length : C.RESULT_END_OF_INPUT;
} }
@Override @Override

View File

@ -125,7 +125,7 @@ public final class FakeTrackSelection implements ExoTrackSelection {
} }
@Override @Override
public void onPlaybackSpeed(float speed) { public void onPlaybackSpeed(float playbackSpeed) {
// Do nothing. // Do nothing.
} }
@ -152,7 +152,7 @@ public final class FakeTrackSelection implements ExoTrackSelection {
} }
@Override @Override
public boolean isBlacklisted(int index, long exclusionDurationMs) { public boolean isBlacklisted(int index, long nowMs) {
assertThat(isEnabled).isTrue(); assertThat(isEnabled).isTrue();
return false; return false;
} }

View File

@ -95,14 +95,14 @@ public class FakeVideoRenderer extends FakeRenderer {
} }
@Override @Override
public void handleMessage(int messageType, @Nullable Object payload) throws ExoPlaybackException { public void handleMessage(int messageType, @Nullable Object message) throws ExoPlaybackException {
switch (messageType) { switch (messageType) {
case MSG_SET_VIDEO_OUTPUT: case MSG_SET_VIDEO_OUTPUT:
output = payload; output = message;
renderedFirstFrameAfterReset = false; renderedFirstFrameAfterReset = false;
break; break;
default: default:
super.handleMessage(messageType, payload); super.handleMessage(messageType, message);
} }
} }