Remove CueDecoder.decode
overload without length
& offset
params
This method is only used in tests, so let's remove it and just test the one that takes `length` and `offset`. PiperOrigin-RevId: 663731139
This commit is contained in:
parent
1ffc962fde
commit
91a95e23c9
@ -72,7 +72,8 @@ public class CueSerializationTest {
|
|||||||
|
|
||||||
// encoding and decoding
|
// encoding and decoding
|
||||||
byte[] encodedCues = encoder.encode(ImmutableList.of(cue), /* durationUs= */ 2000);
|
byte[] encodedCues = encoder.encode(ImmutableList.of(cue), /* durationUs= */ 2000);
|
||||||
CuesWithTiming cuesAfterDecoding = decoder.decode(/* startTimeUs= */ 1000, encodedCues);
|
CuesWithTiming cuesAfterDecoding =
|
||||||
|
decoder.decode(/* startTimeUs= */ 1000, encodedCues, /* offset= */ 0, encodedCues.length);
|
||||||
|
|
||||||
assertThat(cuesAfterDecoding.startTimeUs).isEqualTo(1000);
|
assertThat(cuesAfterDecoding.startTimeUs).isEqualTo(1000);
|
||||||
assertThat(cuesAfterDecoding.durationUs).isEqualTo(2000);
|
assertThat(cuesAfterDecoding.durationUs).isEqualTo(2000);
|
||||||
@ -115,7 +116,8 @@ public class CueSerializationTest {
|
|||||||
|
|
||||||
// encoding and decoding
|
// encoding and decoding
|
||||||
byte[] encodedCues = encoder.encode(ImmutableList.of(bitmapCue), /* durationUs= */ 2000);
|
byte[] encodedCues = encoder.encode(ImmutableList.of(bitmapCue), /* durationUs= */ 2000);
|
||||||
CuesWithTiming cuesAfterDecoding = decoder.decode(/* startTimeUs= */ 1000, encodedCues);
|
CuesWithTiming cuesAfterDecoding =
|
||||||
|
decoder.decode(/* startTimeUs= */ 1000, encodedCues, /* offset= */ 0, encodedCues.length);
|
||||||
|
|
||||||
assertThat(cuesAfterDecoding.startTimeUs).isEqualTo(1000);
|
assertThat(cuesAfterDecoding.startTimeUs).isEqualTo(1000);
|
||||||
assertThat(cuesAfterDecoding.durationUs).isEqualTo(2000);
|
assertThat(cuesAfterDecoding.durationUs).isEqualTo(2000);
|
||||||
@ -140,7 +142,8 @@ public class CueSerializationTest {
|
|||||||
|
|
||||||
// encoding and decoding
|
// encoding and decoding
|
||||||
byte[] encodedCues = encoder.encode(ImmutableList.of(mixedSpansCue), /* durationUs= */ 2000);
|
byte[] encodedCues = encoder.encode(ImmutableList.of(mixedSpansCue), /* durationUs= */ 2000);
|
||||||
CuesWithTiming cuesAfterDecoding = decoder.decode(/* startTimeUs= */ 1000, encodedCues);
|
CuesWithTiming cuesAfterDecoding =
|
||||||
|
decoder.decode(/* startTimeUs= */ 1000, encodedCues, /* offset= */ 0, encodedCues.length);
|
||||||
|
|
||||||
assertThat(cuesAfterDecoding.startTimeUs).isEqualTo(1000);
|
assertThat(cuesAfterDecoding.startTimeUs).isEqualTo(1000);
|
||||||
assertThat(cuesAfterDecoding.durationUs).isEqualTo(2000);
|
assertThat(cuesAfterDecoding.durationUs).isEqualTo(2000);
|
||||||
|
@ -34,18 +34,6 @@ public final class CueDecoder {
|
|||||||
/** Key under which the duration is saved in the {@link Bundle}. */
|
/** Key under which the duration is saved in the {@link Bundle}. */
|
||||||
/* package */ static final String BUNDLE_FIELD_DURATION_US = "d";
|
/* package */ static final String BUNDLE_FIELD_DURATION_US = "d";
|
||||||
|
|
||||||
/**
|
|
||||||
* Decodes a byte array into a {@link CuesWithTiming} instance.
|
|
||||||
*
|
|
||||||
* @param startTimeUs The value for {@link CuesWithTiming#startTimeUs} (this is not encoded in
|
|
||||||
* {@code bytes}).
|
|
||||||
* @param bytes Byte array produced by {@link CueEncoder#encode(List, long)}
|
|
||||||
* @return Decoded {@link CuesWithTiming} instance.
|
|
||||||
*/
|
|
||||||
public CuesWithTiming decode(long startTimeUs, byte[] bytes) {
|
|
||||||
return decode(startTimeUs, bytes, /* offset= */ 0, bytes.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decodes a byte array into a {@link CuesWithTiming} instance.
|
* Decodes a byte array into a {@link CuesWithTiming} instance.
|
||||||
*
|
*
|
||||||
|
@ -284,7 +284,8 @@ public class SubtitleExtractorTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private CuesWithTiming decodeSample(FakeTrackOutput trackOutput, int sampleIndex) {
|
private CuesWithTiming decodeSample(FakeTrackOutput trackOutput, int sampleIndex) {
|
||||||
|
byte[] sampleData = trackOutput.getSampleData(sampleIndex);
|
||||||
return decoder.decode(
|
return decoder.decode(
|
||||||
trackOutput.getSampleTimeUs(sampleIndex), trackOutput.getSampleData(sampleIndex));
|
trackOutput.getSampleTimeUs(sampleIndex), sampleData, /* offset= */ 0, sampleData.length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user