mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Fix non-inclusive language in class names.
https://source.android.com/setup/contribute/respectful-code#term-examples PiperOrigin-RevId: 438335305
This commit is contained in:
parent
bd5ca15af6
commit
81ab6c730d
12 changed files with 76 additions and 71 deletions
|
|
@ -15,6 +15,8 @@
|
||||||
* Track selection:
|
* Track selection:
|
||||||
* Flatten `TrackSelectionOverrides` class into `TrackSelectionParameters`,
|
* Flatten `TrackSelectionOverrides` class into `TrackSelectionParameters`,
|
||||||
and promote `TrackSelectionOverride` to a top level class.
|
and promote `TrackSelectionOverride` to a top level class.
|
||||||
|
* Video:
|
||||||
|
* Rename `DummySurface` to `PlaceHolderSurface`.
|
||||||
* Audio:
|
* Audio:
|
||||||
* Use LG AC3 audio decoder advertising non-standard MIME type.
|
* Use LG AC3 audio decoder advertising non-standard MIME type.
|
||||||
* Extractors:
|
* Extractors:
|
||||||
|
|
@ -51,6 +53,8 @@
|
||||||
([#47](https://github.com/androidx/media/pull/47)).
|
([#47](https://github.com/androidx/media/pull/47)).
|
||||||
* Add RTP reader for WAV
|
* Add RTP reader for WAV
|
||||||
([#56](https://github.com/androidx/media/pull/56)).
|
([#56](https://github.com/androidx/media/pull/56)).
|
||||||
|
* Data sources:
|
||||||
|
* Rename `DummyDataSource` to `PlaceHolderDataSource`.
|
||||||
* Remove deprecated symbols:
|
* Remove deprecated symbols:
|
||||||
* Remove `Player.Listener.onTracksChanged`. Use
|
* Remove `Player.Listener.onTracksChanged`. Use
|
||||||
`Player.Listener.onTracksInfoChanged` instead.
|
`Player.Listener.onTracksInfoChanged` instead.
|
||||||
|
|
|
||||||
|
|
@ -22,14 +22,14 @@ import java.io.IOException;
|
||||||
|
|
||||||
/** A DataSource which provides no data. {@link #open(DataSpec)} throws {@link IOException}. */
|
/** A DataSource which provides no data. {@link #open(DataSpec)} throws {@link IOException}. */
|
||||||
@UnstableApi
|
@UnstableApi
|
||||||
public final class DummyDataSource implements DataSource {
|
public final class PlaceholderDataSource implements DataSource {
|
||||||
|
|
||||||
public static final DummyDataSource INSTANCE = new DummyDataSource();
|
public static final PlaceholderDataSource INSTANCE = new PlaceholderDataSource();
|
||||||
|
|
||||||
/** A factory that produces {@link DummyDataSource}. */
|
/** A factory that produces {@link PlaceholderDataSource}. */
|
||||||
public static final Factory FACTORY = DummyDataSource::new;
|
public static final Factory FACTORY = PlaceholderDataSource::new;
|
||||||
|
|
||||||
private DummyDataSource() {}
|
private PlaceholderDataSource() {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addTransferListener(TransferListener transferListener) {
|
public void addTransferListener(TransferListener transferListener) {
|
||||||
|
|
@ -38,7 +38,7 @@ public final class DummyDataSource implements DataSource {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long open(DataSpec dataSpec) throws IOException {
|
public long open(DataSpec dataSpec) throws IOException {
|
||||||
throw new IOException("DummyDataSource cannot be opened");
|
throw new IOException("PlaceholderDataSource cannot be opened");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -36,8 +36,8 @@ import androidx.media3.datasource.DataSink;
|
||||||
import androidx.media3.datasource.DataSource;
|
import androidx.media3.datasource.DataSource;
|
||||||
import androidx.media3.datasource.DataSourceException;
|
import androidx.media3.datasource.DataSourceException;
|
||||||
import androidx.media3.datasource.DataSpec;
|
import androidx.media3.datasource.DataSpec;
|
||||||
import androidx.media3.datasource.DummyDataSource;
|
|
||||||
import androidx.media3.datasource.FileDataSource;
|
import androidx.media3.datasource.FileDataSource;
|
||||||
|
import androidx.media3.datasource.PlaceholderDataSource;
|
||||||
import androidx.media3.datasource.PriorityDataSource;
|
import androidx.media3.datasource.PriorityDataSource;
|
||||||
import androidx.media3.datasource.TeeDataSource;
|
import androidx.media3.datasource.TeeDataSource;
|
||||||
import androidx.media3.datasource.TransferListener;
|
import androidx.media3.datasource.TransferListener;
|
||||||
|
|
@ -541,7 +541,7 @@ public final class CacheDataSource implements DataSource {
|
||||||
? new TeeDataSource(upstreamDataSource, cacheWriteDataSink)
|
? new TeeDataSource(upstreamDataSource, cacheWriteDataSink)
|
||||||
: null;
|
: null;
|
||||||
} else {
|
} else {
|
||||||
this.upstreamDataSource = DummyDataSource.INSTANCE;
|
this.upstreamDataSource = PlaceholderDataSource.INSTANCE;
|
||||||
this.cacheWriteDataSource = null;
|
this.cacheWriteDataSource = null;
|
||||||
}
|
}
|
||||||
this.eventListener = eventListener;
|
this.eventListener = eventListener;
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
|
||||||
private boolean codecHandlesHdr10PlusOutOfBandMetadata;
|
private boolean codecHandlesHdr10PlusOutOfBandMetadata;
|
||||||
|
|
||||||
@Nullable private Surface surface;
|
@Nullable private Surface surface;
|
||||||
@Nullable private DummySurface dummySurface;
|
@Nullable private PlaceholderSurface placeholderSurface;
|
||||||
private boolean haveReportedFirstFrameRenderedForCurrentSurface;
|
private boolean haveReportedFirstFrameRenderedForCurrentSurface;
|
||||||
private @C.VideoScalingMode int scalingMode;
|
private @C.VideoScalingMode int scalingMode;
|
||||||
private boolean renderedFirstFrameAfterReset;
|
private boolean renderedFirstFrameAfterReset;
|
||||||
|
|
@ -515,7 +515,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
|
||||||
public boolean isReady() {
|
public boolean isReady() {
|
||||||
if (super.isReady()
|
if (super.isReady()
|
||||||
&& (renderedFirstFrameAfterReset
|
&& (renderedFirstFrameAfterReset
|
||||||
|| (dummySurface != null && surface == dummySurface)
|
|| (placeholderSurface != null && surface == placeholderSurface)
|
||||||
|| getCodec() == null
|
|| getCodec() == null
|
||||||
|| tunneling)) {
|
|| tunneling)) {
|
||||||
// Ready. If we were joining then we've now joined, so clear the joining deadline.
|
// Ready. If we were joining then we've now joined, so clear the joining deadline.
|
||||||
|
|
@ -567,14 +567,14 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TargetApi(17) // Needed for dummySurface usage. dummySurface is always null on API level 16.
|
@TargetApi(17) // Needed for placeholderSurface usage, as it is always null on API level 16.
|
||||||
@Override
|
@Override
|
||||||
protected void onReset() {
|
protected void onReset() {
|
||||||
try {
|
try {
|
||||||
super.onReset();
|
super.onReset();
|
||||||
} finally {
|
} finally {
|
||||||
if (dummySurface != null) {
|
if (placeholderSurface != null) {
|
||||||
releaseDummySurface();
|
releasePlaceholderSurface();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -624,14 +624,14 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
|
||||||
@Nullable Surface surface = output instanceof Surface ? (Surface) output : null;
|
@Nullable Surface surface = output instanceof Surface ? (Surface) output : null;
|
||||||
|
|
||||||
if (surface == null) {
|
if (surface == null) {
|
||||||
// Use a dummy surface if possible.
|
// Use a placeholder surface if possible.
|
||||||
if (dummySurface != null) {
|
if (placeholderSurface != null) {
|
||||||
surface = dummySurface;
|
surface = placeholderSurface;
|
||||||
} else {
|
} else {
|
||||||
MediaCodecInfo codecInfo = getCodecInfo();
|
MediaCodecInfo codecInfo = getCodecInfo();
|
||||||
if (codecInfo != null && shouldUseDummySurface(codecInfo)) {
|
if (codecInfo != null && shouldUseDummySurface(codecInfo)) {
|
||||||
dummySurface = DummySurface.newInstanceV17(context, codecInfo.secure);
|
placeholderSurface = PlaceholderSurface.newInstanceV17(context, codecInfo.secure);
|
||||||
surface = dummySurface;
|
surface = placeholderSurface;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -652,7 +652,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
|
||||||
maybeInitCodecOrBypass();
|
maybeInitCodecOrBypass();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (surface != null && surface != dummySurface) {
|
if (surface != null && surface != placeholderSurface) {
|
||||||
// If we know the video size, report it again immediately.
|
// If we know the video size, report it again immediately.
|
||||||
maybeRenotifyVideoSizeChanged();
|
maybeRenotifyVideoSizeChanged();
|
||||||
// We haven't rendered to the new surface yet.
|
// We haven't rendered to the new surface yet.
|
||||||
|
|
@ -665,7 +665,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
|
||||||
clearReportedVideoSize();
|
clearReportedVideoSize();
|
||||||
clearRenderedFirstFrame();
|
clearRenderedFirstFrame();
|
||||||
}
|
}
|
||||||
} else if (surface != null && surface != dummySurface) {
|
} else if (surface != null && surface != placeholderSurface) {
|
||||||
// The surface is set and unchanged. If we know the video size and/or have already rendered to
|
// The surface is set and unchanged. If we know the video size and/or have already rendered to
|
||||||
// the surface, report these again immediately.
|
// the surface, report these again immediately.
|
||||||
maybeRenotifyVideoSizeChanged();
|
maybeRenotifyVideoSizeChanged();
|
||||||
|
|
@ -684,16 +684,16 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
|
||||||
return tunneling && Util.SDK_INT < 23;
|
return tunneling && Util.SDK_INT < 23;
|
||||||
}
|
}
|
||||||
|
|
||||||
@TargetApi(17) // Needed for dummySurface usage. dummySurface is always null on API level 16.
|
@TargetApi(17) // Needed for placeHolderSurface usage, as it is always null on API level 16.
|
||||||
@Override
|
@Override
|
||||||
protected MediaCodecAdapter.Configuration getMediaCodecConfiguration(
|
protected MediaCodecAdapter.Configuration getMediaCodecConfiguration(
|
||||||
MediaCodecInfo codecInfo,
|
MediaCodecInfo codecInfo,
|
||||||
Format format,
|
Format format,
|
||||||
@Nullable MediaCrypto crypto,
|
@Nullable MediaCrypto crypto,
|
||||||
float codecOperatingRate) {
|
float codecOperatingRate) {
|
||||||
if (dummySurface != null && dummySurface.secure != codecInfo.secure) {
|
if (placeholderSurface != null && placeholderSurface.secure != codecInfo.secure) {
|
||||||
// We can't re-use the current DummySurface instance with the new decoder.
|
// We can't re-use the current DummySurface instance with the new decoder.
|
||||||
releaseDummySurface();
|
releasePlaceholderSurface();
|
||||||
}
|
}
|
||||||
String codecMimeType = codecInfo.codecMimeType;
|
String codecMimeType = codecInfo.codecMimeType;
|
||||||
codecMaxValues = getCodecMaxValues(codecInfo, format, getStreamFormats());
|
codecMaxValues = getCodecMaxValues(codecInfo, format, getStreamFormats());
|
||||||
|
|
@ -709,10 +709,10 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
|
||||||
if (!shouldUseDummySurface(codecInfo)) {
|
if (!shouldUseDummySurface(codecInfo)) {
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
if (dummySurface == null) {
|
if (placeholderSurface == null) {
|
||||||
dummySurface = DummySurface.newInstanceV17(context, codecInfo.secure);
|
placeholderSurface = PlaceholderSurface.newInstanceV17(context, codecInfo.secure);
|
||||||
}
|
}
|
||||||
surface = dummySurface;
|
surface = placeholderSurface;
|
||||||
}
|
}
|
||||||
return MediaCodecAdapter.Configuration.createForVideoDecoding(
|
return MediaCodecAdapter.Configuration.createForVideoDecoding(
|
||||||
codecInfo, mediaFormat, format, surface, crypto);
|
codecInfo, mediaFormat, format, surface, crypto);
|
||||||
|
|
@ -949,7 +949,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
|
||||||
earlyUs -= elapsedRealtimeNowUs - elapsedRealtimeUs;
|
earlyUs -= elapsedRealtimeNowUs - elapsedRealtimeUs;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (surface == dummySurface) {
|
if (surface == placeholderSurface) {
|
||||||
// Skip frames in sync with playback, so we'll be at the right frame if the mode changes.
|
// Skip frames in sync with playback, so we'll be at the right frame if the mode changes.
|
||||||
if (isBufferLate(earlyUs)) {
|
if (isBufferLate(earlyUs)) {
|
||||||
skipOutputBuffer(codec, bufferIndex, presentationTimeUs);
|
skipOutputBuffer(codec, bufferIndex, presentationTimeUs);
|
||||||
|
|
@ -1259,16 +1259,16 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
|
||||||
return Util.SDK_INT >= 23
|
return Util.SDK_INT >= 23
|
||||||
&& !tunneling
|
&& !tunneling
|
||||||
&& !codecNeedsSetOutputSurfaceWorkaround(codecInfo.name)
|
&& !codecNeedsSetOutputSurfaceWorkaround(codecInfo.name)
|
||||||
&& (!codecInfo.secure || DummySurface.isSecureSupported(context));
|
&& (!codecInfo.secure || PlaceholderSurface.isSecureSupported(context));
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresApi(17)
|
@RequiresApi(17)
|
||||||
private void releaseDummySurface() {
|
private void releasePlaceholderSurface() {
|
||||||
if (surface == dummySurface) {
|
if (surface == placeholderSurface) {
|
||||||
surface = null;
|
surface = null;
|
||||||
}
|
}
|
||||||
dummySurface.release();
|
placeholderSurface.release();
|
||||||
dummySurface = null;
|
placeholderSurface = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setJoiningDeadlineMs() {
|
private void setJoiningDeadlineMs() {
|
||||||
|
|
|
||||||
|
|
@ -36,12 +36,12 @@ import androidx.media3.common.util.UnstableApi;
|
||||||
import androidx.media3.common.util.Util;
|
import androidx.media3.common.util.Util;
|
||||||
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||||
|
|
||||||
/** A dummy {@link Surface}. */
|
/** A placeholder {@link Surface}. */
|
||||||
@RequiresApi(17)
|
@RequiresApi(17)
|
||||||
@UnstableApi
|
@UnstableApi
|
||||||
public final class DummySurface extends Surface {
|
public final class PlaceholderSurface extends Surface {
|
||||||
|
|
||||||
private static final String TAG = "DummySurface";
|
private static final String TAG = "PlaceholderSurface";
|
||||||
|
|
||||||
/** Whether the surface is secure. */
|
/** Whether the surface is secure. */
|
||||||
public final boolean secure;
|
public final boolean secure;
|
||||||
|
|
@ -49,14 +49,14 @@ public final class DummySurface extends Surface {
|
||||||
private static @SecureMode int secureMode;
|
private static @SecureMode int secureMode;
|
||||||
private static boolean secureModeInitialized;
|
private static boolean secureModeInitialized;
|
||||||
|
|
||||||
private final DummySurfaceThread thread;
|
private final PlaceholderSurfaceThread thread;
|
||||||
private boolean threadReleased;
|
private boolean threadReleased;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the device supports secure dummy surfaces.
|
* Returns whether the device supports secure placeholder surfaces.
|
||||||
*
|
*
|
||||||
* @param context Any {@link Context}.
|
* @param context Any {@link Context}.
|
||||||
* @return Whether the device supports secure dummy surfaces.
|
* @return Whether the device supports secure placeholder surfaces.
|
||||||
*/
|
*/
|
||||||
public static synchronized boolean isSecureSupported(Context context) {
|
public static synchronized boolean isSecureSupported(Context context) {
|
||||||
if (!secureModeInitialized) {
|
if (!secureModeInitialized) {
|
||||||
|
|
@ -67,8 +67,8 @@ public final class DummySurface extends Surface {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a newly created dummy surface. The surface must be released by calling {@link #release}
|
* Returns a newly created placeholder surface. The surface must be released by calling {@link
|
||||||
* when it's no longer required.
|
* #release} when it's no longer required.
|
||||||
*
|
*
|
||||||
* <p>Must only be called if {@link Util#SDK_INT} is 17 or higher.
|
* <p>Must only be called if {@link Util#SDK_INT} is 17 or higher.
|
||||||
*
|
*
|
||||||
|
|
@ -78,13 +78,14 @@ public final class DummySurface extends Surface {
|
||||||
* @throws IllegalStateException If a secure surface is requested on a device for which {@link
|
* @throws IllegalStateException If a secure surface is requested on a device for which {@link
|
||||||
* #isSecureSupported(Context)} returns {@code false}.
|
* #isSecureSupported(Context)} returns {@code false}.
|
||||||
*/
|
*/
|
||||||
public static DummySurface newInstanceV17(Context context, boolean secure) {
|
public static PlaceholderSurface newInstanceV17(Context context, boolean secure) {
|
||||||
Assertions.checkState(!secure || isSecureSupported(context));
|
Assertions.checkState(!secure || isSecureSupported(context));
|
||||||
DummySurfaceThread thread = new DummySurfaceThread();
|
PlaceholderSurfaceThread thread = new PlaceholderSurfaceThread();
|
||||||
return thread.init(secure ? secureMode : SECURE_MODE_NONE);
|
return thread.init(secure ? secureMode : SECURE_MODE_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private DummySurface(DummySurfaceThread thread, SurfaceTexture surfaceTexture, boolean secure) {
|
private PlaceholderSurface(
|
||||||
|
PlaceholderSurfaceThread thread, SurfaceTexture surfaceTexture, boolean secure) {
|
||||||
super(surfaceTexture);
|
super(surfaceTexture);
|
||||||
this.thread = thread;
|
this.thread = thread;
|
||||||
this.secure = secure;
|
this.secure = secure;
|
||||||
|
|
@ -121,7 +122,7 @@ public final class DummySurface extends Surface {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class DummySurfaceThread extends HandlerThread implements Handler.Callback {
|
private static class PlaceholderSurfaceThread extends HandlerThread implements Handler.Callback {
|
||||||
|
|
||||||
private static final int MSG_INIT = 1;
|
private static final int MSG_INIT = 1;
|
||||||
private static final int MSG_RELEASE = 2;
|
private static final int MSG_RELEASE = 2;
|
||||||
|
|
@ -130,13 +131,13 @@ public final class DummySurface extends Surface {
|
||||||
private @MonotonicNonNull Handler handler;
|
private @MonotonicNonNull Handler handler;
|
||||||
@Nullable private Error initError;
|
@Nullable private Error initError;
|
||||||
@Nullable private RuntimeException initException;
|
@Nullable private RuntimeException initException;
|
||||||
@Nullable private DummySurface surface;
|
@Nullable private PlaceholderSurface surface;
|
||||||
|
|
||||||
public DummySurfaceThread() {
|
public PlaceholderSurfaceThread() {
|
||||||
super("ExoPlayer:DummySurface");
|
super("ExoPlayer:PlaceholderSurface");
|
||||||
}
|
}
|
||||||
|
|
||||||
public DummySurface init(@SecureMode int secureMode) {
|
public PlaceholderSurface init(@SecureMode int secureMode) {
|
||||||
start();
|
start();
|
||||||
handler = new Handler(getLooper(), /* callback= */ this);
|
handler = new Handler(getLooper(), /* callback= */ this);
|
||||||
eglSurfaceTexture = new EGLSurfaceTexture(handler);
|
eglSurfaceTexture = new EGLSurfaceTexture(handler);
|
||||||
|
|
@ -176,10 +177,10 @@ public final class DummySurface extends Surface {
|
||||||
try {
|
try {
|
||||||
initInternal(/* secureMode= */ msg.arg1);
|
initInternal(/* secureMode= */ msg.arg1);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
Log.e(TAG, "Failed to initialize dummy surface", e);
|
Log.e(TAG, "Failed to initialize placeholder surface", e);
|
||||||
initException = e;
|
initException = e;
|
||||||
} catch (Error e) {
|
} catch (Error e) {
|
||||||
Log.e(TAG, "Failed to initialize dummy surface", e);
|
Log.e(TAG, "Failed to initialize placeholder surface", e);
|
||||||
initError = e;
|
initError = e;
|
||||||
} finally {
|
} finally {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
|
|
@ -191,7 +192,7 @@ public final class DummySurface extends Surface {
|
||||||
try {
|
try {
|
||||||
releaseInternal();
|
releaseInternal();
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Log.e(TAG, "Failed to release dummy surface", e);
|
Log.e(TAG, "Failed to release placeholder surface", e);
|
||||||
} finally {
|
} finally {
|
||||||
quit();
|
quit();
|
||||||
}
|
}
|
||||||
|
|
@ -205,7 +206,7 @@ public final class DummySurface extends Surface {
|
||||||
Assertions.checkNotNull(eglSurfaceTexture);
|
Assertions.checkNotNull(eglSurfaceTexture);
|
||||||
eglSurfaceTexture.init(secureMode);
|
eglSurfaceTexture.init(secureMode);
|
||||||
this.surface =
|
this.surface =
|
||||||
new DummySurface(
|
new PlaceholderSurface(
|
||||||
this, eglSurfaceTexture.getSurfaceTexture(), secureMode != SECURE_MODE_NONE);
|
this, eglSurfaceTexture.getSurfaceTexture(), secureMode != SECURE_MODE_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -168,7 +168,7 @@ public final class VideoFrameReleaseHelper {
|
||||||
* @param surface The new {@link Surface}, or {@code null} if the renderer does not have one.
|
* @param surface The new {@link Surface}, or {@code null} if the renderer does not have one.
|
||||||
*/
|
*/
|
||||||
public void onSurfaceChanged(@Nullable Surface surface) {
|
public void onSurfaceChanged(@Nullable Surface surface) {
|
||||||
if (surface instanceof DummySurface) {
|
if (surface instanceof PlaceholderSurface) {
|
||||||
// We don't care about dummy surfaces for release timing, since they're not visible.
|
// We don't care about dummy surfaces for release timing, since they're not visible.
|
||||||
surface = null;
|
surface = null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ package androidx.media3.exoplayer.offline;
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import androidx.media3.datasource.DummyDataSource;
|
import androidx.media3.datasource.PlaceholderDataSource;
|
||||||
import androidx.media3.datasource.cache.Cache;
|
import androidx.media3.datasource.cache.Cache;
|
||||||
import androidx.media3.datasource.cache.CacheDataSource;
|
import androidx.media3.datasource.cache.CacheDataSource;
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||||
|
|
@ -35,7 +35,7 @@ public final class DefaultDownloaderFactoryTest {
|
||||||
CacheDataSource.Factory cacheDataSourceFactory =
|
CacheDataSource.Factory cacheDataSourceFactory =
|
||||||
new CacheDataSource.Factory()
|
new CacheDataSource.Factory()
|
||||||
.setCache(Mockito.mock(Cache.class))
|
.setCache(Mockito.mock(Cache.class))
|
||||||
.setUpstreamDataSourceFactory(DummyDataSource.FACTORY);
|
.setUpstreamDataSourceFactory(PlaceholderDataSource.FACTORY);
|
||||||
DownloaderFactory factory =
|
DownloaderFactory factory =
|
||||||
new DefaultDownloaderFactory(cacheDataSourceFactory, /* executor= */ Runnable::run);
|
new DefaultDownloaderFactory(cacheDataSourceFactory, /* executor= */ Runnable::run);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ import androidx.media3.common.DrmInitData;
|
||||||
import androidx.media3.common.DrmInitData.SchemeData;
|
import androidx.media3.common.DrmInitData.SchemeData;
|
||||||
import androidx.media3.common.Format;
|
import androidx.media3.common.Format;
|
||||||
import androidx.media3.common.MimeTypes;
|
import androidx.media3.common.MimeTypes;
|
||||||
import androidx.media3.datasource.DummyDataSource;
|
import androidx.media3.datasource.PlaceholderDataSource;
|
||||||
import androidx.media3.exoplayer.dash.manifest.AdaptationSet;
|
import androidx.media3.exoplayer.dash.manifest.AdaptationSet;
|
||||||
import androidx.media3.exoplayer.dash.manifest.BaseUrl;
|
import androidx.media3.exoplayer.dash.manifest.BaseUrl;
|
||||||
import androidx.media3.exoplayer.dash.manifest.Period;
|
import androidx.media3.exoplayer.dash.manifest.Period;
|
||||||
|
|
@ -43,28 +43,28 @@ public final class DashUtilTest {
|
||||||
@Test
|
@Test
|
||||||
public void loadDrmInitDataFromManifest() throws Exception {
|
public void loadDrmInitDataFromManifest() throws Exception {
|
||||||
Period period = newPeriod(newAdaptationSet(newRepresentation(newDrmInitData())));
|
Period period = newPeriod(newAdaptationSet(newRepresentation(newDrmInitData())));
|
||||||
Format format = DashUtil.loadFormatWithDrmInitData(DummyDataSource.INSTANCE, period);
|
Format format = DashUtil.loadFormatWithDrmInitData(PlaceholderDataSource.INSTANCE, period);
|
||||||
assertThat(format.drmInitData).isEqualTo(newDrmInitData());
|
assertThat(format.drmInitData).isEqualTo(newDrmInitData());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void loadDrmInitDataMissing() throws Exception {
|
public void loadDrmInitDataMissing() throws Exception {
|
||||||
Period period = newPeriod(newAdaptationSet(newRepresentation(null /* no init data */)));
|
Period period = newPeriod(newAdaptationSet(newRepresentation(null /* no init data */)));
|
||||||
Format format = DashUtil.loadFormatWithDrmInitData(DummyDataSource.INSTANCE, period);
|
Format format = DashUtil.loadFormatWithDrmInitData(PlaceholderDataSource.INSTANCE, period);
|
||||||
assertThat(format.drmInitData).isNull();
|
assertThat(format.drmInitData).isNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void loadDrmInitDataNoRepresentations() throws Exception {
|
public void loadDrmInitDataNoRepresentations() throws Exception {
|
||||||
Period period = newPeriod(newAdaptationSet(/* no representation */ ));
|
Period period = newPeriod(newAdaptationSet(/* no representation */ ));
|
||||||
Format format = DashUtil.loadFormatWithDrmInitData(DummyDataSource.INSTANCE, period);
|
Format format = DashUtil.loadFormatWithDrmInitData(PlaceholderDataSource.INSTANCE, period);
|
||||||
assertThat(format).isNull();
|
assertThat(format).isNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void loadDrmInitDataNoAdaptationSets() throws Exception {
|
public void loadDrmInitDataNoAdaptationSets() throws Exception {
|
||||||
Period period = newPeriod(/* no adaptation set */ );
|
Period period = newPeriod(/* no adaptation set */ );
|
||||||
Format format = DashUtil.loadFormatWithDrmInitData(DummyDataSource.INSTANCE, period);
|
Format format = DashUtil.loadFormatWithDrmInitData(PlaceholderDataSource.INSTANCE, period);
|
||||||
assertThat(format).isNull();
|
assertThat(format).isNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ import androidx.media3.common.MimeTypes;
|
||||||
import androidx.media3.common.StreamKey;
|
import androidx.media3.common.StreamKey;
|
||||||
import androidx.media3.common.util.Util;
|
import androidx.media3.common.util.Util;
|
||||||
import androidx.media3.datasource.DataSpec;
|
import androidx.media3.datasource.DataSpec;
|
||||||
import androidx.media3.datasource.DummyDataSource;
|
import androidx.media3.datasource.PlaceholderDataSource;
|
||||||
import androidx.media3.datasource.cache.Cache;
|
import androidx.media3.datasource.cache.Cache;
|
||||||
import androidx.media3.datasource.cache.CacheDataSource;
|
import androidx.media3.datasource.cache.CacheDataSource;
|
||||||
import androidx.media3.datasource.cache.NoOpCacheEvictor;
|
import androidx.media3.datasource.cache.NoOpCacheEvictor;
|
||||||
|
|
@ -86,7 +86,7 @@ public class DashDownloaderTest {
|
||||||
CacheDataSource.Factory cacheDataSourceFactory =
|
CacheDataSource.Factory cacheDataSourceFactory =
|
||||||
new CacheDataSource.Factory()
|
new CacheDataSource.Factory()
|
||||||
.setCache(Mockito.mock(Cache.class))
|
.setCache(Mockito.mock(Cache.class))
|
||||||
.setUpstreamDataSourceFactory(DummyDataSource.FACTORY);
|
.setUpstreamDataSourceFactory(PlaceholderDataSource.FACTORY);
|
||||||
DownloaderFactory factory =
|
DownloaderFactory factory =
|
||||||
new DefaultDownloaderFactory(cacheDataSourceFactory, /* executor= */ Runnable::run);
|
new DefaultDownloaderFactory(cacheDataSourceFactory, /* executor= */ Runnable::run);
|
||||||
|
|
||||||
|
|
@ -96,7 +96,7 @@ public class DashDownloaderTest {
|
||||||
.setMimeType(MimeTypes.APPLICATION_MPD)
|
.setMimeType(MimeTypes.APPLICATION_MPD)
|
||||||
.setStreamKeys(
|
.setStreamKeys(
|
||||||
Collections.singletonList(
|
Collections.singletonList(
|
||||||
new StreamKey(/* groupIndex= */ 0, /* trackIndex= */ 0)))
|
new StreamKey(/* groupIndex= */ 0, /* streamIndex= */ 0)))
|
||||||
.build());
|
.build());
|
||||||
assertThat(downloader).isInstanceOf(DashDownloader.class);
|
assertThat(downloader).isInstanceOf(DashDownloader.class);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ import androidx.media3.common.MediaItem;
|
||||||
import androidx.media3.common.MimeTypes;
|
import androidx.media3.common.MimeTypes;
|
||||||
import androidx.media3.common.StreamKey;
|
import androidx.media3.common.StreamKey;
|
||||||
import androidx.media3.common.util.Util;
|
import androidx.media3.common.util.Util;
|
||||||
import androidx.media3.datasource.DummyDataSource;
|
import androidx.media3.datasource.PlaceholderDataSource;
|
||||||
import androidx.media3.datasource.cache.Cache;
|
import androidx.media3.datasource.cache.Cache;
|
||||||
import androidx.media3.datasource.cache.CacheDataSource;
|
import androidx.media3.datasource.cache.CacheDataSource;
|
||||||
import androidx.media3.datasource.cache.NoOpCacheEvictor;
|
import androidx.media3.datasource.cache.NoOpCacheEvictor;
|
||||||
|
|
@ -104,7 +104,7 @@ public class HlsDownloaderTest {
|
||||||
CacheDataSource.Factory cacheDataSourceFactory =
|
CacheDataSource.Factory cacheDataSourceFactory =
|
||||||
new CacheDataSource.Factory()
|
new CacheDataSource.Factory()
|
||||||
.setCache(Mockito.mock(Cache.class))
|
.setCache(Mockito.mock(Cache.class))
|
||||||
.setUpstreamDataSourceFactory(DummyDataSource.FACTORY);
|
.setUpstreamDataSourceFactory(PlaceholderDataSource.FACTORY);
|
||||||
DownloaderFactory factory =
|
DownloaderFactory factory =
|
||||||
new DefaultDownloaderFactory(cacheDataSourceFactory, /* executor= */ Runnable::run);
|
new DefaultDownloaderFactory(cacheDataSourceFactory, /* executor= */ Runnable::run);
|
||||||
|
|
||||||
|
|
@ -114,7 +114,7 @@ public class HlsDownloaderTest {
|
||||||
.setMimeType(MimeTypes.APPLICATION_M3U8)
|
.setMimeType(MimeTypes.APPLICATION_M3U8)
|
||||||
.setStreamKeys(
|
.setStreamKeys(
|
||||||
Collections.singletonList(
|
Collections.singletonList(
|
||||||
new StreamKey(/* groupIndex= */ 0, /* trackIndex= */ 0)))
|
new StreamKey(/* groupIndex= */ 0, /* streamIndex= */ 0)))
|
||||||
.build());
|
.build());
|
||||||
assertThat(downloader).isInstanceOf(HlsDownloader.class);
|
assertThat(downloader).isInstanceOf(HlsDownloader.class);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ import static com.google.common.truth.Truth.assertThat;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import androidx.media3.common.MimeTypes;
|
import androidx.media3.common.MimeTypes;
|
||||||
import androidx.media3.common.StreamKey;
|
import androidx.media3.common.StreamKey;
|
||||||
import androidx.media3.datasource.DummyDataSource;
|
import androidx.media3.datasource.PlaceholderDataSource;
|
||||||
import androidx.media3.datasource.cache.Cache;
|
import androidx.media3.datasource.cache.Cache;
|
||||||
import androidx.media3.datasource.cache.CacheDataSource;
|
import androidx.media3.datasource.cache.CacheDataSource;
|
||||||
import androidx.media3.exoplayer.offline.DefaultDownloaderFactory;
|
import androidx.media3.exoplayer.offline.DefaultDownloaderFactory;
|
||||||
|
|
@ -42,7 +42,7 @@ public final class SsDownloaderTest {
|
||||||
CacheDataSource.Factory cacheDataSourceFactory =
|
CacheDataSource.Factory cacheDataSourceFactory =
|
||||||
new CacheDataSource.Factory()
|
new CacheDataSource.Factory()
|
||||||
.setCache(Mockito.mock(Cache.class))
|
.setCache(Mockito.mock(Cache.class))
|
||||||
.setUpstreamDataSourceFactory(DummyDataSource.FACTORY);
|
.setUpstreamDataSourceFactory(PlaceholderDataSource.FACTORY);
|
||||||
DownloaderFactory factory =
|
DownloaderFactory factory =
|
||||||
new DefaultDownloaderFactory(cacheDataSourceFactory, /* executor= */ Runnable::run);
|
new DefaultDownloaderFactory(cacheDataSourceFactory, /* executor= */ Runnable::run);
|
||||||
|
|
||||||
|
|
@ -52,7 +52,7 @@ public final class SsDownloaderTest {
|
||||||
.setMimeType(MimeTypes.APPLICATION_SS)
|
.setMimeType(MimeTypes.APPLICATION_SS)
|
||||||
.setStreamKeys(
|
.setStreamKeys(
|
||||||
Collections.singletonList(
|
Collections.singletonList(
|
||||||
new StreamKey(/* groupIndex= */ 0, /* trackIndex= */ 0)))
|
new StreamKey(/* groupIndex= */ 0, /* streamIndex= */ 0)))
|
||||||
.build());
|
.build());
|
||||||
assertThat(downloader).isInstanceOf(SsDownloader.class);
|
assertThat(downloader).isInstanceOf(SsDownloader.class);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ import androidx.media3.datasource.DataSource;
|
||||||
import androidx.media3.datasource.DataSourceInputStream;
|
import androidx.media3.datasource.DataSourceInputStream;
|
||||||
import androidx.media3.datasource.DataSourceUtil;
|
import androidx.media3.datasource.DataSourceUtil;
|
||||||
import androidx.media3.datasource.DataSpec;
|
import androidx.media3.datasource.DataSpec;
|
||||||
import androidx.media3.datasource.DummyDataSource;
|
import androidx.media3.datasource.PlaceholderDataSource;
|
||||||
import androidx.media3.datasource.cache.Cache;
|
import androidx.media3.datasource.cache.Cache;
|
||||||
import androidx.media3.datasource.cache.CacheDataSource;
|
import androidx.media3.datasource.cache.CacheDataSource;
|
||||||
import androidx.media3.test.utils.FakeDataSet.FakeData;
|
import androidx.media3.test.utils.FakeDataSet.FakeData;
|
||||||
|
|
@ -129,7 +129,7 @@ public final class CacheAsserts {
|
||||||
*/
|
*/
|
||||||
public static void assertDataCached(Cache cache, DataSpec dataSpec, byte[] expected)
|
public static void assertDataCached(Cache cache, DataSpec dataSpec, byte[] expected)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
DataSource dataSource = new CacheDataSource(cache, DummyDataSource.INSTANCE, 0);
|
DataSource dataSource = new CacheDataSource(cache, PlaceholderDataSource.INSTANCE, 0);
|
||||||
byte[] bytes;
|
byte[] bytes;
|
||||||
try {
|
try {
|
||||||
dataSource.open(dataSpec);
|
dataSource.open(dataSpec);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue