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:
hschlueter 2022-03-30 18:22:23 +01:00 committed by Ian Baker
parent bd5ca15af6
commit 81ab6c730d
12 changed files with 76 additions and 71 deletions

View File

@ -15,6 +15,8 @@
* Track selection:
* Flatten `TrackSelectionOverrides` class into `TrackSelectionParameters`,
and promote `TrackSelectionOverride` to a top level class.
* Video:
* Rename `DummySurface` to `PlaceHolderSurface`.
* Audio:
* Use LG AC3 audio decoder advertising non-standard MIME type.
* Extractors:
@ -51,6 +53,8 @@
([#47](https://github.com/androidx/media/pull/47)).
* Add RTP reader for WAV
([#56](https://github.com/androidx/media/pull/56)).
* Data sources:
* Rename `DummyDataSource` to `PlaceHolderDataSource`.
* Remove deprecated symbols:
* Remove `Player.Listener.onTracksChanged`. Use
`Player.Listener.onTracksInfoChanged` instead.

View File

@ -22,14 +22,14 @@ import java.io.IOException;
/** A DataSource which provides no data. {@link #open(DataSpec)} throws {@link IOException}. */
@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}. */
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) {
@ -38,7 +38,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

View File

@ -36,8 +36,8 @@ import androidx.media3.datasource.DataSink;
import androidx.media3.datasource.DataSource;
import androidx.media3.datasource.DataSourceException;
import androidx.media3.datasource.DataSpec;
import androidx.media3.datasource.DummyDataSource;
import androidx.media3.datasource.FileDataSource;
import androidx.media3.datasource.PlaceholderDataSource;
import androidx.media3.datasource.PriorityDataSource;
import androidx.media3.datasource.TeeDataSource;
import androidx.media3.datasource.TransferListener;
@ -541,7 +541,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;

View File

@ -129,7 +129,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;
@ -515,7 +515,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.
@ -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
protected void onReset() {
try {
super.onReset();
} finally {
if (dummySurface != null) {
releaseDummySurface();
if (placeholderSurface != null) {
releasePlaceholderSurface();
}
}
}
@ -624,14 +624,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;
}
}
}
@ -652,7 +652,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.
@ -665,7 +665,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();
@ -684,16 +684,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());
@ -709,10 +709,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);
@ -949,7 +949,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);
@ -1259,16 +1259,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() {

View File

@ -36,12 +36,12 @@ import androidx.media3.common.util.UnstableApi;
import androidx.media3.common.util.Util;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
/** A dummy {@link Surface}. */
/** A placeholder {@link Surface}. */
@RequiresApi(17)
@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. */
public final boolean secure;
@ -49,14 +49,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) {
@ -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}
* 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.
*
@ -78,13 +78,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;
@ -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_RELEASE = 2;
@ -130,13 +131,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);
@ -176,10 +177,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) {
@ -191,7 +192,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();
}
@ -205,7 +206,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);
}

View File

@ -168,7 +168,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;
}

View File

@ -18,7 +18,7 @@ package androidx.media3.exoplayer.offline;
import static com.google.common.truth.Truth.assertThat;
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.CacheDataSource;
import androidx.test.ext.junit.runners.AndroidJUnit4;
@ -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);

View File

@ -22,7 +22,7 @@ import androidx.media3.common.DrmInitData;
import androidx.media3.common.DrmInitData.SchemeData;
import androidx.media3.common.Format;
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.BaseUrl;
import androidx.media3.exoplayer.dash.manifest.Period;
@ -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();
}

View File

@ -31,7 +31,7 @@ import androidx.media3.common.MimeTypes;
import androidx.media3.common.StreamKey;
import androidx.media3.common.util.Util;
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.CacheDataSource;
import androidx.media3.datasource.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);
}

View File

@ -39,7 +39,7 @@ import androidx.media3.common.MediaItem;
import androidx.media3.common.MimeTypes;
import androidx.media3.common.StreamKey;
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.CacheDataSource;
import androidx.media3.datasource.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);
}

View File

@ -20,7 +20,7 @@ import static com.google.common.truth.Truth.assertThat;
import android.net.Uri;
import androidx.media3.common.MimeTypes;
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.CacheDataSource;
import androidx.media3.exoplayer.offline.DefaultDownloaderFactory;
@ -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);
}

View File

@ -26,7 +26,7 @@ import androidx.media3.datasource.DataSource;
import androidx.media3.datasource.DataSourceInputStream;
import androidx.media3.datasource.DataSourceUtil;
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.CacheDataSource;
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)
throws IOException {
DataSource dataSource = new CacheDataSource(cache, DummyDataSource.INSTANCE, 0);
DataSource dataSource = new CacheDataSource(cache, PlaceholderDataSource.INSTANCE, 0);
byte[] bytes;
try {
dataSource.open(dataSpec);