mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
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:
parent
41fe5aa1e3
commit
9c27cfcda7
@ -423,8 +423,8 @@ public class PlayerActivity extends AppCompatActivity
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerError(@NonNull PlaybackException e) {
|
||||
if (e.errorCode == PlaybackException.ERROR_CODE_BEHIND_LIVE_WINDOW) {
|
||||
public void onPlayerError(@NonNull PlaybackException error) {
|
||||
if (error.errorCode == PlaybackException.ERROR_CODE_BEHIND_LIVE_WINDOW) {
|
||||
player.seekToDefaultPosition();
|
||||
player.prepare();
|
||||
} else {
|
||||
|
@ -142,8 +142,8 @@ the demo app exemplifies this approach.
|
||||
|
||||
~~~
|
||||
@Override
|
||||
public void onPlayerError(PlaybackException e) {
|
||||
if (e.errorCode == PlaybackException.ERROR_CODE_BEHIND_LIVE_WINDOW) {
|
||||
public void onPlayerError(PlaybackException error) {
|
||||
if (eror.errorCode == PlaybackException.ERROR_CODE_BEHIND_LIVE_WINDOW) {
|
||||
// Re-initialize player at the current live window default position.
|
||||
player.seekToDefaultPosition();
|
||||
player.prepare();
|
||||
|
@ -43,29 +43,29 @@ public final class DefaultMediaItemConverter implements MediaItemConverter {
|
||||
private static final String KEY_REQUEST_HEADERS = "requestHeaders";
|
||||
|
||||
@Override
|
||||
public MediaItem toMediaItem(MediaQueueItem item) {
|
||||
public MediaItem toMediaItem(MediaQueueItem mediaQueueItem) {
|
||||
// `item` came from `toMediaQueueItem()` so the custom JSON data must be set.
|
||||
MediaInfo mediaInfo = item.getMedia();
|
||||
MediaInfo mediaInfo = mediaQueueItem.getMedia();
|
||||
Assertions.checkNotNull(mediaInfo);
|
||||
return getMediaItem(Assertions.checkNotNull(mediaInfo.getCustomData()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public MediaQueueItem toMediaQueueItem(MediaItem item) {
|
||||
Assertions.checkNotNull(item.playbackProperties);
|
||||
if (item.playbackProperties.mimeType == null) {
|
||||
public MediaQueueItem toMediaQueueItem(MediaItem mediaItem) {
|
||||
Assertions.checkNotNull(mediaItem.playbackProperties);
|
||||
if (mediaItem.playbackProperties.mimeType == null) {
|
||||
throw new IllegalArgumentException("The item must specify its mimeType");
|
||||
}
|
||||
MediaMetadata metadata = new MediaMetadata(MediaMetadata.MEDIA_TYPE_MOVIE);
|
||||
if (item.mediaMetadata.title != null) {
|
||||
metadata.putString(MediaMetadata.KEY_TITLE, item.mediaMetadata.title.toString());
|
||||
if (mediaItem.mediaMetadata.title != null) {
|
||||
metadata.putString(MediaMetadata.KEY_TITLE, mediaItem.mediaMetadata.title.toString());
|
||||
}
|
||||
MediaInfo mediaInfo =
|
||||
new MediaInfo.Builder(item.playbackProperties.uri.toString())
|
||||
new MediaInfo.Builder(mediaItem.playbackProperties.uri.toString())
|
||||
.setStreamType(MediaInfo.STREAM_TYPE_BUFFERED)
|
||||
.setContentType(item.playbackProperties.mimeType)
|
||||
.setContentType(mediaItem.playbackProperties.mimeType)
|
||||
.setMetadata(metadata)
|
||||
.setCustomData(getCustomData(item))
|
||||
.setCustomData(getCustomData(mediaItem))
|
||||
.build();
|
||||
return new MediaQueueItem.Builder(mediaInfo).build();
|
||||
}
|
||||
|
@ -767,10 +767,10 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource {
|
||||
}
|
||||
|
||||
@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);
|
||||
|
||||
if (readLength == 0) {
|
||||
if (length == 0) {
|
||||
return 0;
|
||||
} else if (bytesRemaining == 0) {
|
||||
return C.RESULT_END_OF_INPUT;
|
||||
@ -801,7 +801,7 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource {
|
||||
Longs.min(
|
||||
bytesRemaining != C.LENGTH_UNSET ? bytesRemaining : Long.MAX_VALUE,
|
||||
readBuffer.remaining(),
|
||||
readLength);
|
||||
length);
|
||||
|
||||
readBuffer.get(buffer, offset, bytesRead);
|
||||
|
||||
|
@ -127,11 +127,12 @@ public class GvrAudioProcessor implements AudioProcessor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void queueInput(ByteBuffer input) {
|
||||
int position = input.position();
|
||||
public void queueInput(ByteBuffer inputBuffer) {
|
||||
int position = inputBuffer.position();
|
||||
Assertions.checkNotNull(gvrAudioSurround);
|
||||
int readBytes = gvrAudioSurround.addInput(input, position, input.limit() - position);
|
||||
input.position(position + readBytes);
|
||||
int readBytes =
|
||||
gvrAudioSurround.addInput(inputBuffer, position, inputBuffer.limit() - position);
|
||||
inputBuffer.position(position + readBytes);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -258,20 +258,20 @@ public final class LeanbackPlayerAdapter extends PlayerAdapter implements Runnab
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerError(PlaybackException exception) {
|
||||
public void onPlayerError(PlaybackException error) {
|
||||
Callback callback = getCallback();
|
||||
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);
|
||||
} else {
|
||||
callback.onError(
|
||||
LeanbackPlayerAdapter.this,
|
||||
exception.errorCode,
|
||||
error.errorCode,
|
||||
// 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
|
||||
// extra.
|
||||
context.getString(
|
||||
R.string.lb_media_player_error, /* formatArgs...= */ exception.errorCode, 0));
|
||||
R.string.lb_media_player_error, /* formatArgs...= */ error.errorCode, 0));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -165,8 +165,8 @@ import org.junit.rules.ExternalResource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] target, int offset, int length) throws IOException {
|
||||
return wrappedDataSource.read(target, offset, length);
|
||||
public int read(byte[] buffer, int offset, int length) throws IOException {
|
||||
return wrappedDataSource.read(buffer, offset, length);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -594,7 +594,7 @@ import java.util.List;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlaybackStateChanged(@Player.State int state) {
|
||||
public void onPlaybackStateChanged(@Player.State int playbackState) {
|
||||
handlePlayerStateChanged();
|
||||
}
|
||||
|
||||
|
@ -97,14 +97,14 @@ public final class SessionCallbackBuilder {
|
||||
* @param session The media session.
|
||||
* @param controllerInfo The {@link ControllerInfo} for the controller for which allowed
|
||||
* 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.
|
||||
* @see MediaSession.SessionCallback#onConnect(MediaSession, ControllerInfo)
|
||||
*/
|
||||
SessionCommandGroup getAllowedCommands(
|
||||
MediaSession session,
|
||||
ControllerInfo controllerInfo,
|
||||
SessionCommandGroup baseAllowedSessionCommand);
|
||||
SessionCommandGroup baseAllowedSessionCommands);
|
||||
|
||||
/**
|
||||
* Called when a {@link MediaController} has called an API that controls {@link SessionPlayer}
|
||||
|
@ -374,9 +374,9 @@ public class OkHttpDataSource extends BaseDataSource implements HttpDataSource {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] buffer, int offset, int readLength) throws HttpDataSourceException {
|
||||
public int read(byte[] buffer, int offset, int length) throws HttpDataSourceException {
|
||||
try {
|
||||
return readInternal(buffer, offset, readLength);
|
||||
return readInternal(buffer, offset, length);
|
||||
} catch (IOException e) {
|
||||
throw new HttpDataSourceException(
|
||||
e,
|
||||
|
@ -85,8 +85,8 @@ public final class RtmpDataSource extends BaseDataSource {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] buffer, int offset, int readLength) throws IOException {
|
||||
int bytesRead = castNonNull(rtmpClient).read(buffer, offset, readLength);
|
||||
public int read(byte[] buffer, int offset, int length) throws IOException {
|
||||
int bytesRead = castNonNull(rtmpClient).read(buffer, offset, length);
|
||||
if (bytesRead == -1) {
|
||||
return C.RESULT_END_OF_INPUT;
|
||||
}
|
||||
|
@ -680,8 +680,8 @@ public class ForwardingPlayer implements Player {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlaybackStateChanged(@State int state) {
|
||||
eventListener.onPlaybackStateChanged(state);
|
||||
public void onPlaybackStateChanged(@State int playbackState) {
|
||||
eventListener.onPlaybackStateChanged(playbackState);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -192,9 +192,9 @@ public interface Player {
|
||||
* <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.
|
||||
*
|
||||
* @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.
|
||||
@ -899,7 +899,7 @@ public interface Player {
|
||||
default void onAvailableCommandsChanged(Commands availableCommands) {}
|
||||
|
||||
@Override
|
||||
default void onPlaybackStateChanged(@State int state) {}
|
||||
default void onPlaybackStateChanged(@State int playbackState) {}
|
||||
|
||||
@Override
|
||||
default void onPlayWhenReadyChanged(
|
||||
|
@ -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
|
||||
* 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 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
|
||||
@ -36,5 +36,5 @@ public interface DataReader {
|
||||
* reached, the method was interrupted, or the operation was aborted early for another reason.
|
||||
* @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;
|
||||
}
|
||||
|
@ -475,9 +475,9 @@ public class DefaultHttpDataSource extends BaseDataSource implements HttpDataSou
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] buffer, int offset, int readLength) throws HttpDataSourceException {
|
||||
public int read(byte[] buffer, int offset, int length) throws HttpDataSourceException {
|
||||
try {
|
||||
return readInternal(buffer, offset, readLength);
|
||||
return readInternal(buffer, offset, length);
|
||||
} catch (IOException e) {
|
||||
throw new HttpDataSourceException(
|
||||
e,
|
||||
|
@ -454,7 +454,7 @@ public interface HttpDataSource extends DataSource {
|
||||
void close() throws HttpDataSourceException;
|
||||
|
||||
@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
|
||||
|
@ -61,7 +61,7 @@ public interface TransferListener {
|
||||
* @param source The source performing the transfer.
|
||||
* @param dataSpec Describes the data being transferred.
|
||||
* @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(
|
||||
DataSource source, DataSpec dataSpec, boolean isNetwork, int bytesTransferred);
|
||||
|
@ -101,9 +101,9 @@ public class BaseDataSourceTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] buffer, int offset, int readLength) throws IOException {
|
||||
bytesTransferred(readLength);
|
||||
return readLength;
|
||||
public int read(byte[] buffer, int offset, int length) throws IOException {
|
||||
bytesTransferred(length);
|
||||
return length;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -68,8 +68,8 @@ public final class ClippedPlaybackTest {
|
||||
.addListener(
|
||||
new Player.Listener() {
|
||||
@Override
|
||||
public void onPlaybackStateChanged(@Player.State int state) {
|
||||
if (state == Player.STATE_ENDED) {
|
||||
public void onPlaybackStateChanged(@Player.State int playbackState) {
|
||||
if (playbackState == Player.STATE_ENDED) {
|
||||
playbackEnded.open();
|
||||
}
|
||||
}
|
||||
@ -122,8 +122,8 @@ public final class ClippedPlaybackTest {
|
||||
.addListener(
|
||||
new Player.Listener() {
|
||||
@Override
|
||||
public void onPlaybackStateChanged(@Player.State int state) {
|
||||
if (state == Player.STATE_ENDED) {
|
||||
public void onPlaybackStateChanged(@Player.State int playbackState) {
|
||||
if (playbackState == Player.STATE_ENDED) {
|
||||
playbackEnded.open();
|
||||
}
|
||||
}
|
||||
|
@ -207,14 +207,14 @@ public abstract class AbstractConcatenatedTimeline extends Timeline {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Period getPeriodByUid(Object uid, Period period) {
|
||||
Object childUid = getChildTimelineUidFromConcatenatedUid(uid);
|
||||
Object periodUid = getChildPeriodUidFromConcatenatedUid(uid);
|
||||
public final Period getPeriodByUid(Object periodUid, Period period) {
|
||||
Object childUid = getChildTimelineUidFromConcatenatedUid(periodUid);
|
||||
Object childPeriodUid = getChildPeriodUidFromConcatenatedUid(periodUid);
|
||||
int childIndex = getChildIndexByChildUid(childUid);
|
||||
int firstWindowIndexInChild = getFirstWindowIndexByChildIndex(childIndex);
|
||||
getTimelineByChildIndex(childIndex).getPeriodByUid(periodUid, period);
|
||||
getTimelineByChildIndex(childIndex).getPeriodByUid(childPeriodUid, period);
|
||||
period.windowIndex += firstWindowIndexInChild;
|
||||
period.uid = uid;
|
||||
period.uid = periodUid;
|
||||
return period;
|
||||
}
|
||||
|
||||
@ -240,12 +240,12 @@ public abstract class AbstractConcatenatedTimeline extends Timeline {
|
||||
return C.INDEX_UNSET;
|
||||
}
|
||||
Object childUid = getChildTimelineUidFromConcatenatedUid(uid);
|
||||
Object periodUid = getChildPeriodUidFromConcatenatedUid(uid);
|
||||
Object childPeriodUid = getChildPeriodUidFromConcatenatedUid(uid);
|
||||
int childIndex = getChildIndexByChildUid(childUid);
|
||||
if (childIndex == C.INDEX_UNSET) {
|
||||
return C.INDEX_UNSET;
|
||||
}
|
||||
int periodIndexInChild = getTimelineByChildIndex(childIndex).getIndexOfPeriod(periodUid);
|
||||
int periodIndexInChild = getTimelineByChildIndex(childIndex).getIndexOfPeriod(childPeriodUid);
|
||||
return periodIndexInChild == C.INDEX_UNSET
|
||||
? C.INDEX_UNSET
|
||||
: getFirstPeriodIndexByChildIndex(childIndex) + periodIndexInChild;
|
||||
|
@ -196,7 +196,7 @@ public abstract class BaseRenderer implements Renderer, RendererCapabilities {
|
||||
// PlayerMessage.Target implementation.
|
||||
|
||||
@Override
|
||||
public void handleMessage(int messageType, @Nullable Object payload) throws ExoPlaybackException {
|
||||
public void handleMessage(int messageType, @Nullable Object message) throws ExoPlaybackException {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
|
@ -179,7 +179,7 @@ public abstract class NoSampleRenderer implements Renderer, RendererCapabilities
|
||||
// PlayerMessage.Target implementation.
|
||||
|
||||
@Override
|
||||
public void handleMessage(int what, @Nullable Object object) throws ExoPlaybackException {
|
||||
public void handleMessage(int messageType, @Nullable Object message) throws ExoPlaybackException {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
|
@ -35,11 +35,11 @@ public final class PlayerMessage {
|
||||
* Handles a message delivered to the target.
|
||||
*
|
||||
* @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
|
||||
* 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. */
|
||||
|
@ -1303,17 +1303,17 @@ public class SimpleExoPlayer extends BasePlayer
|
||||
|
||||
@Deprecated
|
||||
@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.
|
||||
Assertions.checkNotNull(listener);
|
||||
metadataOutputs.add(listener);
|
||||
Assertions.checkNotNull(output);
|
||||
metadataOutputs.add(output);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@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.
|
||||
metadataOutputs.remove(listener);
|
||||
metadataOutputs.remove(output);
|
||||
}
|
||||
|
||||
// ExoPlayer implementation
|
||||
@ -2497,16 +2497,16 @@ public class SimpleExoPlayer extends BasePlayer
|
||||
@Nullable private CameraMotionListener internalCameraMotionListener;
|
||||
|
||||
@Override
|
||||
public void handleMessage(int messageType, @Nullable Object payload) {
|
||||
public void handleMessage(int messageType, @Nullable Object message) {
|
||||
switch (messageType) {
|
||||
case MSG_SET_VIDEO_FRAME_METADATA_LISTENER:
|
||||
videoFrameMetadataListener = (VideoFrameMetadataListener) payload;
|
||||
videoFrameMetadataListener = (VideoFrameMetadataListener) message;
|
||||
break;
|
||||
case MSG_SET_CAMERA_MOTION_LISTENER:
|
||||
cameraMotionListener = (CameraMotionListener) payload;
|
||||
cameraMotionListener = (CameraMotionListener) message;
|
||||
break;
|
||||
case MSG_SET_SPHERICAL_SURFACE_VIEW:
|
||||
SphericalGLSurfaceView surfaceView = (SphericalGLSurfaceView) payload;
|
||||
SphericalGLSurfaceView surfaceView = (SphericalGLSurfaceView) message;
|
||||
if (surfaceView == null) {
|
||||
internalVideoFrameMetadataListener = null;
|
||||
internalCameraMotionListener = null;
|
||||
|
@ -638,12 +638,12 @@ public class AnalyticsCollector
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onPlaybackStateChanged(@Player.State int state) {
|
||||
public final void onPlaybackStateChanged(@Player.State int playbackState) {
|
||||
EventTime eventTime = generateCurrentPlayerMediaPeriodEventTime();
|
||||
sendEvent(
|
||||
eventTime,
|
||||
AnalyticsListener.EVENT_PLAYBACK_STATE_CHANGED,
|
||||
listener -> listener.onPlaybackStateChanged(eventTime, state));
|
||||
listener -> listener.onPlaybackStateChanged(eventTime, playbackState));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -809,12 +809,12 @@ public class AnalyticsCollector
|
||||
// BandwidthMeter.EventListener implementation.
|
||||
|
||||
@Override
|
||||
public final void onBandwidthSample(int elapsedMs, long bytes, long bitrate) {
|
||||
public final void onBandwidthSample(int elapsedMs, long bytesTransferred, long bitrate) {
|
||||
EventTime eventTime = generateLoadingMediaPeriodEventTime();
|
||||
sendEvent(
|
||||
eventTime,
|
||||
AnalyticsListener.EVENT_BANDWIDTH_ESTIMATE,
|
||||
listener -> listener.onBandwidthEstimate(eventTime, elapsedMs, bytes, bitrate));
|
||||
listener -> listener.onBandwidthEstimate(eventTime, elapsedMs, bytesTransferred, bitrate));
|
||||
}
|
||||
|
||||
// DrmSessionEventListener implementation.
|
||||
|
@ -828,10 +828,10 @@ public interface AnalyticsListener {
|
||||
* Called when an audio renderer is enabled.
|
||||
*
|
||||
* @param eventTime The event time.
|
||||
* @param counters {@link DecoderCounters} that will be updated by the renderer for as long as it
|
||||
* remains enabled.
|
||||
* @param decoderCounters {@link DecoderCounters} that will be updated by the renderer for as long
|
||||
* 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.
|
||||
@ -907,9 +907,9 @@ public interface AnalyticsListener {
|
||||
* Called when an audio renderer is disabled.
|
||||
*
|
||||
* @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.
|
||||
@ -980,10 +980,10 @@ public interface AnalyticsListener {
|
||||
* Called when a video renderer is enabled.
|
||||
*
|
||||
* @param eventTime The event time.
|
||||
* @param counters {@link DecoderCounters} that will be updated by the renderer for as long as it
|
||||
* remains enabled.
|
||||
* @param decoderCounters {@link DecoderCounters} that will be updated by the renderer for as long
|
||||
* 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.
|
||||
@ -1048,9 +1048,9 @@ public interface AnalyticsListener {
|
||||
* Called when a video renderer is disabled.
|
||||
*
|
||||
* @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
|
||||
|
@ -147,29 +147,33 @@ public final class PlaybackStatsListener
|
||||
// PlaybackSessionManager.Listener implementation.
|
||||
|
||||
@Override
|
||||
public void onSessionCreated(EventTime eventTime, String session) {
|
||||
public void onSessionCreated(EventTime eventTime, String sessionId) {
|
||||
PlaybackStatsTracker tracker = new PlaybackStatsTracker(keepHistory, eventTime);
|
||||
playbackStatsTrackers.put(session, tracker);
|
||||
sessionStartEventTimes.put(session, eventTime);
|
||||
playbackStatsTrackers.put(sessionId, tracker);
|
||||
sessionStartEventTimes.put(sessionId, eventTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSessionActive(EventTime eventTime, String session) {
|
||||
checkNotNull(playbackStatsTrackers.get(session)).onForeground();
|
||||
public void onSessionActive(EventTime eventTime, String sessionId) {
|
||||
checkNotNull(playbackStatsTrackers.get(sessionId)).onForeground();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdPlaybackStarted(EventTime eventTime, String contentSession, String adSession) {
|
||||
checkNotNull(playbackStatsTrackers.get(contentSession)).onInterruptedByAd();
|
||||
public void onAdPlaybackStarted(
|
||||
EventTime eventTime, String contentSessionId, String adSessionId) {
|
||||
checkNotNull(playbackStatsTrackers.get(contentSessionId)).onInterruptedByAd();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSessionFinished(EventTime eventTime, String session, boolean automaticTransition) {
|
||||
PlaybackStatsTracker tracker = checkNotNull(playbackStatsTrackers.remove(session));
|
||||
EventTime startEventTime = checkNotNull(sessionStartEventTimes.remove(session));
|
||||
public void onSessionFinished(
|
||||
EventTime eventTime, String sessionId, boolean automaticTransitionToNextPlayback) {
|
||||
PlaybackStatsTracker tracker = checkNotNull(playbackStatsTrackers.remove(sessionId));
|
||||
EventTime startEventTime = checkNotNull(sessionStartEventTimes.remove(sessionId));
|
||||
long discontinuityFromPositionMs =
|
||||
session.equals(discontinuityFromSession) ? this.discontinuityFromPositionMs : C.TIME_UNSET;
|
||||
tracker.onFinished(eventTime, automaticTransition, discontinuityFromPositionMs);
|
||||
sessionId.equals(discontinuityFromSession)
|
||||
? this.discontinuityFromPositionMs
|
||||
: C.TIME_UNSET;
|
||||
tracker.onFinished(eventTime, automaticTransitionToNextPlayback, discontinuityFromPositionMs);
|
||||
PlaybackStats playbackStats = tracker.build(/* isFinal= */ true);
|
||||
finishedPlaybackStats = PlaybackStats.merge(finishedPlaybackStats, playbackStats);
|
||||
if (callback != null) {
|
||||
@ -182,12 +186,12 @@ public final class PlaybackStatsListener
|
||||
@Override
|
||||
public void onPositionDiscontinuity(
|
||||
EventTime eventTime,
|
||||
Player.PositionInfo oldPositionInfo,
|
||||
Player.PositionInfo newPositionInfo,
|
||||
Player.PositionInfo oldPosition,
|
||||
Player.PositionInfo newPosition,
|
||||
@Player.DiscontinuityReason int reason) {
|
||||
if (discontinuityFromSession == null) {
|
||||
discontinuityFromSession = sessionManager.getActiveSessionId();
|
||||
discontinuityFromPositionMs = oldPositionInfo.positionMs;
|
||||
discontinuityFromPositionMs = oldPosition.positionMs;
|
||||
}
|
||||
discontinuityReason = reason;
|
||||
}
|
||||
|
@ -108,9 +108,9 @@ public interface AudioProcessor {
|
||||
* The caller retains ownership of the provided buffer. Calling this method invalidates any
|
||||
* 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
|
||||
|
@ -292,7 +292,7 @@ public final class FrameworkMediaDrm implements ExoMediaDrm {
|
||||
}
|
||||
|
||||
@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
|
||||
// indicate that it required secure video decoders [Internal ref: b/11428937].
|
||||
boolean forceAllowInsecureDecoderComponents =
|
||||
@ -300,7 +300,7 @@ public final class FrameworkMediaDrm implements ExoMediaDrm {
|
||||
&& C.WIDEVINE_UUID.equals(uuid)
|
||||
&& "L3".equals(getPropertyString("securityLevel"));
|
||||
return new FrameworkMediaCrypto(
|
||||
adjustUuid(uuid), initData, forceAllowInsecureDecoderComponents);
|
||||
adjustUuid(uuid), sessionId, forceAllowInsecureDecoderComponents);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -21,8 +21,8 @@ public interface DownloaderFactory {
|
||||
/**
|
||||
* Creates a {@link Downloader} to perform the given {@link DownloadRequest}.
|
||||
*
|
||||
* @param action The action.
|
||||
* @param request The download request.
|
||||
* @return The downloader.
|
||||
*/
|
||||
Downloader createDownloader(DownloadRequest action);
|
||||
Downloader createDownloader(DownloadRequest request);
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ import java.util.Map;
|
||||
}
|
||||
|
||||
@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 (readMetadata()) {
|
||||
bytesUntilMetadata = metadataIntervalBytes;
|
||||
@ -87,7 +87,7 @@ import java.util.Map;
|
||||
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) {
|
||||
bytesUntilMetadata -= bytesRead;
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ public final class MaskingMediaPeriod implements MediaPeriod, MediaPeriod.Callba
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prepare(Callback callback, long preparePositionUs) {
|
||||
public void prepare(Callback callback, long positionUs) {
|
||||
this.callback = callback;
|
||||
if (mediaPeriod != null) {
|
||||
mediaPeriod.prepare(
|
||||
|
@ -581,8 +581,8 @@ public class SampleQueue implements TrackOutput {
|
||||
|
||||
@Override
|
||||
public final void sampleData(
|
||||
ParsableByteArray buffer, int length, @SampleDataPart int sampleDataPart) {
|
||||
sampleDataQueue.sampleData(buffer, length);
|
||||
ParsableByteArray data, int length, @SampleDataPart int sampleDataPart) {
|
||||
sampleDataQueue.sampleData(data, length);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -137,9 +137,9 @@ public final class MediaParserChunkExtractor implements ChunkExtractor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean read(ExtractorInput extractorInput) throws IOException {
|
||||
public boolean read(ExtractorInput input) throws IOException {
|
||||
maybeExecutePendingSeek();
|
||||
inputReaderAdapter.setDataReader(extractorInput, extractorInput.getLength());
|
||||
inputReaderAdapter.setDataReader(input, input.getLength());
|
||||
return mediaParser.advance(inputReaderAdapter);
|
||||
}
|
||||
|
||||
|
@ -684,8 +684,8 @@ public final class OutputConsumerAdapterV30 implements MediaParser.OutputConsume
|
||||
@Nullable public MediaParser.InputReader input;
|
||||
|
||||
@Override
|
||||
public int read(byte[] target, int offset, int length) throws IOException {
|
||||
return Util.castNonNull(input).read(target, offset, length);
|
||||
public int read(byte[] buffer, int offset, int length) throws IOException {
|
||||
return Util.castNonNull(input).read(buffer, offset, length);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ public abstract class SimpleSubtitleDecoder
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPositionUs(long timeUs) {
|
||||
public void setPositionUs(long positionUs) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
@ -134,9 +134,9 @@ public interface ExoTrackSelection extends TrackSelection {
|
||||
* Called to notify the selection of the current playback speed. The playback speed may affect
|
||||
* 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.
|
||||
|
@ -325,7 +325,7 @@ public abstract class MappingTrackSelector extends TrackSelector {
|
||||
public final TrackSelectorResult selectTracks(
|
||||
RendererCapabilities[] rendererCapabilities,
|
||||
TrackGroupArray trackGroups,
|
||||
MediaPeriodId mediaPeriodId,
|
||||
MediaPeriodId periodId,
|
||||
Timeline timeline)
|
||||
throws ExoPlaybackException {
|
||||
// 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,
|
||||
rendererFormatSupports,
|
||||
rendererMixedMimeTypeAdaptationSupports,
|
||||
mediaPeriodId,
|
||||
periodId,
|
||||
timeline);
|
||||
return new TrackSelectorResult(result.first, result.second, mappedTrackInfo);
|
||||
}
|
||||
|
@ -103,8 +103,8 @@ public final class AssetDataSource extends BaseDataSource {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] buffer, int offset, int readLength) throws AssetDataSourceException {
|
||||
if (readLength == 0) {
|
||||
public int read(byte[] buffer, int offset, int length) throws AssetDataSourceException {
|
||||
if (length == 0) {
|
||||
return 0;
|
||||
} else if (bytesRemaining == 0) {
|
||||
return C.RESULT_END_OF_INPUT;
|
||||
@ -113,7 +113,7 @@ public final class AssetDataSource extends BaseDataSource {
|
||||
int bytesRead;
|
||||
try {
|
||||
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);
|
||||
} catch (IOException e) {
|
||||
throw new AssetDataSourceException(e, PlaybackException.ERROR_CODE_IO_UNSPECIFIED);
|
||||
|
@ -60,19 +60,19 @@ public final class ByteArrayDataSource extends BaseDataSource {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] buffer, int offset, int readLength) {
|
||||
if (readLength == 0) {
|
||||
public int read(byte[] buffer, int offset, int length) {
|
||||
if (length == 0) {
|
||||
return 0;
|
||||
} else if (bytesRemaining == 0) {
|
||||
return C.RESULT_END_OF_INPUT;
|
||||
}
|
||||
|
||||
readLength = min(readLength, bytesRemaining);
|
||||
System.arraycopy(data, readPosition, buffer, offset, readLength);
|
||||
readPosition += readLength;
|
||||
bytesRemaining -= readLength;
|
||||
bytesTransferred(readLength);
|
||||
return readLength;
|
||||
length = min(length, bytesRemaining);
|
||||
System.arraycopy(data, readPosition, buffer, offset, length);
|
||||
readPosition += length;
|
||||
bytesRemaining -= length;
|
||||
bytesTransferred(length);
|
||||
return length;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -139,8 +139,8 @@ public final class ContentDataSource extends BaseDataSource {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] buffer, int offset, int readLength) throws ContentDataSourceException {
|
||||
if (readLength == 0) {
|
||||
public int read(byte[] buffer, int offset, int length) throws ContentDataSourceException {
|
||||
if (length == 0) {
|
||||
return 0;
|
||||
} else if (bytesRemaining == 0) {
|
||||
return C.RESULT_END_OF_INPUT;
|
||||
@ -149,7 +149,7 @@ public final class ContentDataSource extends BaseDataSource {
|
||||
int bytesRead;
|
||||
try {
|
||||
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);
|
||||
} catch (IOException e) {
|
||||
throw new ContentDataSourceException(e, PlaybackException.ERROR_CODE_IO_UNSPECIFIED);
|
||||
|
@ -82,19 +82,19 @@ public final class DataSchemeDataSource extends BaseDataSource {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] buffer, int offset, int readLength) {
|
||||
if (readLength == 0) {
|
||||
public int read(byte[] buffer, int offset, int length) {
|
||||
if (length == 0) {
|
||||
return 0;
|
||||
}
|
||||
if (bytesRemaining == 0) {
|
||||
return C.RESULT_END_OF_INPUT;
|
||||
}
|
||||
readLength = min(readLength, bytesRemaining);
|
||||
System.arraycopy(castNonNull(data), readPosition, buffer, offset, readLength);
|
||||
readPosition += readLength;
|
||||
bytesRemaining -= readLength;
|
||||
bytesTransferred(readLength);
|
||||
return readLength;
|
||||
length = min(length, bytesRemaining);
|
||||
System.arraycopy(castNonNull(data), readPosition, buffer, offset, length);
|
||||
readPosition += length;
|
||||
bytesRemaining -= length;
|
||||
bytesTransferred(length);
|
||||
return length;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -372,11 +372,11 @@ public final class DefaultBandwidthMeter implements BandwidthMeter, TransferList
|
||||
|
||||
@Override
|
||||
public synchronized void onBytesTransferred(
|
||||
DataSource source, DataSpec dataSpec, boolean isNetwork, int bytes) {
|
||||
DataSource source, DataSpec dataSpec, boolean isNetwork, int bytesTransferred) {
|
||||
if (!isTransferAtFullNetworkSpeed(dataSpec, isNetwork)) {
|
||||
return;
|
||||
}
|
||||
sampleBytesTransferred += bytes;
|
||||
sampleBytesTransferred += bytesTransferred;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -202,8 +202,8 @@ public final class DefaultDataSource implements DataSource {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] buffer, int offset, int readLength) throws IOException {
|
||||
return Assertions.checkNotNull(dataSource).read(buffer, offset, readLength);
|
||||
public int read(byte[] buffer, int offset, int length) throws IOException {
|
||||
return Assertions.checkNotNull(dataSource).read(buffer, offset, length);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -40,7 +40,7 @@ public final class DummyDataSource implements DataSource {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] buffer, int offset, int readLength) {
|
||||
public int read(byte[] buffer, int offset, int length) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
@ -128,15 +128,15 @@ public final class FileDataSource extends BaseDataSource {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] buffer, int offset, int readLength) throws FileDataSourceException {
|
||||
if (readLength == 0) {
|
||||
public int read(byte[] buffer, int offset, int length) throws FileDataSourceException {
|
||||
if (length == 0) {
|
||||
return 0;
|
||||
} else if (bytesRemaining == 0) {
|
||||
return C.RESULT_END_OF_INPUT;
|
||||
} else {
|
||||
int bytesRead;
|
||||
try {
|
||||
bytesRead = castNonNull(file).read(buffer, offset, (int) min(bytesRemaining, readLength));
|
||||
bytesRead = castNonNull(file).read(buffer, offset, (int) min(bytesRemaining, length));
|
||||
} catch (IOException e) {
|
||||
throw new FileDataSourceException(e, PlaybackException.ERROR_CODE_IO_UNSPECIFIED);
|
||||
}
|
||||
|
@ -67,9 +67,9 @@ public final class PriorityDataSource implements DataSource {
|
||||
}
|
||||
|
||||
@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);
|
||||
return upstream.read(buffer, offset, max);
|
||||
return upstream.read(buffer, offset, length);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -232,8 +232,8 @@ public final class RawResourceDataSource extends BaseDataSource {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] buffer, int offset, int readLength) throws RawResourceDataSourceException {
|
||||
if (readLength == 0) {
|
||||
public int read(byte[] buffer, int offset, int length) throws RawResourceDataSourceException {
|
||||
if (length == 0) {
|
||||
return 0;
|
||||
} else if (bytesRemaining == 0) {
|
||||
return C.RESULT_END_OF_INPUT;
|
||||
@ -242,7 +242,7 @@ public final class RawResourceDataSource extends BaseDataSource {
|
||||
int bytesRead;
|
||||
try {
|
||||
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);
|
||||
} catch (IOException e) {
|
||||
throw new RawResourceDataSourceException(e, PlaybackException.ERROR_CODE_IO_UNSPECIFIED);
|
||||
|
@ -109,8 +109,8 @@ public final class ResolvingDataSource implements DataSource {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] buffer, int offset, int readLength) throws IOException {
|
||||
return upstreamDataSource.read(buffer, offset, readLength);
|
||||
public int read(byte[] buffer, int offset, int length) throws IOException {
|
||||
return upstreamDataSource.read(buffer, offset, length);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -88,8 +88,8 @@ public final class StatsDataSource implements DataSource {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] buffer, int offset, int readLength) throws IOException {
|
||||
int bytesRead = dataSource.read(buffer, offset, readLength);
|
||||
public int read(byte[] buffer, int offset, int length) throws IOException {
|
||||
int bytesRead = dataSource.read(buffer, offset, length);
|
||||
if (bytesRead != C.RESULT_END_OF_INPUT) {
|
||||
this.bytesRead += bytesRead;
|
||||
}
|
||||
|
@ -63,11 +63,11 @@ public final class TeeDataSource implements DataSource {
|
||||
}
|
||||
|
||||
@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) {
|
||||
return C.RESULT_END_OF_INPUT;
|
||||
}
|
||||
int bytesRead = upstream.read(buffer, offset, max);
|
||||
int bytesRead = upstream.read(buffer, offset, length);
|
||||
if (bytesRead > 0) {
|
||||
// TODO: Consider continuing even if writes to the sink fail.
|
||||
dataSink.write(buffer, offset, bytesRead);
|
||||
|
@ -130,8 +130,8 @@ public final class UdpDataSource extends BaseDataSource {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] buffer, int offset, int readLength) throws UdpDataSourceException {
|
||||
if (readLength == 0) {
|
||||
public int read(byte[] buffer, int offset, int length) throws UdpDataSourceException {
|
||||
if (length == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -147,7 +147,7 @@ public final class UdpDataSource extends BaseDataSource {
|
||||
}
|
||||
|
||||
int packetOffset = packet.getLength() - packetRemaining;
|
||||
int bytesToRead = min(packetRemaining, readLength);
|
||||
int bytesToRead = min(packetRemaining, length);
|
||||
System.arraycopy(packetBuffer, packetOffset, buffer, offset, bytesToRead);
|
||||
packetRemaining -= bytesToRead;
|
||||
return bytesToRead;
|
||||
|
@ -596,10 +596,10 @@ public final class CacheDataSource implements DataSource {
|
||||
}
|
||||
|
||||
@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 currentDataSpec = checkNotNull(this.currentDataSpec);
|
||||
if (readLength == 0) {
|
||||
if (length == 0) {
|
||||
return 0;
|
||||
}
|
||||
if (bytesRemaining == 0) {
|
||||
@ -609,7 +609,7 @@ public final class CacheDataSource implements DataSource {
|
||||
if (readPosition >= checkCachePosition) {
|
||||
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 (isReadingFromCache()) {
|
||||
totalCachedBytesRead += bytesRead;
|
||||
@ -629,7 +629,7 @@ public final class CacheDataSource implements DataSource {
|
||||
} else if (bytesRemaining > 0 || bytesRemaining == C.LENGTH_UNSET) {
|
||||
closeCurrentSource();
|
||||
openNextSource(requestDataSpec, false);
|
||||
return read(buffer, offset, readLength);
|
||||
return read(buffer, offset, length);
|
||||
}
|
||||
return bytesRead;
|
||||
} catch (Throwable e) {
|
||||
|
@ -65,8 +65,8 @@ public final class DefaultContentMetadata implements ContentMetadata {
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public final byte[] get(String name, @Nullable byte[] defaultValue) {
|
||||
@Nullable byte[] bytes = metadata.get(name);
|
||||
public final byte[] get(String key, @Nullable byte[] defaultValue) {
|
||||
@Nullable byte[] bytes = metadata.get(key);
|
||||
if (bytes != null) {
|
||||
return Arrays.copyOf(bytes, bytes.length);
|
||||
} else {
|
||||
@ -76,8 +76,8 @@ public final class DefaultContentMetadata implements ContentMetadata {
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public final String get(String name, @Nullable String defaultValue) {
|
||||
@Nullable byte[] bytes = metadata.get(name);
|
||||
public final String get(String key, @Nullable String defaultValue) {
|
||||
@Nullable byte[] bytes = metadata.get(key);
|
||||
if (bytes != null) {
|
||||
return new String(bytes, Charsets.UTF_8);
|
||||
} else {
|
||||
@ -86,8 +86,8 @@ public final class DefaultContentMetadata implements ContentMetadata {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final long get(String name, long defaultValue) {
|
||||
@Nullable byte[] bytes = metadata.get(name);
|
||||
public final long get(String key, long defaultValue) {
|
||||
@Nullable byte[] bytes = metadata.get(key);
|
||||
if (bytes != null) {
|
||||
return ByteBuffer.wrap(bytes).getLong();
|
||||
} else {
|
||||
@ -96,8 +96,8 @@ public final class DefaultContentMetadata implements ContentMetadata {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean contains(String name) {
|
||||
return metadata.containsKey(name);
|
||||
public final boolean contains(String key) {
|
||||
return metadata.containsKey(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -34,7 +34,7 @@ public final class NoOpCacheEvictor implements CacheEvictor {
|
||||
}
|
||||
|
||||
@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.
|
||||
}
|
||||
|
||||
|
@ -59,15 +59,15 @@ public final class AesCipherDataSource implements DataSource {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] data, int offset, int readLength) throws IOException {
|
||||
if (readLength == 0) {
|
||||
public int read(byte[] buffer, int offset, int length) throws IOException {
|
||||
if (length == 0) {
|
||||
return 0;
|
||||
}
|
||||
int read = upstream.read(data, offset, readLength);
|
||||
int read = upstream.read(buffer, offset, length);
|
||||
if (read == 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;
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ public class DebugTextViewHelper implements Player.Listener, Runnable {
|
||||
|
||||
@Override
|
||||
public final void onPlayWhenReadyChanged(
|
||||
boolean playWhenReady, @Player.PlayWhenReadyChangeReason int playbackState) {
|
||||
boolean playWhenReady, @Player.PlayWhenReadyChangeReason int reason) {
|
||||
updateAndPost();
|
||||
}
|
||||
|
||||
|
@ -243,13 +243,13 @@ public class EventLogger implements AnalyticsListener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerError(EventTime eventTime, PlaybackException e) {
|
||||
loge(eventTime, "playerFailed", e);
|
||||
public void onPlayerError(EventTime eventTime, PlaybackException error) {
|
||||
loge(eventTime, "playerFailed", error);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTracksChanged(
|
||||
EventTime eventTime, TrackGroupArray ignored, TrackSelectionArray trackSelections) {
|
||||
EventTime eventTime, TrackGroupArray trackGroups, TrackSelectionArray trackSelections) {
|
||||
MappedTrackInfo mappedTrackInfo =
|
||||
trackSelector != null ? trackSelector.getCurrentMappedTrackInfo() : null;
|
||||
if (mappedTrackInfo == null) {
|
||||
@ -341,7 +341,7 @@ public class EventLogger implements AnalyticsListener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAudioEnabled(EventTime eventTime, DecoderCounters counters) {
|
||||
public void onAudioEnabled(EventTime eventTime, DecoderCounters decoderCounters) {
|
||||
logd(eventTime, "audioEnabled");
|
||||
}
|
||||
|
||||
@ -373,7 +373,7 @@ public class EventLogger implements AnalyticsListener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAudioDisabled(EventTime eventTime, DecoderCounters counters) {
|
||||
public void onAudioDisabled(EventTime eventTime, DecoderCounters decoderCounters) {
|
||||
logd(eventTime, "audioDisabled");
|
||||
}
|
||||
|
||||
@ -407,7 +407,7 @@ public class EventLogger implements AnalyticsListener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVideoEnabled(EventTime eventTime, DecoderCounters counters) {
|
||||
public void onVideoEnabled(EventTime eventTime, DecoderCounters decoderCounters) {
|
||||
logd(eventTime, "videoEnabled");
|
||||
}
|
||||
|
||||
@ -424,8 +424,8 @@ public class EventLogger implements AnalyticsListener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDroppedVideoFrames(EventTime eventTime, int count, long elapsedMs) {
|
||||
logd(eventTime, "droppedFrames", Integer.toString(count));
|
||||
public void onDroppedVideoFrames(EventTime eventTime, int droppedFrames, long elapsedMs) {
|
||||
logd(eventTime, "droppedFrames", Integer.toString(droppedFrames));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -434,7 +434,7 @@ public class EventLogger implements AnalyticsListener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVideoDisabled(EventTime eventTime, DecoderCounters counters) {
|
||||
public void onVideoDisabled(EventTime eventTime, DecoderCounters decoderCounters) {
|
||||
logd(eventTime, "videoDisabled");
|
||||
}
|
||||
|
||||
@ -503,8 +503,8 @@ public class EventLogger implements AnalyticsListener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDrmSessionManagerError(EventTime eventTime, Exception e) {
|
||||
printInternalError(eventTime, "drmSessionManagerError", e);
|
||||
public void onDrmSessionManagerError(EventTime eventTime, Exception error) {
|
||||
printInternalError(eventTime, "drmSessionManagerError", error);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -2570,9 +2570,10 @@ public final class ExoPlayerTest {
|
||||
Renderer videoRenderer =
|
||||
new FakeRenderer(C.TRACK_TYPE_VIDEO) {
|
||||
@Override
|
||||
public void handleMessage(int what, @Nullable Object object) throws ExoPlaybackException {
|
||||
super.handleMessage(what, object);
|
||||
rendererMessages.add(what);
|
||||
public void handleMessage(int messageType, @Nullable Object message)
|
||||
throws ExoPlaybackException {
|
||||
super.handleMessage(messageType, message);
|
||||
rendererMessages.add(messageType);
|
||||
}
|
||||
};
|
||||
ActionSchedule actionSchedule = addSurfaceSwitch(new ActionSchedule.Builder(TAG)).build();
|
||||
@ -3019,8 +3020,8 @@ public final class ExoPlayerTest {
|
||||
final Player.Listener playerListener =
|
||||
new Player.Listener() {
|
||||
@Override
|
||||
public void onPlaybackStateChanged(int state) {
|
||||
if (state == Player.STATE_IDLE) {
|
||||
public void onPlaybackStateChanged(int playbackState) {
|
||||
if (playbackState == Player.STATE_IDLE) {
|
||||
playerReference.get().setMediaSource(secondMediaSource);
|
||||
}
|
||||
}
|
||||
@ -10925,12 +10926,13 @@ public final class ExoPlayerTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(int what, @Nullable Object object) throws ExoPlaybackException {
|
||||
if (what == MSG_SET_WAKEUP_LISTENER) {
|
||||
assertThat(object).isNotNull();
|
||||
wakeupListenerReceiver.set((WakeupListener) object);
|
||||
public void handleMessage(int messageType, @Nullable Object message)
|
||||
throws ExoPlaybackException {
|
||||
if (messageType == MSG_SET_WAKEUP_LISTENER) {
|
||||
assertThat(message).isNotNull();
|
||||
wakeupListenerReceiver.set((WakeupListener) message);
|
||||
}
|
||||
super.handleMessage(what, object);
|
||||
super.handleMessage(messageType, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -10947,7 +10949,7 @@ public final class ExoPlayerTest {
|
||||
public int messageCount;
|
||||
|
||||
@Override
|
||||
public void handleMessage(int x, @Nullable Object message) {
|
||||
public void handleMessage(int messageType, @Nullable Object message) {
|
||||
messageCount++;
|
||||
}
|
||||
}
|
||||
|
@ -2244,7 +2244,7 @@ public final class AnalyticsCollectorTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAudioEnabled(EventTime eventTime, DecoderCounters counters) {
|
||||
public void onAudioEnabled(EventTime eventTime, DecoderCounters decoderCounters) {
|
||||
reportedEvents.add(new ReportedEvent(EVENT_AUDIO_ENABLED, eventTime));
|
||||
}
|
||||
|
||||
@ -2263,7 +2263,7 @@ public final class AnalyticsCollectorTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAudioDisabled(EventTime eventTime, DecoderCounters counters) {
|
||||
public void onAudioDisabled(EventTime eventTime, DecoderCounters decoderCounters) {
|
||||
reportedEvents.add(new ReportedEvent(EVENT_AUDIO_DISABLED, eventTime));
|
||||
}
|
||||
|
||||
@ -2284,7 +2284,7 @@ public final class AnalyticsCollectorTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVideoEnabled(EventTime eventTime, DecoderCounters counters) {
|
||||
public void onVideoEnabled(EventTime eventTime, DecoderCounters decoderCounters) {
|
||||
reportedEvents.add(new ReportedEvent(EVENT_VIDEO_ENABLED, eventTime));
|
||||
}
|
||||
|
||||
@ -2308,7 +2308,7 @@ public final class AnalyticsCollectorTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVideoDisabled(EventTime eventTime, DecoderCounters counters) {
|
||||
public void onVideoDisabled(EventTime eventTime, DecoderCounters decoderCounters) {
|
||||
reportedEvents.add(new ReportedEvent(EVENT_VIDEO_DISABLED, eventTime));
|
||||
}
|
||||
|
||||
|
@ -564,12 +564,11 @@ public final class DashMediaSource extends BaseMediaSource {
|
||||
}
|
||||
|
||||
@Override
|
||||
public MediaPeriod createPeriod(
|
||||
MediaPeriodId periodId, Allocator allocator, long startPositionUs) {
|
||||
int periodIndex = (Integer) periodId.periodUid - firstPeriodId;
|
||||
public MediaPeriod createPeriod(MediaPeriodId id, Allocator allocator, long startPositionUs) {
|
||||
int periodIndex = (Integer) id.periodUid - firstPeriodId;
|
||||
MediaSourceEventListener.EventDispatcher periodEventDispatcher =
|
||||
createEventDispatcher(periodId, manifest.getPeriod(periodIndex).startMs);
|
||||
DrmSessionEventListener.EventDispatcher drmEventDispatcher = createDrmEventDispatcher(periodId);
|
||||
createEventDispatcher(id, manifest.getPeriod(periodIndex).startMs);
|
||||
DrmSessionEventListener.EventDispatcher drmEventDispatcher = createDrmEventDispatcher(id);
|
||||
DashMediaPeriod mediaPeriod =
|
||||
new DashMediaPeriod(
|
||||
firstPeriodId + periodIndex,
|
||||
|
@ -290,8 +290,8 @@ public final class PlayerEmsgHandler implements Handler.Callback {
|
||||
|
||||
@Override
|
||||
public void sampleMetadata(
|
||||
long timeUs, int flags, int size, int offset, @Nullable CryptoData encryptionData) {
|
||||
sampleQueue.sampleMetadata(timeUs, flags, size, offset, encryptionData);
|
||||
long timeUs, int flags, int size, int offset, @Nullable CryptoData cryptoData) {
|
||||
sampleQueue.sampleMetadata(timeUs, flags, size, offset, cryptoData);
|
||||
parseAndDiscardSamples();
|
||||
}
|
||||
|
||||
|
@ -302,8 +302,8 @@ public abstract class Representation {
|
||||
// DashSegmentIndex implementation.
|
||||
|
||||
@Override
|
||||
public RangedUri getSegmentUrl(long segmentIndex) {
|
||||
return segmentBase.getSegmentUrl(this, segmentIndex);
|
||||
public RangedUri getSegmentUrl(long segmentNum) {
|
||||
return segmentBase.getSegmentUrl(this, segmentNum);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -312,13 +312,13 @@ public abstract class Representation {
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTimeUs(long segmentIndex) {
|
||||
return segmentBase.getSegmentTimeUs(segmentIndex);
|
||||
public long getTimeUs(long segmentNum) {
|
||||
return segmentBase.getSegmentTimeUs(segmentNum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getDurationUs(long segmentIndex, long periodDurationUs) {
|
||||
return segmentBase.getSegmentDurationUs(segmentIndex, periodDurationUs);
|
||||
public long getDurationUs(long segmentNum, long periodDurationUs) {
|
||||
return segmentBase.getSegmentDurationUs(segmentNum, periodDurationUs);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -56,12 +56,12 @@ public final class DefaultExtractorInput implements ExtractorInput {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] target, int offset, int length) throws IOException {
|
||||
int bytesRead = readFromPeekBuffer(target, offset, length);
|
||||
public int read(byte[] buffer, int offset, int length) throws IOException {
|
||||
int bytesRead = readFromPeekBuffer(buffer, offset, length);
|
||||
if (bytesRead == 0) {
|
||||
bytesRead =
|
||||
readFromUpstream(
|
||||
target, offset, length, /* bytesAlreadyRead= */ 0, /* allowEndOfInput= */ true);
|
||||
buffer, offset, length, /* bytesAlreadyRead= */ 0, /* allowEndOfInput= */ true);
|
||||
}
|
||||
commitBytesRead(bytesRead);
|
||||
return bytesRead;
|
||||
|
@ -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
|
||||
* 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 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.
|
||||
* @throws IOException If an error occurs reading from the input.
|
||||
*/
|
||||
@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.
|
||||
|
@ -27,8 +27,8 @@ public class ForwardingExtractorInput implements ExtractorInput {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] target, int offset, int length) throws IOException {
|
||||
return input.read(target, offset, length);
|
||||
public int read(byte[] buffer, int offset, int length) throws IOException {
|
||||
return input.read(buffer, offset, length);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -198,12 +198,8 @@ public interface TrackOutput {
|
||||
* @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
|
||||
* 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(
|
||||
long timeUs,
|
||||
@C.BufferFlags int flags,
|
||||
int size,
|
||||
int offset,
|
||||
@Nullable CryptoData encryptionData);
|
||||
long timeUs, @C.BufferFlags int flags, int size, int offset, @Nullable CryptoData cryptoData);
|
||||
}
|
||||
|
@ -165,10 +165,10 @@ public final class AmrExtractor implements Extractor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(ExtractorOutput extractorOutput) {
|
||||
this.extractorOutput = extractorOutput;
|
||||
trackOutput = extractorOutput.track(/* id= */ 0, C.TRACK_TYPE_AUDIO);
|
||||
extractorOutput.endTracks();
|
||||
public void init(ExtractorOutput output) {
|
||||
this.extractorOutput = output;
|
||||
trackOutput = output.track(/* id= */ 0, C.TRACK_TYPE_AUDIO);
|
||||
output.endTracks();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -96,10 +96,10 @@ public final class Ac3Reader implements ElementaryStreamReader {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createTracks(ExtractorOutput extractorOutput, TrackIdGenerator generator) {
|
||||
generator.generateNewId();
|
||||
formatId = generator.getFormatId();
|
||||
output = extractorOutput.track(generator.getTrackId(), C.TRACK_TYPE_AUDIO);
|
||||
public void createTracks(ExtractorOutput extractorOutput, TrackIdGenerator idGenerator) {
|
||||
idGenerator.generateNewId();
|
||||
formatId = idGenerator.getFormatId();
|
||||
output = extractorOutput.track(idGenerator.getTrackId(), C.TRACK_TYPE_AUDIO);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -99,10 +99,10 @@ public final class Ac4Reader implements ElementaryStreamReader {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createTracks(ExtractorOutput extractorOutput, TrackIdGenerator generator) {
|
||||
generator.generateNewId();
|
||||
formatId = generator.getFormatId();
|
||||
output = extractorOutput.track(generator.getTrackId(), C.TRACK_TYPE_AUDIO);
|
||||
public void createTracks(ExtractorOutput extractorOutput, TrackIdGenerator idGenerator) {
|
||||
idGenerator.generateNewId();
|
||||
formatId = idGenerator.getFormatId();
|
||||
output = extractorOutput.track(idGenerator.getTrackId(), C.TRACK_TYPE_AUDIO);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -96,9 +96,9 @@ import javax.crypto.spec.SecretKeySpec;
|
||||
}
|
||||
|
||||
@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);
|
||||
int bytesRead = cipherInputStream.read(buffer, offset, readLength);
|
||||
int bytesRead = cipherInputStream.read(buffer, offset, length);
|
||||
if (bytesRead < 0) {
|
||||
return C.RESULT_END_OF_INPUT;
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ public final class DefaultHlsExtractorFactory implements HlsExtractorFactory {
|
||||
@Nullable List<Format> muxedCaptionFormats,
|
||||
TimestampAdjuster timestampAdjuster,
|
||||
Map<String, List<String>> responseHeaders,
|
||||
ExtractorInput extractorInput)
|
||||
ExtractorInput sniffingExtractorInput)
|
||||
throws IOException {
|
||||
@FileTypes.Type
|
||||
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.
|
||||
@Nullable Extractor fallBackExtractor = null;
|
||||
extractorInput.resetPeekPosition();
|
||||
sniffingExtractorInput.resetPeekPosition();
|
||||
for (int i = 0; i < fileTypeOrder.size(); i++) {
|
||||
int fileType = fileTypeOrder.get(i);
|
||||
Extractor extractor =
|
||||
checkNotNull(
|
||||
createExtractorByFileType(fileType, format, muxedCaptionFormats, timestampAdjuster));
|
||||
if (sniffQuietly(extractor, extractorInput)) {
|
||||
if (sniffQuietly(extractor, sniffingExtractorInput)) {
|
||||
return new BundledHlsMediaChunkExtractor(extractor, format, timestampAdjuster);
|
||||
}
|
||||
if (fallBackExtractor == null
|
||||
|
@ -502,24 +502,25 @@ public final class HlsMediaSource extends BaseMediaSource
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPrimaryPlaylistRefreshed(HlsMediaPlaylist playlist) {
|
||||
public void onPrimaryPlaylistRefreshed(HlsMediaPlaylist mediaPlaylist) {
|
||||
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
|
||||
// started at the same time as the window. Otherwise, we don't know the presentation start time.
|
||||
long presentationStartTimeMs =
|
||||
playlist.playlistType == HlsMediaPlaylist.PLAYLIST_TYPE_EVENT
|
||||
|| playlist.playlistType == HlsMediaPlaylist.PLAYLIST_TYPE_VOD
|
||||
mediaPlaylist.playlistType == HlsMediaPlaylist.PLAYLIST_TYPE_EVENT
|
||||
|| mediaPlaylist.playlistType == HlsMediaPlaylist.PLAYLIST_TYPE_VOD
|
||||
? windowStartTimeMs
|
||||
: C.TIME_UNSET;
|
||||
// The master playlist is non-null because the first playlist has been fetched by now.
|
||||
HlsManifest manifest =
|
||||
new HlsManifest(checkNotNull(playlistTracker.getMasterPlaylist()), playlist);
|
||||
new HlsManifest(checkNotNull(playlistTracker.getMasterPlaylist()), mediaPlaylist);
|
||||
SinglePeriodTimeline timeline =
|
||||
playlistTracker.isLive()
|
||||
? createTimelineForLive(playlist, presentationStartTimeMs, windowStartTimeMs, manifest)
|
||||
? createTimelineForLive(
|
||||
mediaPlaylist, presentationStartTimeMs, windowStartTimeMs, manifest)
|
||||
: createTimelineForOnDemand(
|
||||
playlist, presentationStartTimeMs, windowStartTimeMs, manifest);
|
||||
mediaPlaylist, presentationStartTimeMs, windowStartTimeMs, manifest);
|
||||
refreshSourceInfo(timeline);
|
||||
}
|
||||
|
||||
|
@ -1781,10 +1781,9 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sampleData(
|
||||
ParsableByteArray buffer, int length, @SampleDataPart int sampleDataPart) {
|
||||
public void sampleData(ParsableByteArray data, int length, @SampleDataPart int sampleDataPart) {
|
||||
ensureBufferCapacity(bufferPosition + length);
|
||||
buffer.readBytes(this.buffer, bufferPosition, length);
|
||||
data.readBytes(this.buffer, bufferPosition, length);
|
||||
bufferPosition += length;
|
||||
}
|
||||
|
||||
|
@ -123,10 +123,12 @@ public interface HlsPlaylistTracker {
|
||||
* @param initialPlaylistUri Uri of the HLS stream. Can point to a media playlist or a master
|
||||
* playlist.
|
||||
* @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(
|
||||
Uri initialPlaylistUri, EventDispatcher eventDispatcher, PrimaryPlaylistListener listener);
|
||||
Uri initialPlaylistUri,
|
||||
EventDispatcher eventDispatcher,
|
||||
PrimaryPlaylistListener primaryPlaylistListener);
|
||||
|
||||
/**
|
||||
* Stops the playlist tracker and releases any acquired resources.
|
||||
|
@ -109,7 +109,7 @@ public class Aes128DataSourceTest {
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
|
@ -88,14 +88,14 @@ import java.util.concurrent.LinkedBlockingQueue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] target, int offset, int length) {
|
||||
public int read(byte[] buffer, int offset, int length) {
|
||||
if (length == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bytesRead = 0;
|
||||
int bytesToRead = min(length, unreadData.length);
|
||||
System.arraycopy(unreadData, /* srcPos= */ 0, target, offset, bytesToRead);
|
||||
System.arraycopy(unreadData, /* srcPos= */ 0, buffer, offset, bytesToRead);
|
||||
bytesRead += bytesToRead;
|
||||
unreadData = Arrays.copyOfRange(unreadData, bytesToRead, unreadData.length);
|
||||
|
||||
@ -115,7 +115,7 @@ import java.util.concurrent.LinkedBlockingQueue;
|
||||
}
|
||||
|
||||
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) {
|
||||
unreadData = Arrays.copyOfRange(data, bytesToRead, data.length);
|
||||
}
|
||||
|
@ -94,9 +94,9 @@ import java.io.IOException;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] target, int offset, int length) throws IOException {
|
||||
public int read(byte[] buffer, int offset, int length) throws IOException {
|
||||
try {
|
||||
return dataSource.read(target, offset, length);
|
||||
return dataSource.read(buffer, offset, length);
|
||||
} catch (UdpDataSource.UdpDataSourceException e) {
|
||||
if (e.reason == PlaybackException.ERROR_CODE_IO_NETWORK_CONNECTION_TIMEOUT) {
|
||||
return C.RESULT_END_OF_INPUT;
|
||||
|
@ -86,7 +86,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
|
||||
@Override
|
||||
public void consume(
|
||||
ParsableByteArray data, long timestamp, int sequenceNumber, boolean isFrameBoundary) {
|
||||
ParsableByteArray data, long timestamp, int sequenceNumber, boolean rtpMarker) {
|
||||
/*
|
||||
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.
|
||||
trackOutput.sampleData(data, data.bytesLeft());
|
||||
if (isFrameBoundary) {
|
||||
if (rtpMarker) {
|
||||
outputSampleMetadata(trackOutput, sampleTimeUs, auSize);
|
||||
}
|
||||
} else {
|
||||
|
@ -73,7 +73,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
|
||||
@Override
|
||||
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).
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+- .. +-+-+-+-+-+-+-+
|
||||
@ -115,7 +115,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
// Falls through.
|
||||
case AC3_FRAME_TYPE_NON_INITIAL_FRAGMENT:
|
||||
// The content of an AC3 frame is split into multiple RTP packets.
|
||||
processFragmentedPacket(data, isFrameBoundary, frameType, sampleTimeUs);
|
||||
processFragmentedPacket(data, rtpMarker, frameType, sampleTimeUs);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -86,8 +86,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
|
||||
public void onReceivingFirstPacket(long timestamp, int sequenceNumber) {}
|
||||
|
||||
@Override
|
||||
public void consume(
|
||||
ParsableByteArray data, long timestamp, int sequenceNumber, boolean isAuBoundary)
|
||||
public void consume(ParsableByteArray data, long timestamp, int sequenceNumber, boolean rtpMarker)
|
||||
throws ParserException {
|
||||
|
||||
int rtpH264PacketMode;
|
||||
@ -111,7 +110,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
|
||||
/* cause= */ null);
|
||||
}
|
||||
|
||||
if (isAuBoundary) {
|
||||
if (rtpMarker) {
|
||||
if (firstReceivedTimestamp == C.TIME_UNSET) {
|
||||
firstReceivedTimestamp = timestamp;
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ public final class RtspPlaybackTest {
|
||||
public void close() {}
|
||||
|
||||
@Override
|
||||
public int read(byte[] target, int offset, int length) {
|
||||
public int read(byte[] buffer, int offset, int length) {
|
||||
if (length == 0) {
|
||||
return 0;
|
||||
}
|
||||
@ -301,7 +301,7 @@ public final class RtspPlaybackTest {
|
||||
}
|
||||
|
||||
int byteToRead = min(length, data.length);
|
||||
System.arraycopy(data, /* srcPos= */ 0, target, offset, byteToRead);
|
||||
System.arraycopy(data, /* srcPos= */ 0, buffer, offset, byteToRead);
|
||||
return byteToRead;
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ public class DefaultSsChunkSource implements SsChunkSource {
|
||||
public SsChunkSource createChunkSource(
|
||||
LoaderErrorThrower manifestLoaderErrorThrower,
|
||||
SsManifest manifest,
|
||||
int elementIndex,
|
||||
int streamElementIndex,
|
||||
ExoTrackSelection trackSelection,
|
||||
@Nullable TransferListener transferListener) {
|
||||
DataSource dataSource = dataSourceFactory.createDataSource();
|
||||
@ -70,7 +70,7 @@ public class DefaultSsChunkSource implements SsChunkSource {
|
||||
dataSource.addTransferListener(transferListener);
|
||||
}
|
||||
return new DefaultSsChunkSource(
|
||||
manifestLoaderErrorThrower, manifest, elementIndex, trackSelection, dataSource);
|
||||
manifestLoaderErrorThrower, manifest, streamElementIndex, trackSelection, dataSource);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1507,7 +1507,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
|
||||
}
|
||||
|
||||
@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
|
||||
// is necessary to avoid closing the shutter when such a transition occurs. See:
|
||||
// https://github.com/google/ExoPlayer/issues/5507.
|
||||
|
@ -1548,7 +1548,7 @@ public class StyledPlayerView extends FrameLayout implements AdViewProvider {
|
||||
}
|
||||
|
||||
@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
|
||||
// is necessary to avoid closing the shutter when such a transition occurs. See:
|
||||
// https://github.com/google/ExoPlayer/issues/5507.
|
||||
|
@ -148,7 +148,7 @@ public class FakeDataSource extends BaseDataSource {
|
||||
}
|
||||
|
||||
@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);
|
||||
while (true) {
|
||||
FakeData fakeData = Util.castNonNull(this.fakeData);
|
||||
@ -168,22 +168,22 @@ public class FakeDataSource extends BaseDataSource {
|
||||
Util.castNonNull(current.action).run();
|
||||
} else {
|
||||
// Read at most bytesRemaining.
|
||||
readLength = (int) min(readLength, bytesRemaining);
|
||||
length = (int) min(length, bytesRemaining);
|
||||
// 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.
|
||||
Assertions.checkArgument(buffer.length - offset >= readLength);
|
||||
Assertions.checkArgument(buffer.length - offset >= length);
|
||||
if (current.data != null) {
|
||||
System.arraycopy(current.data, current.bytesRead, buffer, offset, readLength);
|
||||
System.arraycopy(current.data, current.bytesRead, buffer, offset, length);
|
||||
}
|
||||
onDataRead(readLength);
|
||||
bytesTransferred(readLength);
|
||||
bytesRemaining -= readLength;
|
||||
current.bytesRead += readLength;
|
||||
onDataRead(length);
|
||||
bytesTransferred(length);
|
||||
bytesRemaining -= length;
|
||||
current.bytesRead += length;
|
||||
if (current.bytesRead == current.length) {
|
||||
currentSegmentIndex++;
|
||||
}
|
||||
return readLength;
|
||||
return length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -107,10 +107,10 @@ public final class FakeExtractorInput implements ExtractorInput {
|
||||
}
|
||||
|
||||
@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);
|
||||
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
|
||||
|
@ -125,7 +125,7 @@ public final class FakeTrackSelection implements ExoTrackSelection {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlaybackSpeed(float speed) {
|
||||
public void onPlaybackSpeed(float playbackSpeed) {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
@ -152,7 +152,7 @@ public final class FakeTrackSelection implements ExoTrackSelection {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlacklisted(int index, long exclusionDurationMs) {
|
||||
public boolean isBlacklisted(int index, long nowMs) {
|
||||
assertThat(isEnabled).isTrue();
|
||||
return false;
|
||||
}
|
||||
|
@ -95,14 +95,14 @@ public class FakeVideoRenderer extends FakeRenderer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(int messageType, @Nullable Object payload) throws ExoPlaybackException {
|
||||
public void handleMessage(int messageType, @Nullable Object message) throws ExoPlaybackException {
|
||||
switch (messageType) {
|
||||
case MSG_SET_VIDEO_OUTPUT:
|
||||
output = payload;
|
||||
output = message;
|
||||
renderedFirstFrameAfterReset = false;
|
||||
break;
|
||||
default:
|
||||
super.handleMessage(messageType, payload);
|
||||
super.handleMessage(messageType, message);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user