Commit e49f1f8a by olly Committed by Oliver Woodman

Rollback of https://github.com/google/ExoPlayer/commit/844c023b654bdedf093af4b5c3ed5aafe218b877

*** Original commit ***

Add CRC-8 method in Util

***

PiperOrigin-RevId: 279733541
parent 844c023b
......@@ -114,7 +114,7 @@ public final class SectionReader implements TsPayloadReader {
if (bytesRead == totalSectionLength) {
if (sectionSyntaxIndicator) {
// This section has common syntax as defined in ISO/IEC 13818-1, section 2.4.4.11.
if (Util.crc32(sectionData.data, 0, totalSectionLength, 0xFFFFFFFF) != 0) {
if (Util.crc(sectionData.data, 0, totalSectionLength, 0xFFFFFFFF) != 0) {
// The CRC is invalid so discard the section.
waitingForPayloadStart = true;
return;
......
......@@ -267,30 +267,6 @@ public class UtilTest {
}
@Test
public void testCrc32() {
byte[] bytes = {0x5F, 0x78, 0x04, 0x7B, 0x5F};
int start = 1;
int end = 4;
int initialValue = 0xFFFFFFFF;
int result = Util.crc32(bytes, start, end, initialValue);
assertThat(result).isEqualTo(0x67ce9747);
}
@Test
public void testCrc8() {
byte[] bytes = {0x5F, 0x78, 0x04, 0x7B, 0x5F};
int start = 1;
int end = 4;
int initialValue = 0;
int result = Util.crc8(bytes, start, end, initialValue);
assertThat(result).isEqualTo(0x4);
}
@Test
public void testInflate() {
byte[] testData = TestUtil.buildTestData(/*arbitrary test data size*/ 256 * 1024);
byte[] compressedData = new byte[testData.length * 2];
......
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