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
8afa7a54
authored
Mar 08, 2022
by
Rakesh Kumar
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Fix review comments in RtpVP8Reader
Change-Id: Id47c746b199831d0bb51dc736c43fd20c2e79c08
parent
f2e09536
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
17 deletions
libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpVP8Reader.java
libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpVP8Reader.java
View file @
8afa7a54
...
@@ -42,7 +42,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
...
@@ -42,7 +42,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
private
final
RtpPayloadFormat
payloadFormat
;
private
final
RtpPayloadFormat
payloadFormat
;
private
@MonotonicNonNull
TrackOutput
trackOutput
;
private
@MonotonicNonNull
TrackOutput
trackOutput
;
@C
.
BufferFlags
private
int
bufferFlags
;
private
long
firstReceivedTimestamp
;
private
long
firstReceivedTimestamp
;
private
int
previousSequenceNumber
;
private
int
previousSequenceNumber
;
...
@@ -78,7 +77,9 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
...
@@ -78,7 +77,9 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
throws
ParserException
{
throws
ParserException
{
checkStateNotNull
(
trackOutput
);
checkStateNotNull
(
trackOutput
);
if
(
parseVP8Descriptor
(
data
,
sequenceNumber
))
{
// Check if valid VP8 Payload Descriptor is present
boolean
isValidVP8Descriptor
=
parseVP8Descriptor
(
data
,
sequenceNumber
);
if
(
isValidVP8Descriptor
)
{
// VP8 Payload Header, RFC7741 Section 4.3
// VP8 Payload Header, RFC7741 Section 4.3
// 0 1 2 3 4 5 6 7
// 0 1 2 3 4 5 6 7
// +-+-+-+-+-+-+-+-+
// +-+-+-+-+-+-+-+-+
...
@@ -89,7 +90,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
...
@@ -89,7 +90,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
isKeyFrame
=
(
data
.
peekUnsignedByte
()
&
0x01
)
==
0
;
isKeyFrame
=
(
data
.
peekUnsignedByte
()
&
0x01
)
==
0
;
}
}
if
(!
isOutputFormatSet
)
{
if
(!
isOutputFormatSet
)
{
// Parsing frame data to get width and height, RFC6386 Section 9.1
// Parsing frame data to get width and height, RFC6386 Section
1
9.1
int
currPosition
=
data
.
getPosition
();
int
currPosition
=
data
.
getPosition
();
data
.
setPosition
(
currPosition
+
6
);
data
.
setPosition
(
currPosition
+
6
);
int
width
=
data
.
readLittleEndianUnsignedShort
()
&
0x3fff
;
int
width
=
data
.
readLittleEndianUnsignedShort
()
&
0x3fff
;
...
@@ -97,10 +98,8 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
...
@@ -97,10 +98,8 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
data
.
setPosition
(
currPosition
);
data
.
setPosition
(
currPosition
);
if
(
width
!=
payloadFormat
.
format
.
width
||
height
!=
payloadFormat
.
format
.
height
)
{
if
(
width
!=
payloadFormat
.
format
.
width
||
height
!=
payloadFormat
.
format
.
height
)
{
Format
trackFormat
=
payloadFormat
.
format
;
trackOutput
.
format
(
Format
.
Builder
formatBuilder
=
trackFormat
.
buildUpon
();
payloadFormat
.
format
.
buildUpon
().
setWidth
(
width
).
setHeight
(
height
).
build
());
formatBuilder
.
setWidth
(
width
).
setHeight
(
height
);
trackOutput
.
format
(
formatBuilder
.
build
());
}
}
isOutputFormatSet
=
true
;
isOutputFormatSet
=
true
;
}
}
...
@@ -114,11 +113,10 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
...
@@ -114,11 +113,10 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
if
(
firstReceivedTimestamp
==
C
.
TIME_UNSET
)
{
if
(
firstReceivedTimestamp
==
C
.
TIME_UNSET
)
{
firstReceivedTimestamp
=
timestamp
;
firstReceivedTimestamp
=
timestamp
;
}
}
bufferFlags
=
isKeyFrame
?
C
.
BUFFER_FLAG_KEY_FRAME
:
0
;
long
timeUs
=
toSampleUs
(
startTimeOffsetUs
,
timestamp
,
firstReceivedTimestamp
);
long
timeUs
=
toSampleUs
(
startTimeOffsetUs
,
timestamp
,
firstReceivedTimestamp
);
trackOutput
.
sampleMetadata
(
trackOutput
.
sampleMetadata
(
timeUs
,
timeUs
,
bufferFlags
,
isKeyFrame
?
C
.
BUFFER_FLAG_KEY_FRAME
:
0
,
fragmentedSampleSizeBytes
,
fragmentedSampleSizeBytes
,
/* offset= */
0
,
/* offset= */
0
,
/* encryptionData= */
null
);
/* encryptionData= */
null
);
...
@@ -156,11 +154,8 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
...
@@ -156,11 +154,8 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
if
(!
gotFirstPacketOfVP8Frame
)
{
if
(!
gotFirstPacketOfVP8Frame
)
{
// For start of VP8 partition S=1 and PID=0 as per RFC7741 Section 4.2
// For start of VP8 partition S=1 and PID=0 as per RFC7741 Section 4.2
if
((
header
&
0x17
)
!=
0x10
)
{
if
((
header
&
0x17
)
!=
0x10
)
{
Log
.
w
(
Log
.
w
(
TAG
,
"first payload octet of the RTP packet is not the beginning of a new VP8 "
TAG
,
+
"partition, Dropping current packet"
);
Util
.
formatInvariant
(
"first payload octet of the RTP packet is not the beginning of a new VP8 "
+
"partition, Dropping current packet"
));
return
false
;
return
false
;
}
}
gotFirstPacketOfVP8Frame
=
true
;
gotFirstPacketOfVP8Frame
=
true
;
...
@@ -187,9 +182,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
...
@@ -187,9 +182,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
int
iHeader
=
payload
.
readUnsignedByte
();
int
iHeader
=
payload
.
readUnsignedByte
();
if
((
iHeader
&
0x80
)
!=
0
)
{
if
((
iHeader
&
0x80
)
!=
0
)
{
payload
.
skipBytes
(
1
);
payload
.
skipBytes
(
1
);
Log
.
i
(
TAG
,
"15 bits PictureID"
);
}
else
{
Log
.
i
(
TAG
,
"7 bits PictureID"
);
}
}
}
}
...
...
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