Commit 33373d0d by hschlueter Committed by Ian Baker

Fix non-inclusive language in class names.

https://source.android.com/setup/contribute/respectful-code#term-examples

PiperOrigin-RevId: 438335305
parent 8038a53a
...@@ -126,7 +126,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer { ...@@ -126,7 +126,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;
...@@ -512,7 +512,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer { ...@@ -512,7 +512,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.
...@@ -564,14 +564,14 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer { ...@@ -564,14 +564,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();
} }
} }
} }
...@@ -621,14 +621,14 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer { ...@@ -621,14 +621,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;
} }
} }
} }
...@@ -649,7 +649,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer { ...@@ -649,7 +649,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.
...@@ -662,7 +662,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer { ...@@ -662,7 +662,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();
...@@ -681,16 +681,16 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer { ...@@ -681,16 +681,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());
...@@ -706,10 +706,10 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer { ...@@ -706,10 +706,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);
...@@ -946,7 +946,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer { ...@@ -946,7 +946,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);
...@@ -1256,16 +1256,16 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer { ...@@ -1256,16 +1256,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() {
......
...@@ -35,11 +35,11 @@ import com.google.android.exoplayer2.util.Log; ...@@ -35,11 +35,11 @@ import com.google.android.exoplayer2.util.Log;
import com.google.android.exoplayer2.util.Util; import com.google.android.exoplayer2.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)
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;
...@@ -47,14 +47,14 @@ public final class DummySurface extends Surface { ...@@ -47,14 +47,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) {
...@@ -65,8 +65,8 @@ public final class DummySurface extends Surface { ...@@ -65,8 +65,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.
* *
...@@ -76,13 +76,14 @@ public final class DummySurface extends Surface { ...@@ -76,13 +76,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;
...@@ -119,7 +120,7 @@ public final class DummySurface extends Surface { ...@@ -119,7 +120,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;
...@@ -128,13 +129,13 @@ public final class DummySurface extends Surface { ...@@ -128,13 +129,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);
...@@ -174,10 +175,10 @@ public final class DummySurface extends Surface { ...@@ -174,10 +175,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) {
...@@ -189,7 +190,7 @@ public final class DummySurface extends Surface { ...@@ -189,7 +190,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();
} }
...@@ -203,7 +204,7 @@ public final class DummySurface extends Surface { ...@@ -203,7 +204,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);
} }
......
...@@ -166,7 +166,7 @@ public final class VideoFrameReleaseHelper { ...@@ -166,7 +166,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;
} }
......
...@@ -19,7 +19,7 @@ import static com.google.common.truth.Truth.assertThat; ...@@ -19,7 +19,7 @@ import static com.google.common.truth.Truth.assertThat;
import android.net.Uri; import android.net.Uri;
import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.google.android.exoplayer2.upstream.DummyDataSource; import com.google.android.exoplayer2.upstream.PlaceholderDataSource;
import com.google.android.exoplayer2.upstream.cache.Cache; import com.google.android.exoplayer2.upstream.cache.Cache;
import com.google.android.exoplayer2.upstream.cache.CacheDataSource; import com.google.android.exoplayer2.upstream.cache.CacheDataSource;
import org.junit.Test; import org.junit.Test;
...@@ -35,7 +35,7 @@ public final class DefaultDownloaderFactoryTest { ...@@ -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);
......
...@@ -28,7 +28,7 @@ import com.google.android.exoplayer2.source.dash.manifest.Period; ...@@ -28,7 +28,7 @@ import com.google.android.exoplayer2.source.dash.manifest.Period;
import com.google.android.exoplayer2.source.dash.manifest.RangedUri; import com.google.android.exoplayer2.source.dash.manifest.RangedUri;
import com.google.android.exoplayer2.source.dash.manifest.Representation; import com.google.android.exoplayer2.source.dash.manifest.Representation;
import com.google.android.exoplayer2.source.dash.manifest.SegmentBase.SingleSegmentBase; import com.google.android.exoplayer2.source.dash.manifest.SegmentBase.SingleSegmentBase;
import com.google.android.exoplayer2.upstream.DummyDataSource; import com.google.android.exoplayer2.upstream.PlaceholderDataSource;
import com.google.android.exoplayer2.util.MimeTypes; import com.google.android.exoplayer2.util.MimeTypes;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import java.util.Arrays; import java.util.Arrays;
...@@ -43,28 +43,28 @@ public final class DashUtilTest { ...@@ -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();
} }
......
...@@ -40,7 +40,7 @@ import com.google.android.exoplayer2.testutil.FakeDataSet; ...@@ -40,7 +40,7 @@ import com.google.android.exoplayer2.testutil.FakeDataSet;
import com.google.android.exoplayer2.testutil.FakeDataSource; import com.google.android.exoplayer2.testutil.FakeDataSource;
import com.google.android.exoplayer2.testutil.TestUtil; import com.google.android.exoplayer2.testutil.TestUtil;
import com.google.android.exoplayer2.upstream.DataSpec; import com.google.android.exoplayer2.upstream.DataSpec;
import com.google.android.exoplayer2.upstream.DummyDataSource; import com.google.android.exoplayer2.upstream.PlaceholderDataSource;
import com.google.android.exoplayer2.upstream.cache.Cache; import com.google.android.exoplayer2.upstream.cache.Cache;
import com.google.android.exoplayer2.upstream.cache.CacheDataSource; import com.google.android.exoplayer2.upstream.cache.CacheDataSource;
import com.google.android.exoplayer2.upstream.cache.NoOpCacheEvictor; import com.google.android.exoplayer2.upstream.cache.NoOpCacheEvictor;
...@@ -86,7 +86,7 @@ public class DashDownloaderTest { ...@@ -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 { ...@@ -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);
} }
......
...@@ -20,14 +20,14 @@ import androidx.annotation.Nullable; ...@@ -20,14 +20,14 @@ import androidx.annotation.Nullable;
import java.io.IOException; 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}. */
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) {
...@@ -36,7 +36,7 @@ public final class DummyDataSource implements DataSource { ...@@ -36,7 +36,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
......
...@@ -33,8 +33,8 @@ import com.google.android.exoplayer2.upstream.DataSink; ...@@ -33,8 +33,8 @@ import com.google.android.exoplayer2.upstream.DataSink;
import com.google.android.exoplayer2.upstream.DataSource; import com.google.android.exoplayer2.upstream.DataSource;
import com.google.android.exoplayer2.upstream.DataSourceException; import com.google.android.exoplayer2.upstream.DataSourceException;
import com.google.android.exoplayer2.upstream.DataSpec; import com.google.android.exoplayer2.upstream.DataSpec;
import com.google.android.exoplayer2.upstream.DummyDataSource;
import com.google.android.exoplayer2.upstream.FileDataSource; import com.google.android.exoplayer2.upstream.FileDataSource;
import com.google.android.exoplayer2.upstream.PlaceholderDataSource;
import com.google.android.exoplayer2.upstream.PriorityDataSource; import com.google.android.exoplayer2.upstream.PriorityDataSource;
import com.google.android.exoplayer2.upstream.TeeDataSource; import com.google.android.exoplayer2.upstream.TeeDataSource;
import com.google.android.exoplayer2.upstream.TransferListener; import com.google.android.exoplayer2.upstream.TransferListener;
...@@ -539,7 +539,7 @@ public final class CacheDataSource implements DataSource { ...@@ -539,7 +539,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;
......
...@@ -48,7 +48,7 @@ import com.google.android.exoplayer2.testutil.CacheAsserts; ...@@ -48,7 +48,7 @@ import com.google.android.exoplayer2.testutil.CacheAsserts;
import com.google.android.exoplayer2.testutil.FakeDataSet; import com.google.android.exoplayer2.testutil.FakeDataSet;
import com.google.android.exoplayer2.testutil.FakeDataSource; import com.google.android.exoplayer2.testutil.FakeDataSource;
import com.google.android.exoplayer2.testutil.TestUtil; import com.google.android.exoplayer2.testutil.TestUtil;
import com.google.android.exoplayer2.upstream.DummyDataSource; import com.google.android.exoplayer2.upstream.PlaceholderDataSource;
import com.google.android.exoplayer2.upstream.cache.Cache; import com.google.android.exoplayer2.upstream.cache.Cache;
import com.google.android.exoplayer2.upstream.cache.CacheDataSource; import com.google.android.exoplayer2.upstream.cache.CacheDataSource;
import com.google.android.exoplayer2.upstream.cache.NoOpCacheEvictor; import com.google.android.exoplayer2.upstream.cache.NoOpCacheEvictor;
...@@ -104,7 +104,7 @@ public class HlsDownloaderTest { ...@@ -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 { ...@@ -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);
} }
......
...@@ -24,7 +24,7 @@ import com.google.android.exoplayer2.offline.DownloadRequest; ...@@ -24,7 +24,7 @@ import com.google.android.exoplayer2.offline.DownloadRequest;
import com.google.android.exoplayer2.offline.Downloader; import com.google.android.exoplayer2.offline.Downloader;
import com.google.android.exoplayer2.offline.DownloaderFactory; import com.google.android.exoplayer2.offline.DownloaderFactory;
import com.google.android.exoplayer2.offline.StreamKey; import com.google.android.exoplayer2.offline.StreamKey;
import com.google.android.exoplayer2.upstream.DummyDataSource; import com.google.android.exoplayer2.upstream.PlaceholderDataSource;
import com.google.android.exoplayer2.upstream.cache.Cache; import com.google.android.exoplayer2.upstream.cache.Cache;
import com.google.android.exoplayer2.upstream.cache.CacheDataSource; import com.google.android.exoplayer2.upstream.cache.CacheDataSource;
import com.google.android.exoplayer2.util.MimeTypes; import com.google.android.exoplayer2.util.MimeTypes;
...@@ -42,7 +42,7 @@ public final class SsDownloaderTest { ...@@ -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 { ...@@ -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);
} }
......
...@@ -24,7 +24,7 @@ import com.google.android.exoplayer2.upstream.DataSource; ...@@ -24,7 +24,7 @@ import com.google.android.exoplayer2.upstream.DataSource;
import com.google.android.exoplayer2.upstream.DataSourceInputStream; import com.google.android.exoplayer2.upstream.DataSourceInputStream;
import com.google.android.exoplayer2.upstream.DataSourceUtil; import com.google.android.exoplayer2.upstream.DataSourceUtil;
import com.google.android.exoplayer2.upstream.DataSpec; import com.google.android.exoplayer2.upstream.DataSpec;
import com.google.android.exoplayer2.upstream.DummyDataSource; import com.google.android.exoplayer2.upstream.PlaceholderDataSource;
import com.google.android.exoplayer2.upstream.cache.Cache; import com.google.android.exoplayer2.upstream.cache.Cache;
import com.google.android.exoplayer2.upstream.cache.CacheDataSource; import com.google.android.exoplayer2.upstream.cache.CacheDataSource;
import com.google.android.exoplayer2.util.Assertions; import com.google.android.exoplayer2.util.Assertions;
...@@ -127,7 +127,7 @@ public final class CacheAsserts { ...@@ -127,7 +127,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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment