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 {
private boolean codecHandlesHdr10PlusOutOfBandMetadata;
@Nullable private Surface surface;
@Nullable private DummySurface dummySurface;
@Nullable private PlaceholderSurface placeholderSurface;
private boolean haveReportedFirstFrameRenderedForCurrentSurface;
private @C.VideoScalingMode int scalingMode;
private boolean renderedFirstFrameAfterReset;
......@@ -512,7 +512,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
public boolean isReady() {
if (super.isReady()
&& (renderedFirstFrameAfterReset
|| (dummySurface != null && surface == dummySurface)
|| (placeholderSurface != null && surface == placeholderSurface)
|| getCodec() == null
|| tunneling)) {
// Ready. If we were joining then we've now joined, so clear the joining deadline.
......@@ -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
protected void onReset() {
try {
super.onReset();
} finally {
if (dummySurface != null) {
releaseDummySurface();
if (placeholderSurface != null) {
releasePlaceholderSurface();
}
}
}
......@@ -621,14 +621,14 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
@Nullable Surface surface = output instanceof Surface ? (Surface) output : null;
if (surface == null) {
// Use a dummy surface if possible.
if (dummySurface != null) {
surface = dummySurface;
// Use a placeholder surface if possible.
if (placeholderSurface != null) {
surface = placeholderSurface;
} else {
MediaCodecInfo codecInfo = getCodecInfo();
if (codecInfo != null && shouldUseDummySurface(codecInfo)) {
dummySurface = DummySurface.newInstanceV17(context, codecInfo.secure);
surface = dummySurface;
placeholderSurface = PlaceholderSurface.newInstanceV17(context, codecInfo.secure);
surface = placeholderSurface;
}
}
}
......@@ -649,7 +649,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
maybeInitCodecOrBypass();
}
}
if (surface != null && surface != dummySurface) {
if (surface != null && surface != placeholderSurface) {
// If we know the video size, report it again immediately.
maybeRenotifyVideoSizeChanged();
// We haven't rendered to the new surface yet.
......@@ -662,7 +662,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
clearReportedVideoSize();
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, report these again immediately.
maybeRenotifyVideoSizeChanged();
......@@ -681,16 +681,16 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
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
protected MediaCodecAdapter.Configuration getMediaCodecConfiguration(
MediaCodecInfo codecInfo,
Format format,
@Nullable MediaCrypto crypto,
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.
releaseDummySurface();
releasePlaceholderSurface();
}
String codecMimeType = codecInfo.codecMimeType;
codecMaxValues = getCodecMaxValues(codecInfo, format, getStreamFormats());
......@@ -706,10 +706,10 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
if (!shouldUseDummySurface(codecInfo)) {
throw new IllegalStateException();
}
if (dummySurface == null) {
dummySurface = DummySurface.newInstanceV17(context, codecInfo.secure);
if (placeholderSurface == null) {
placeholderSurface = PlaceholderSurface.newInstanceV17(context, codecInfo.secure);
}
surface = dummySurface;
surface = placeholderSurface;
}
return MediaCodecAdapter.Configuration.createForVideoDecoding(
codecInfo, mediaFormat, format, surface, crypto);
......@@ -946,7 +946,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
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.
if (isBufferLate(earlyUs)) {
skipOutputBuffer(codec, bufferIndex, presentationTimeUs);
......@@ -1256,16 +1256,16 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
return Util.SDK_INT >= 23
&& !tunneling
&& !codecNeedsSetOutputSurfaceWorkaround(codecInfo.name)
&& (!codecInfo.secure || DummySurface.isSecureSupported(context));
&& (!codecInfo.secure || PlaceholderSurface.isSecureSupported(context));
}
@RequiresApi(17)
private void releaseDummySurface() {
if (surface == dummySurface) {
private void releasePlaceholderSurface() {
if (surface == placeholderSurface) {
surface = null;
}
dummySurface.release();
dummySurface = null;
placeholderSurface.release();
placeholderSurface = null;
}
private void setJoiningDeadlineMs() {
......
......@@ -35,11 +35,11 @@ import com.google.android.exoplayer2.util.Log;
import com.google.android.exoplayer2.util.Util;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
/** A dummy {@link Surface}. */
/** A placeholder {@link Surface}. */
@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. */
public final boolean secure;
......@@ -47,14 +47,14 @@ public final class DummySurface extends Surface {
private static @SecureMode int secureMode;
private static boolean secureModeInitialized;
private final DummySurfaceThread thread;
private final PlaceholderSurfaceThread thread;
private boolean threadReleased;
/**
* Returns whether the device supports secure dummy surfaces.
* Returns whether the device supports secure placeholder surfaces.
*
* @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) {
if (!secureModeInitialized) {
......@@ -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}
* when it's no longer required.
* Returns a newly created placeholder surface. The surface must be released by calling {@link
* #release} when it's no longer required.
*
* <p>Must only be called if {@link Util#SDK_INT} is 17 or higher.
*
......@@ -76,13 +76,14 @@ public final class DummySurface extends Surface {
* @throws IllegalStateException If a secure surface is requested on a device for which {@link
* #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));
DummySurfaceThread thread = new DummySurfaceThread();
PlaceholderSurfaceThread thread = new PlaceholderSurfaceThread();
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);
this.thread = thread;
this.secure = secure;
......@@ -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_RELEASE = 2;
......@@ -128,13 +129,13 @@ public final class DummySurface extends Surface {
private @MonotonicNonNull Handler handler;
@Nullable private Error initError;
@Nullable private RuntimeException initException;
@Nullable private DummySurface surface;
@Nullable private PlaceholderSurface surface;
public DummySurfaceThread() {
super("ExoPlayer:DummySurface");
public PlaceholderSurfaceThread() {
super("ExoPlayer:PlaceholderSurface");
}
public DummySurface init(@SecureMode int secureMode) {
public PlaceholderSurface init(@SecureMode int secureMode) {
start();
handler = new Handler(getLooper(), /* callback= */ this);
eglSurfaceTexture = new EGLSurfaceTexture(handler);
......@@ -174,10 +175,10 @@ public final class DummySurface extends Surface {
try {
initInternal(/* secureMode= */ msg.arg1);
} catch (RuntimeException e) {
Log.e(TAG, "Failed to initialize dummy surface", e);
Log.e(TAG, "Failed to initialize placeholder surface", e);
initException = e;
} catch (Error e) {
Log.e(TAG, "Failed to initialize dummy surface", e);
Log.e(TAG, "Failed to initialize placeholder surface", e);
initError = e;
} finally {
synchronized (this) {
......@@ -189,7 +190,7 @@ public final class DummySurface extends Surface {
try {
releaseInternal();
} catch (Throwable e) {
Log.e(TAG, "Failed to release dummy surface", e);
Log.e(TAG, "Failed to release placeholder surface", e);
} finally {
quit();
}
......@@ -203,7 +204,7 @@ public final class DummySurface extends Surface {
Assertions.checkNotNull(eglSurfaceTexture);
eglSurfaceTexture.init(secureMode);
this.surface =
new DummySurface(
new PlaceholderSurface(
this, eglSurfaceTexture.getSurfaceTexture(), secureMode != SECURE_MODE_NONE);
}
......
......@@ -166,7 +166,7 @@ public final class VideoFrameReleaseHelper {
* @param surface The new {@link Surface}, or {@code null} if the renderer does not have one.
*/
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.
surface = null;
}
......
......@@ -19,7 +19,7 @@ import static com.google.common.truth.Truth.assertThat;
import android.net.Uri;
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.CacheDataSource;
import org.junit.Test;
......@@ -35,7 +35,7 @@ public final class DefaultDownloaderFactoryTest {
CacheDataSource.Factory cacheDataSourceFactory =
new CacheDataSource.Factory()
.setCache(Mockito.mock(Cache.class))
.setUpstreamDataSourceFactory(DummyDataSource.FACTORY);
.setUpstreamDataSourceFactory(PlaceholderDataSource.FACTORY);
DownloaderFactory factory =
new DefaultDownloaderFactory(cacheDataSourceFactory, /* executor= */ Runnable::run);
......
......@@ -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.Representation;
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.common.collect.ImmutableList;
import java.util.Arrays;
......@@ -43,28 +43,28 @@ public final class DashUtilTest {
@Test
public void loadDrmInitDataFromManifest() throws Exception {
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());
}
@Test
public void loadDrmInitDataMissing() throws Exception {
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();
}
@Test
public void loadDrmInitDataNoRepresentations() throws Exception {
Period period = newPeriod(newAdaptationSet(/* no representation */ ));
Format format = DashUtil.loadFormatWithDrmInitData(DummyDataSource.INSTANCE, period);
Format format = DashUtil.loadFormatWithDrmInitData(PlaceholderDataSource.INSTANCE, period);
assertThat(format).isNull();
}
@Test
public void loadDrmInitDataNoAdaptationSets() throws Exception {
Period period = newPeriod(/* no adaptation set */ );
Format format = DashUtil.loadFormatWithDrmInitData(DummyDataSource.INSTANCE, period);
Format format = DashUtil.loadFormatWithDrmInitData(PlaceholderDataSource.INSTANCE, period);
assertThat(format).isNull();
}
......
......@@ -40,7 +40,7 @@ import com.google.android.exoplayer2.testutil.FakeDataSet;
import com.google.android.exoplayer2.testutil.FakeDataSource;
import com.google.android.exoplayer2.testutil.TestUtil;
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.CacheDataSource;
import com.google.android.exoplayer2.upstream.cache.NoOpCacheEvictor;
......@@ -86,7 +86,7 @@ public class DashDownloaderTest {
CacheDataSource.Factory cacheDataSourceFactory =
new CacheDataSource.Factory()
.setCache(Mockito.mock(Cache.class))
.setUpstreamDataSourceFactory(DummyDataSource.FACTORY);
.setUpstreamDataSourceFactory(PlaceholderDataSource.FACTORY);
DownloaderFactory factory =
new DefaultDownloaderFactory(cacheDataSourceFactory, /* executor= */ Runnable::run);
......@@ -96,7 +96,7 @@ public class DashDownloaderTest {
.setMimeType(MimeTypes.APPLICATION_MPD)
.setStreamKeys(
Collections.singletonList(
new StreamKey(/* groupIndex= */ 0, /* trackIndex= */ 0)))
new StreamKey(/* groupIndex= */ 0, /* streamIndex= */ 0)))
.build());
assertThat(downloader).isInstanceOf(DashDownloader.class);
}
......
......@@ -20,14 +20,14 @@ import androidx.annotation.Nullable;
import java.io.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}. */
public static final Factory FACTORY = DummyDataSource::new;
/** A factory that produces {@link PlaceholderDataSource}. */
public static final Factory FACTORY = PlaceholderDataSource::new;
private DummyDataSource() {}
private PlaceholderDataSource() {}
@Override
public void addTransferListener(TransferListener transferListener) {
......@@ -36,7 +36,7 @@ public final class DummyDataSource implements DataSource {
@Override
public long open(DataSpec dataSpec) throws IOException {
throw new IOException("DummyDataSource cannot be opened");
throw new IOException("PlaceholderDataSource cannot be opened");
}
@Override
......
......@@ -33,8 +33,8 @@ import com.google.android.exoplayer2.upstream.DataSink;
import com.google.android.exoplayer2.upstream.DataSource;
import com.google.android.exoplayer2.upstream.DataSourceException;
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.PlaceholderDataSource;
import com.google.android.exoplayer2.upstream.PriorityDataSource;
import com.google.android.exoplayer2.upstream.TeeDataSource;
import com.google.android.exoplayer2.upstream.TransferListener;
......@@ -539,7 +539,7 @@ public final class CacheDataSource implements DataSource {
? new TeeDataSource(upstreamDataSource, cacheWriteDataSink)
: null;
} else {
this.upstreamDataSource = DummyDataSource.INSTANCE;
this.upstreamDataSource = PlaceholderDataSource.INSTANCE;
this.cacheWriteDataSource = null;
}
this.eventListener = eventListener;
......
......@@ -48,7 +48,7 @@ import com.google.android.exoplayer2.testutil.CacheAsserts;
import com.google.android.exoplayer2.testutil.FakeDataSet;
import com.google.android.exoplayer2.testutil.FakeDataSource;
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.CacheDataSource;
import com.google.android.exoplayer2.upstream.cache.NoOpCacheEvictor;
......@@ -104,7 +104,7 @@ public class HlsDownloaderTest {
CacheDataSource.Factory cacheDataSourceFactory =
new CacheDataSource.Factory()
.setCache(Mockito.mock(Cache.class))
.setUpstreamDataSourceFactory(DummyDataSource.FACTORY);
.setUpstreamDataSourceFactory(PlaceholderDataSource.FACTORY);
DownloaderFactory factory =
new DefaultDownloaderFactory(cacheDataSourceFactory, /* executor= */ Runnable::run);
......@@ -114,7 +114,7 @@ public class HlsDownloaderTest {
.setMimeType(MimeTypes.APPLICATION_M3U8)
.setStreamKeys(
Collections.singletonList(
new StreamKey(/* groupIndex= */ 0, /* trackIndex= */ 0)))
new StreamKey(/* groupIndex= */ 0, /* streamIndex= */ 0)))
.build());
assertThat(downloader).isInstanceOf(HlsDownloader.class);
}
......
......@@ -24,7 +24,7 @@ import com.google.android.exoplayer2.offline.DownloadRequest;
import com.google.android.exoplayer2.offline.Downloader;
import com.google.android.exoplayer2.offline.DownloaderFactory;
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.CacheDataSource;
import com.google.android.exoplayer2.util.MimeTypes;
......@@ -42,7 +42,7 @@ public final class SsDownloaderTest {
CacheDataSource.Factory cacheDataSourceFactory =
new CacheDataSource.Factory()
.setCache(Mockito.mock(Cache.class))
.setUpstreamDataSourceFactory(DummyDataSource.FACTORY);
.setUpstreamDataSourceFactory(PlaceholderDataSource.FACTORY);
DownloaderFactory factory =
new DefaultDownloaderFactory(cacheDataSourceFactory, /* executor= */ Runnable::run);
......@@ -52,7 +52,7 @@ public final class SsDownloaderTest {
.setMimeType(MimeTypes.APPLICATION_SS)
.setStreamKeys(
Collections.singletonList(
new StreamKey(/* groupIndex= */ 0, /* trackIndex= */ 0)))
new StreamKey(/* groupIndex= */ 0, /* streamIndex= */ 0)))
.build());
assertThat(downloader).isInstanceOf(SsDownloader.class);
}
......
......@@ -24,7 +24,7 @@ import com.google.android.exoplayer2.upstream.DataSource;
import com.google.android.exoplayer2.upstream.DataSourceInputStream;
import com.google.android.exoplayer2.upstream.DataSourceUtil;
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.CacheDataSource;
import com.google.android.exoplayer2.util.Assertions;
......@@ -127,7 +127,7 @@ public final class CacheAsserts {
*/
public static void assertDataCached(Cache cache, DataSpec dataSpec, byte[] expected)
throws IOException {
DataSource dataSource = new CacheDataSource(cache, DummyDataSource.INSTANCE, 0);
DataSource dataSource = new CacheDataSource(cache, PlaceholderDataSource.INSTANCE, 0);
byte[] bytes;
try {
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