From dc7fde1ff72dbb2608ba86687d6ba865e28dd224 Mon Sep 17 00:00:00 2001 From: olly Date: Mon, 25 Jan 2021 11:33:38 +0000 Subject: [PATCH] Some more language fixes Issue: #7565 PiperOrigin-RevId: 353613493 --- .../google/android/exoplayer2/util/Util.java | 4 ++-- .../mediacodec/C2Mp3TimestampTracker.java | 4 ++-- .../exoplayer2/upstream/cache/Cache.java | 12 +++++------ .../android/exoplayer2/ExoPlayerTest.java | 20 +++++++++---------- .../extractor/wav/WavHeaderReader.java | 2 +- .../exoplayer2/testutil/FakeExoMediaDrm.java | 4 ++-- .../exoplayer2/testutil/FakeTimeline.java | 2 +- 7 files changed, 24 insertions(+), 24 deletions(-) diff --git a/library/common/src/main/java/com/google/android/exoplayer2/util/Util.java b/library/common/src/main/java/com/google/android/exoplayer2/util/Util.java index 648bdf96a2..61907c5175 100644 --- a/library/common/src/main/java/com/google/android/exoplayer2/util/Util.java +++ b/library/common/src/main/java/com/google/android/exoplayer2/util/Util.java @@ -2189,7 +2189,7 @@ public final class Util { return getMobileNetworkType(networkInfo); case ConnectivityManager.TYPE_ETHERNET: return C.NETWORK_TYPE_ETHERNET; - default: // VPN, Bluetooth, Dummy. + default: return C.NETWORK_TYPE_OTHER; } } @@ -2620,7 +2620,7 @@ public final class Util { "hsn", "zh-hsn" }; - // Legacy ("grandfathered") tags, replaced by modern equivalents (including macrolanguage) + // Legacy tags that have been replaced by modern equivalents (including macrolanguage) // See https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry. private static final String[] isoLegacyTagReplacements = new String[] { diff --git a/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/C2Mp3TimestampTracker.java b/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/C2Mp3TimestampTracker.java index 0c3fe9facf..04b453d529 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/C2Mp3TimestampTracker.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/C2Mp3TimestampTracker.java @@ -30,7 +30,7 @@ import java.nio.ByteBuffer; /* package */ final class C2Mp3TimestampTracker { // Mirroring the actual codec, as can be found at - // https://cs.android.com/android/platform/superproject/+/master:frameworks/av/media/codec2/components/mp3/C2SoftMp3Dec.h;l=55;drc=3665390c9d32a917398b240c5a46ced07a3b65eb + // https://cs.android.com/android/platform/superproject/+/main:frameworks/av/media/codec2/components/mp3/C2SoftMp3Dec.h;l=55;drc=3665390c9d32a917398b240c5a46ced07a3b65eb private static final long DECODER_DELAY_SAMPLES = 529; private static final String TAG = "C2Mp3TimestampTracker"; @@ -76,7 +76,7 @@ import java.nio.ByteBuffer; } // These calculations mirror the timestamp calculations in the Codec2 Mp3 Decoder. - // https://cs.android.com/android/platform/superproject/+/master:frameworks/av/media/codec2/components/mp3/C2SoftMp3Dec.cpp;l=464;drc=ed134640332fea70ca4b05694289d91a5265bb46 + // https://cs.android.com/android/platform/superproject/+/main:frameworks/av/media/codec2/components/mp3/C2SoftMp3Dec.cpp;l=464;drc=ed134640332fea70ca4b05694289d91a5265bb46 if (processedSamples == 0) { anchorTimestampUs = buffer.timeUs; processedSamples = frameCount - DECODER_DELAY_SAMPLES; diff --git a/library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/Cache.java b/library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/Cache.java index c917929111..eb782bd334 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/Cache.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/Cache.java @@ -178,10 +178,10 @@ public interface Cache { * @param key The cache key of the resource. * @param position The starting position in the resource from which data is required. * @param length The length of the data being requested, or {@link C#LENGTH_UNSET} if unbounded. - * The length is ignored in the case of a cache hit. In the case of a cache miss, it defines - * the maximum length of the hole {@link CacheSpan} that's returned. Cache implementations may - * support parallel writes into non-overlapping holes, and so passing the actual required - * length should be preferred to passing {@link C#LENGTH_UNSET} when possible. + * The length is ignored if there is a cache entry that overlaps the position. Else, it + * defines the maximum length of the hole {@link CacheSpan} that's returned. Cache + * implementations may support parallel writes into non-overlapping holes, and so passing the + * actual required length should be preferred to passing {@link C#LENGTH_UNSET} when possible. * @return The {@link CacheSpan}. * @throws InterruptedException If the thread was interrupted. * @throws CacheException If an error is encountered. @@ -199,8 +199,8 @@ public interface Cache { * @param key The cache key of the resource. * @param position The starting position in the resource from which data is required. * @param length The length of the data being requested, or {@link C#LENGTH_UNSET} if unbounded. - * The length is ignored in the case of a cache hit. In the case of a cache miss, it defines - * the range of data locked by the returned {@link CacheSpan}. + * The length is ignored if there is a cache entry that overlaps the position. Else, it + * defines the range of data locked by the returned {@link CacheSpan}. * @return The {@link CacheSpan}. Or null if the cache entry is locked. * @throws CacheException If an error is encountered. */ diff --git a/library/core/src/test/java/com/google/android/exoplayer2/ExoPlayerTest.java b/library/core/src/test/java/com/google/android/exoplayer2/ExoPlayerTest.java index 92eb6ffd03..3201823cd4 100644 --- a/library/core/src/test/java/com/google/android/exoplayer2/ExoPlayerTest.java +++ b/library/core/src/test/java/com/google/android/exoplayer2/ExoPlayerTest.java @@ -4885,8 +4885,8 @@ public final class ExoPlayerTest { MediaSource mediaSource2 = new FakeMediaSource(timeline2); Timeline expectedPlaceholderTimeline = new FakeTimeline( - TimelineWindowDefinition.createDummy(/* tag= */ 1), - TimelineWindowDefinition.createDummy(/* tag= */ 2)); + TimelineWindowDefinition.createPlaceholder(/* tag= */ 1), + TimelineWindowDefinition.createPlaceholder(/* tag= */ 2)); ActionSchedule actionSchedule = new ActionSchedule.Builder(TAG) .waitForTimelineChanged( @@ -4958,9 +4958,9 @@ public final class ExoPlayerTest { Timeline expectedPlaceholderTimeline = new FakeTimeline( - TimelineWindowDefinition.createDummy(/* tag= */ 1), - TimelineWindowDefinition.createDummy(/* tag= */ 2), - TimelineWindowDefinition.createDummy(/* tag= */ 3)); + TimelineWindowDefinition.createPlaceholder(/* tag= */ 1), + TimelineWindowDefinition.createPlaceholder(/* tag= */ 2), + TimelineWindowDefinition.createPlaceholder(/* tag= */ 3)); Timeline expectedRealTimeline = new FakeTimeline(firstWindowDefinition, secondWindowDefinition, thirdWindowDefinition); Timeline expectedRealTimelineAfterRemove = @@ -5018,9 +5018,9 @@ public final class ExoPlayerTest { Timeline expectedPlaceholderTimeline = new FakeTimeline( - TimelineWindowDefinition.createDummy(/* tag= */ 1), - TimelineWindowDefinition.createDummy(/* tag= */ 2), - TimelineWindowDefinition.createDummy(/* tag= */ 3)); + TimelineWindowDefinition.createPlaceholder(/* tag= */ 1), + TimelineWindowDefinition.createPlaceholder(/* tag= */ 2), + TimelineWindowDefinition.createPlaceholder(/* tag= */ 3)); Timeline expectedRealTimeline = new FakeTimeline(firstWindowDefinition, secondWindowDefinition, thirdWindowDefinition); Timeline expectedRealTimelineAfterRemove = new FakeTimeline(firstWindowDefinition); @@ -5155,8 +5155,8 @@ public final class ExoPlayerTest { Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE /* source update after prepare */); Timeline expectedSecondPlaceholderTimeline = new FakeTimeline( - TimelineWindowDefinition.createDummy(/* tag= */ 0), - TimelineWindowDefinition.createDummy(/* tag= */ 0)); + TimelineWindowDefinition.createPlaceholder(/* tag= */ 0), + TimelineWindowDefinition.createPlaceholder(/* tag= */ 0)); Timeline expectedSecondRealTimeline = new FakeTimeline( new TimelineWindowDefinition( diff --git a/library/extractor/src/main/java/com/google/android/exoplayer2/extractor/wav/WavHeaderReader.java b/library/extractor/src/main/java/com/google/android/exoplayer2/extractor/wav/WavHeaderReader.java index 4387993f50..af8ede69aa 100644 --- a/library/extractor/src/main/java/com/google/android/exoplayer2/extractor/wav/WavHeaderReader.java +++ b/library/extractor/src/main/java/com/google/android/exoplayer2/extractor/wav/WavHeaderReader.java @@ -115,7 +115,7 @@ import java.io.IOException; input.resetPeekPosition(); ParsableByteArray scratch = new ParsableByteArray(ChunkHeader.SIZE_IN_BYTES); - // Skip all chunks until we hit the data header. + // Skip all chunks until we find the data header. ChunkHeader chunkHeader = ChunkHeader.peek(input, scratch); while (chunkHeader.id != WavUtil.DATA_FOURCC) { if (chunkHeader.id != WavUtil.RIFF_FOURCC && chunkHeader.id != WavUtil.FMT_FOURCC) { diff --git a/testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeExoMediaDrm.java b/testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeExoMediaDrm.java index ca2388de1f..5ad0435885 100644 --- a/testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeExoMediaDrm.java +++ b/testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeExoMediaDrm.java @@ -60,7 +60,7 @@ import java.util.concurrent.atomic.AtomicInteger; @RequiresApi(29) public final class FakeExoMediaDrm implements ExoMediaDrm { - public static final ProvisionRequest DUMMY_PROVISION_REQUEST = + public static final ProvisionRequest FAKE_PROVISION_REQUEST = new ProvisionRequest(TestUtil.createByteArray(7, 8, 9), "bar.test"); /** Key for use with the Map returned from {@link FakeExoMediaDrm#queryKeyStatus(byte[])}. */ @@ -192,7 +192,7 @@ public final class FakeExoMediaDrm implements ExoMediaDrm { @Override public ProvisionRequest getProvisionRequest() { Assertions.checkState(referenceCount > 0); - return DUMMY_PROVISION_REQUEST; + return FAKE_PROVISION_REQUEST; } @Override diff --git a/testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeTimeline.java b/testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeTimeline.java index a440dd745d..f01cc8d2ca 100644 --- a/testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeTimeline.java +++ b/testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeTimeline.java @@ -58,7 +58,7 @@ public final class FakeTimeline extends Timeline { * * @param tag The tag to use in the timeline. */ - public static TimelineWindowDefinition createDummy(Object tag) { + public static TimelineWindowDefinition createPlaceholder(Object tag) { return new TimelineWindowDefinition( /* periodCount= */ 1, /* id= */ tag,