Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
844c023b
authored
Nov 11, 2019
by
kimvde
Committed by
Oliver Woodman
Nov 15, 2019
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add CRC-8 method in Util
PiperOrigin-RevId: 279727618
parent
13cf2360
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
1 deletions
library/core/src/main/java/com/google/android/exoplayer2/extractor/ts/SectionReader.java
library/core/src/main/java/com/google/android/exoplayer2/util/Util.java
library/core/src/test/java/com/google/android/exoplayer2/util/UtilTest.java
library/core/src/main/java/com/google/android/exoplayer2/extractor/ts/SectionReader.java
View file @
844c023b
...
@@ -114,7 +114,7 @@ public final class SectionReader implements TsPayloadReader {
...
@@ -114,7 +114,7 @@ public final class SectionReader implements TsPayloadReader {
if
(
bytesRead
==
totalSectionLength
)
{
if
(
bytesRead
==
totalSectionLength
)
{
if
(
sectionSyntaxIndicator
)
{
if
(
sectionSyntaxIndicator
)
{
// This section has common syntax as defined in ISO/IEC 13818-1, section 2.4.4.11.
// This section has common syntax as defined in ISO/IEC 13818-1, section 2.4.4.11.
if
(
Util
.
crc
(
sectionData
.
data
,
0
,
totalSectionLength
,
0xFFFFFFFF
)
!=
0
)
{
if
(
Util
.
crc
32
(
sectionData
.
data
,
0
,
totalSectionLength
,
0xFFFFFFFF
)
!=
0
)
{
// The CRC is invalid so discard the section.
// The CRC is invalid so discard the section.
waitingForPayloadStart
=
true
;
waitingForPayloadStart
=
true
;
return
;
return
;
...
...
library/core/src/main/java/com/google/android/exoplayer2/util/Util.java
View file @
844c023b
This diff is collapsed.
Click to expand it.
library/core/src/test/java/com/google/android/exoplayer2/util/UtilTest.java
View file @
844c023b
...
@@ -267,6 +267,30 @@ public class UtilTest {
...
@@ -267,6 +267,30 @@ public class UtilTest {
}
}
@Test
@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
()
{
public
void
testInflate
()
{
byte
[]
testData
=
TestUtil
.
buildTestData
(
/*arbitrary test data size*/
256
*
1024
);
byte
[]
testData
=
TestUtil
.
buildTestData
(
/*arbitrary test data size*/
256
*
1024
);
byte
[]
compressedData
=
new
byte
[
testData
.
length
*
2
];
byte
[]
compressedData
=
new
byte
[
testData
.
length
*
2
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment