Remove some sanity occurrences in Java files

Remove occurrences in comments and private fields.

ISSUE: #7565
PiperOrigin-RevId: 319828820
This commit is contained in:
kimvde 2020-07-06 20:12:24 +01:00 committed by kim-vde
parent afbeb4267a
commit c06fa144e1
11 changed files with 17 additions and 17 deletions

View File

@ -31,7 +31,7 @@ public class CTest {
@SuppressLint("InlinedApi") @SuppressLint("InlinedApi")
@Test @Test
public void bufferFlagConstants_equalToMediaCodecConstants() { public void bufferFlagConstants_equalToMediaCodecConstants() {
// Sanity check that constant values match those defined by the platform. // Check that constant values match those defined by the platform.
assertThat(C.BUFFER_FLAG_KEY_FRAME).isEqualTo(MediaCodec.BUFFER_FLAG_KEY_FRAME); assertThat(C.BUFFER_FLAG_KEY_FRAME).isEqualTo(MediaCodec.BUFFER_FLAG_KEY_FRAME);
assertThat(C.BUFFER_FLAG_END_OF_STREAM).isEqualTo(MediaCodec.BUFFER_FLAG_END_OF_STREAM); assertThat(C.BUFFER_FLAG_END_OF_STREAM).isEqualTo(MediaCodec.BUFFER_FLAG_END_OF_STREAM);
assertThat(C.CRYPTO_MODE_AES_CTR).isEqualTo(MediaCodec.CRYPTO_MODE_AES_CTR); assertThat(C.CRYPTO_MODE_AES_CTR).isEqualTo(MediaCodec.CRYPTO_MODE_AES_CTR);
@ -40,7 +40,7 @@ public class CTest {
@SuppressLint("InlinedApi") @SuppressLint("InlinedApi")
@Test @Test
public void encodingConstants_equalToAudioFormatConstants() { public void encodingConstants_equalToAudioFormatConstants() {
// Sanity check that encoding constant values match those defined by the platform. // Check that encoding constant values match those defined by the platform.
assertThat(C.ENCODING_PCM_16BIT).isEqualTo(AudioFormat.ENCODING_PCM_16BIT); assertThat(C.ENCODING_PCM_16BIT).isEqualTo(AudioFormat.ENCODING_PCM_16BIT);
assertThat(C.ENCODING_MP3).isEqualTo(AudioFormat.ENCODING_MP3); assertThat(C.ENCODING_MP3).isEqualTo(AudioFormat.ENCODING_MP3);
assertThat(C.ENCODING_PCM_FLOAT).isEqualTo(AudioFormat.ENCODING_PCM_FLOAT); assertThat(C.ENCODING_PCM_FLOAT).isEqualTo(AudioFormat.ENCODING_PCM_FLOAT);

View File

@ -297,7 +297,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
positionUs); positionUs);
associateNoSampleRenderersWithEmptySampleStream(sampleStreams); associateNoSampleRenderersWithEmptySampleStream(sampleStreams);
// Update whether we have enabled tracks and sanity check the expected streams are non-null. // Update whether we have enabled tracks and check that the expected streams are non-null.
hasEnabledTracks = false; hasEnabledTracks = false;
for (int i = 0; i < sampleStreams.length; i++) { for (int i = 0; i < sampleStreams.length; i++) {
if (sampleStreams[i] != null) { if (sampleStreams[i] != null) {

View File

@ -435,7 +435,7 @@ import java.lang.reflect.Method;
return; return;
} }
// Perform sanity checks on the timestamp and accept/reject it. // Check the timestamp and accept/reject it.
long audioTimestampSystemTimeUs = audioTimestampPoller.getTimestampSystemTimeUs(); long audioTimestampSystemTimeUs = audioTimestampPoller.getTimestampSystemTimeUs();
long audioTimestampPositionFrames = audioTimestampPoller.getTimestampPositionFrames(); long audioTimestampPositionFrames = audioTimestampPoller.getTimestampPositionFrames();
if (Math.abs(audioTimestampSystemTimeUs - systemTimeUs) > MAX_AUDIO_TIMESTAMP_OFFSET_US) { if (Math.abs(audioTimestampSystemTimeUs - systemTimeUs) > MAX_AUDIO_TIMESTAMP_OFFSET_US) {
@ -469,9 +469,9 @@ import java.lang.reflect.Method;
castNonNull((Integer) getLatencyMethod.invoke(Assertions.checkNotNull(audioTrack))) castNonNull((Integer) getLatencyMethod.invoke(Assertions.checkNotNull(audioTrack)))
* 1000L * 1000L
- bufferSizeUs; - bufferSizeUs;
// Sanity check that the latency is non-negative. // Check that the latency is non-negative.
latencyUs = Math.max(latencyUs, 0); latencyUs = Math.max(latencyUs, 0);
// Sanity check that the latency isn't too large. // Check that the latency isn't too large.
if (latencyUs > MAX_LATENCY_US) { if (latencyUs > MAX_LATENCY_US) {
listener.onInvalidLatency(latencyUs); listener.onInvalidLatency(latencyUs);
latencyUs = 0; latencyUs = 0;

View File

@ -708,7 +708,7 @@ public final class DefaultAudioSink implements AudioSink {
afterDrainParameters = null; afterDrainParameters = null;
} }
// Sanity check that presentationTimeUs is consistent with the expected value. // Check that presentationTimeUs is consistent with the expected value.
long expectedPresentationTimeUs = long expectedPresentationTimeUs =
startMediaTimeUs startMediaTimeUs
+ configuration.inputFramesToDurationUs( + configuration.inputFramesToDurationUs(

View File

@ -421,8 +421,8 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
case DefaultDrmSessionManager.MODE_RELEASE: case DefaultDrmSessionManager.MODE_RELEASE:
Assertions.checkNotNull(offlineLicenseKeySetId); Assertions.checkNotNull(offlineLicenseKeySetId);
Assertions.checkNotNull(this.sessionId); Assertions.checkNotNull(this.sessionId);
// It's not necessary to restore the key (and open a session to do that) before releasing it // It's not necessary to restore the key before releasing it but this serves as a good
// but this serves as a good sanity/fast-failure check. // fast-failure check.
if (restoreKeys()) { if (restoreKeys()) {
postKeyRequest(offlineLicenseKeySetId, ExoMediaDrm.KEY_TYPE_RELEASE, allowRetry); postKeyRequest(offlineLicenseKeySetId, ExoMediaDrm.KEY_TYPE_RELEASE, allowRetry);
} }

View File

@ -84,7 +84,7 @@ public final class SubripDecoder extends SimpleSubtitleDecoder {
continue; continue;
} }
// Parse the index line as a sanity check. // Parse and check the index line.
try { try {
Integer.parseInt(currentLine); Integer.parseInt(currentLine);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {

View File

@ -160,7 +160,7 @@ public final class SntpClient {
final long receiveTime = readTimestamp(buffer, RECEIVE_TIME_OFFSET); final long receiveTime = readTimestamp(buffer, RECEIVE_TIME_OFFSET);
final long transmitTime = readTimestamp(buffer, TRANSMIT_TIME_OFFSET); final long transmitTime = readTimestamp(buffer, TRANSMIT_TIME_OFFSET);
// Do sanity check according to RFC. // Check server reply validity according to RFC.
checkValidServerReply(leap, mode, stratum, transmitTime); checkValidServerReply(leap, mode, stratum, transmitTime);
// receiveTime = originateTime + transit + skew // receiveTime = originateTime + transit + skew

View File

@ -43,7 +43,7 @@ public final class ProjectionDecoder {
private static final int TYPE_MESH = 0x6d657368; private static final int TYPE_MESH = 0x6d657368;
private static final int TYPE_PROJ = 0x70726f6a; private static final int TYPE_PROJ = 0x70726f6a;
// Sanity limits to prevent a bad file from creating an OOM situation. We don't expect a mesh to // Limits to prevent a bad file from creating an OOM situation. We don't expect a mesh to
// exceed these limits. // exceed these limits.
private static final int MAX_COORDINATE_COUNT = 10_000; private static final int MAX_COORDINATE_COUNT = 10_000;
private static final int MAX_VERTEX_COUNT = 32 * 1000; private static final int MAX_VERTEX_COUNT = 32 * 1000;

View File

@ -179,13 +179,13 @@ public final class CacheDataSourceTest2 {
null); // eventListener null); // eventListener
} }
private static void emptyCache(Cache cache) throws CacheException { private static void emptyCache(Cache cache) {
for (String key : cache.getKeys()) { for (String key : cache.getKeys()) {
for (CacheSpan span : cache.getCachedSpans(key)) { for (CacheSpan span : cache.getCachedSpans(key)) {
cache.removeSpan(span); cache.removeSpan(span);
} }
} }
// Sanity check that the cache really is empty now. // Check that the cache really is empty now.
assertThat(cache.getKeys().isEmpty()).isTrue(); assertThat(cache.getKeys().isEmpty()).isTrue();
} }

View File

@ -28,9 +28,9 @@ public final class ExtractorTest {
@Test @Test
public void constants() { public void constants() {
// Sanity check that constant values match those defined by {@link C}. // Check that constant values match those defined by {@link C}.
assertThat(Extractor.RESULT_END_OF_INPUT).isEqualTo(C.RESULT_END_OF_INPUT); assertThat(Extractor.RESULT_END_OF_INPUT).isEqualTo(C.RESULT_END_OF_INPUT);
// Sanity check that the other constant values don't overlap. // Check that the other constant values don't overlap.
assertThat(C.RESULT_END_OF_INPUT != Extractor.RESULT_CONTINUE).isTrue(); assertThat(C.RESULT_END_OF_INPUT != Extractor.RESULT_CONTINUE).isTrue();
assertThat(C.RESULT_END_OF_INPUT != Extractor.RESULT_SEEK).isTrue(); assertThat(C.RESULT_END_OF_INPUT != Extractor.RESULT_SEEK).isTrue();
} }

View File

@ -27,7 +27,7 @@ public final class MetadataUtilTest {
@Test @Test
public void standardGenre_length_matchesNumberOfId3Genres() { public void standardGenre_length_matchesNumberOfId3Genres() {
// Sanity check that we haven't forgotten a genre in the list. // Check that we haven't forgotten a genre in the list.
assertThat(MetadataUtil.STANDARD_GENRES).hasLength(192); assertThat(MetadataUtil.STANDARD_GENRES).hasLength(192);
} }
} }