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
64b928e7
authored
Oct 19, 2017
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Stylistic cleanup
parent
28bd4661
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
14 deletions
library/core/src/main/java/com/google/android/exoplayer2/extractor/flv/VideoTagPayloadReader.java
library/core/src/main/java/com/google/android/exoplayer2/util/ParsableByteArray.java
library/core/src/test/java/com/google/android/exoplayer2/util/ParsableByteArrayTest.java
library/core/src/main/java/com/google/android/exoplayer2/extractor/flv/VideoTagPayloadReader.java
View file @
64b928e7
...
@@ -79,7 +79,7 @@ import com.google.android.exoplayer2.video.AvcConfig;
...
@@ -79,7 +79,7 @@ import com.google.android.exoplayer2.video.AvcConfig;
@Override
@Override
protected
void
parsePayload
(
ParsableByteArray
data
,
long
timeUs
)
throws
ParserException
{
protected
void
parsePayload
(
ParsableByteArray
data
,
long
timeUs
)
throws
ParserException
{
int
packetType
=
data
.
readUnsignedByte
();
int
packetType
=
data
.
readUnsignedByte
();
int
compositionTimeMs
=
data
.
read
Signed
Int24
();
int
compositionTimeMs
=
data
.
readInt24
();
timeUs
+=
compositionTimeMs
*
1000L
;
timeUs
+=
compositionTimeMs
*
1000L
;
// Parse avc sequence header in case this was not done before.
// Parse avc sequence header in case this was not done before.
...
...
library/core/src/main/java/com/google/android/exoplayer2/util/ParsableByteArray.java
View file @
64b928e7
...
@@ -233,7 +233,7 @@ public final class ParsableByteArray {
...
@@ -233,7 +233,7 @@ public final class ParsableByteArray {
}
}
/**
/**
* Reads the next two bytes as a
n
signed value.
* Reads the next two bytes as a signed value.
*/
*/
public
short
readShort
()
{
public
short
readShort
()
{
return
(
short
)
((
data
[
position
++]
&
0xFF
)
<<
8
return
(
short
)
((
data
[
position
++]
&
0xFF
)
<<
8
...
@@ -257,11 +257,12 @@ public final class ParsableByteArray {
...
@@ -257,11 +257,12 @@ public final class ParsableByteArray {
}
}
/**
/**
* Reads the next three bytes as a
n
signed value.
* Reads the next three bytes as a signed value.
*/
*/
public
int
readSignedInt24
()
{
public
int
readInt24
()
{
int
ui24
=
readUnsignedInt24
();
return
((
data
[
position
++]
&
0xFF
)
<<
24
)
>>
8
return
(
ui24
&
0x800000
L
)
>>>
23
==
1
?
(
ui24
|
0xff000000
)
:
ui24
;
|
(
data
[
position
++]
&
0xFF
)
<<
8
|
(
data
[
position
++]
&
0xFF
);
}
}
/**
/**
...
@@ -313,7 +314,7 @@ public final class ParsableByteArray {
...
@@ -313,7 +314,7 @@ public final class ParsableByteArray {
}
}
/**
/**
* Reads the next four bytes as a
n
signed value in little endian order.
* Reads the next four bytes as a signed value in little endian order.
*/
*/
public
int
readLittleEndianInt
()
{
public
int
readLittleEndianInt
()
{
return
(
data
[
position
++]
&
0xFF
)
return
(
data
[
position
++]
&
0xFF
)
...
...
library/core/src/test/java/com/google/android/exoplayer2/util/ParsableByteArrayTest.java
View file @
64b928e7
...
@@ -328,25 +328,25 @@ public final class ParsableByteArrayTest {
...
@@ -328,25 +328,25 @@ public final class ParsableByteArrayTest {
@Test
@Test
public
void
testReadLittleEndianUnsignedInt24
()
{
public
void
testReadLittleEndianUnsignedInt24
()
{
byte
[]
data
=
{
0x01
,
0x02
,
(
byte
)
0xFF
};
byte
[]
data
=
{
0x01
,
0x02
,
(
byte
)
0xFF
};
ParsableByteArray
byteArray
=
new
ParsableByteArray
(
data
);
ParsableByteArray
byteArray
=
new
ParsableByteArray
(
data
);
assertThat
(
byteArray
.
readLittleEndianUnsignedInt24
()).
isEqualTo
(
0xFF0201
);
assertThat
(
byteArray
.
readLittleEndianUnsignedInt24
()).
isEqualTo
(
0xFF0201
);
assertThat
(
byteArray
.
getPosition
()).
isEqualTo
(
3
);
assertThat
(
byteArray
.
getPosition
()).
isEqualTo
(
3
);
}
}
@Test
@Test
public
void
testRead
PositiveSignedInt24
()
{
public
void
testRead
Int24Positive
()
{
byte
[]
data
=
{
0x01
,
0x02
,
(
byte
)
0xFF
};
byte
[]
data
=
{
0x01
,
0x02
,
(
byte
)
0xFF
};
ParsableByteArray
byteArray
=
new
ParsableByteArray
(
data
);
ParsableByteArray
byteArray
=
new
ParsableByteArray
(
data
);
assertThat
(
byteArray
.
read
Signed
Int24
()).
isEqualTo
(
0x0102FF
);
assertThat
(
byteArray
.
readInt24
()).
isEqualTo
(
0x0102FF
);
assertThat
(
byteArray
.
getPosition
()).
isEqualTo
(
3
);
assertThat
(
byteArray
.
getPosition
()).
isEqualTo
(
3
);
}
}
@Test
@Test
public
void
testRead
NegativeSignedInt24
()
{
public
void
testRead
Int24Negative
()
{
byte
[]
data
=
{
(
byte
)
0xFF
,
0x02
,
(
byte
)
0x01
};
byte
[]
data
=
{
(
byte
)
0xFF
,
0x02
,
(
byte
)
0x01
};
ParsableByteArray
byteArray
=
new
ParsableByteArray
(
data
);
ParsableByteArray
byteArray
=
new
ParsableByteArray
(
data
);
assertThat
(
byteArray
.
read
Signed
Int24
()).
isEqualTo
(
0xFFFF0201
);
assertThat
(
byteArray
.
readInt24
()).
isEqualTo
(
0xFFFF0201
);
assertThat
(
byteArray
.
getPosition
()).
isEqualTo
(
3
);
assertThat
(
byteArray
.
getPosition
()).
isEqualTo
(
3
);
}
}
...
...
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