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
ca1c1c26
authored
Feb 15, 2022
by
Rakesh Kumar
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Fix some minor review comments in RtpH265Reader
parent
aa687465
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
27 deletions
libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspMediaTrack.java
libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpH265Reader.java
libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspMediaTrack.java
View file @
ca1c1c26
...
@@ -44,10 +44,10 @@ import com.google.common.collect.ImmutableMap;
...
@@ -44,10 +44,10 @@ import com.google.common.collect.ImmutableMap;
// Format specific parameter names.
// Format specific parameter names.
private
static
final
String
PARAMETER_PROFILE_LEVEL_ID
=
"profile-level-id"
;
private
static
final
String
PARAMETER_PROFILE_LEVEL_ID
=
"profile-level-id"
;
private
static
final
String
PARAMETER_SPROP_PARAMS
=
"sprop-parameter-sets"
;
private
static
final
String
PARAMETER_SPROP_PARAMS
=
"sprop-parameter-sets"
;
private
static
final
String
PARAMETER_
SPROP_H265
_SPS
=
"sprop-sps"
;
private
static
final
String
PARAMETER_
H265_SPROP
_SPS
=
"sprop-sps"
;
private
static
final
String
PARAMETER_
SPROP_H265
_PPS
=
"sprop-pps"
;
private
static
final
String
PARAMETER_
H265_SPROP
_PPS
=
"sprop-pps"
;
private
static
final
String
PARAMETER_
SPROP_H265
_VPS
=
"sprop-vps"
;
private
static
final
String
PARAMETER_
H265_SPROP
_VPS
=
"sprop-vps"
;
private
static
final
String
PARAMETER_
SPROP_H265
_MAX_DON_DIFF
=
"sprop-max-don-diff"
;
private
static
final
String
PARAMETER_
H265_SPROP
_MAX_DON_DIFF
=
"sprop-max-don-diff"
;
/** Prefix for the RFC6381 codecs string for AAC formats. */
/** Prefix for the RFC6381 codecs string for AAC formats. */
private
static
final
String
AAC_CODECS_PREFIX
=
"mp4a.40."
;
private
static
final
String
AAC_CODECS_PREFIX
=
"mp4a.40."
;
...
@@ -222,19 +222,19 @@ import com.google.common.collect.ImmutableMap;
...
@@ -222,19 +222,19 @@ import com.google.common.collect.ImmutableMap;
private
static
void
processH265FmtpAttribute
(
private
static
void
processH265FmtpAttribute
(
Format
.
Builder
formatBuilder
,
ImmutableMap
<
String
,
String
>
fmtpAttributes
)
{
Format
.
Builder
formatBuilder
,
ImmutableMap
<
String
,
String
>
fmtpAttributes
)
{
if
(
fmtpAttributes
.
containsKey
(
PARAMETER_
SPROP_H265
_MAX_DON_DIFF
))
{
if
(
fmtpAttributes
.
containsKey
(
PARAMETER_
H265_SPROP
_MAX_DON_DIFF
))
{
checkArgument
(
checkArgument
(
Integer
.
parseInt
(
checkNotNull
(
fmtpAttributes
.
get
(
PARAMETER_
SPROP_H265
_MAX_DON_DIFF
)))
Integer
.
parseInt
(
checkNotNull
(
fmtpAttributes
.
get
(
PARAMETER_
H265_SPROP
_MAX_DON_DIFF
)))
==
0
,
==
0
,
"non-zero sprop-max-don-diff is not supported"
);
"non-zero sprop-max-don-diff is not supported"
);
}
}
checkArgument
(
fmtpAttributes
.
containsKey
(
PARAMETER_
SPROP_H265
_VPS
));
checkArgument
(
fmtpAttributes
.
containsKey
(
PARAMETER_
H265_SPROP
_VPS
));
String
spropVPS
=
checkNotNull
(
fmtpAttributes
.
get
(
PARAMETER_
SPROP_H265
_VPS
));
String
spropVPS
=
checkNotNull
(
fmtpAttributes
.
get
(
PARAMETER_
H265_SPROP
_VPS
));
checkArgument
(
fmtpAttributes
.
containsKey
(
PARAMETER_
SPROP_H265
_SPS
));
checkArgument
(
fmtpAttributes
.
containsKey
(
PARAMETER_
H265_SPROP
_SPS
));
String
spropSPS
=
checkNotNull
(
fmtpAttributes
.
get
(
PARAMETER_
SPROP_H265
_SPS
));
String
spropSPS
=
checkNotNull
(
fmtpAttributes
.
get
(
PARAMETER_
H265_SPROP
_SPS
));
checkArgument
(
fmtpAttributes
.
containsKey
(
PARAMETER_
SPROP_H265
_PPS
));
checkArgument
(
fmtpAttributes
.
containsKey
(
PARAMETER_
H265_SPROP
_PPS
));
String
spropPPS
=
checkNotNull
(
fmtpAttributes
.
get
(
PARAMETER_
SPROP_H265
_PPS
));
String
spropPPS
=
checkNotNull
(
fmtpAttributes
.
get
(
PARAMETER_
H265_SPROP
_PPS
));
ImmutableList
<
byte
[]>
initializationData
=
ImmutableList
<
byte
[]>
initializationData
=
ImmutableList
.
of
(
ImmutableList
.
of
(
getInitializationDataFromParameterSet
(
spropVPS
),
getInitializationDataFromParameterSet
(
spropVPS
),
...
@@ -248,8 +248,7 @@ import com.google.common.collect.ImmutableMap;
...
@@ -248,8 +248,7 @@ import com.google.common.collect.ImmutableMap;
NalUnitUtil
.
parseH265SpsNalUnit
(
NalUnitUtil
.
parseH265SpsNalUnit
(
spsNalDataWithStartCode
,
NAL_START_CODE
.
length
,
spsNalDataWithStartCode
.
length
);
spsNalDataWithStartCode
,
NAL_START_CODE
.
length
,
spsNalDataWithStartCode
.
length
);
formatBuilder
.
setPixelWidthHeightRatio
(
spsData
.
pixelWidthHeightRatio
);
formatBuilder
.
setPixelWidthHeightRatio
(
spsData
.
pixelWidthHeightRatio
);
formatBuilder
.
setHeight
(
spsData
.
height
);
formatBuilder
.
setHeight
(
spsData
.
height
).
setWidth
(
spsData
.
width
);
formatBuilder
.
setWidth
(
spsData
.
width
);
formatBuilder
.
setCodecs
(
formatBuilder
.
setCodecs
(
CodecSpecificDataUtil
.
buildHevcCodecString
(
CodecSpecificDataUtil
.
buildHevcCodecString
(
...
...
libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpH265Reader.java
View file @
ca1c1c26
...
@@ -68,10 +68,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
...
@@ -68,10 +68,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
/** Scratch for Fragmentation Unit RTP packets. */
/** Scratch for Fragmentation Unit RTP packets. */
private
final
ParsableByteArray
fuScratchBuffer
;
private
final
ParsableByteArray
fuScratchBuffer
;
private
final
ParsableByteArray
nalStartCodeArray
;
private
final
ParsableByteArray
nalStartCodeArray
=
new
ParsableByteArray
(
NalUnitUtil
.
NAL_START_CODE
);
private
final
RtpPayloadFormat
payloadFormat
;
private
final
RtpPayloadFormat
payloadFormat
;
private
@MonotonicNonNull
TrackOutput
trackOutput
;
private
@MonotonicNonNull
TrackOutput
trackOutput
;
...
@@ -84,8 +81,9 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
...
@@ -84,8 +81,9 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
/** Creates an instance. */
/** Creates an instance. */
public
RtpH265Reader
(
RtpPayloadFormat
payloadFormat
)
{
public
RtpH265Reader
(
RtpPayloadFormat
payloadFormat
)
{
this
.
payloadFormat
=
payloadFormat
;
fuScratchBuffer
=
new
ParsableByteArray
();
fuScratchBuffer
=
new
ParsableByteArray
();
nalStartCodeArray
=
new
ParsableByteArray
(
NalUnitUtil
.
NAL_START_CODE
);
this
.
payloadFormat
=
payloadFormat
;
firstReceivedTimestamp
=
C
.
TIME_UNSET
;
firstReceivedTimestamp
=
C
.
TIME_UNSET
;
previousSequenceNumber
=
C
.
INDEX_UNSET
;
previousSequenceNumber
=
C
.
INDEX_UNSET
;
}
}
...
@@ -235,11 +233,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
...
@@ -235,11 +233,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
(
data
.
getData
()[
1
]
&
0x7
);
// last 3 bits in byte 1 of payload header, RFC7798 Section 1.1.4
(
data
.
getData
()[
1
]
&
0x7
);
// last 3 bits in byte 1 of payload header, RFC7798 Section 1.1.4
int
fuHeader
=
data
.
getData
()[
2
];
int
fuHeader
=
data
.
getData
()[
2
];
int
nalUnitType
=
fuHeader
&
0x3F
;
int
nalUnitType
=
fuHeader
&
0x3F
;
byte
nalHeader
[]
=
new
byte
[
2
];
nalHeader
[
0
]
=
(
byte
)
(
nalUnitType
<<
1
);
// RFC7798 Section 1.1.4
// layerId must be zero according to RFC7798 Section 1.1.4, so copying the tid only
nalHeader
[
1
]
=
(
byte
)
tid
;
boolean
isFirstFuPacket
=
(
fuHeader
&
0x80
)
>
0
;
boolean
isFirstFuPacket
=
(
fuHeader
&
0x80
)
>
0
;
boolean
isLastFuPacket
=
(
fuHeader
&
0x40
)
>
0
;
boolean
isLastFuPacket
=
(
fuHeader
&
0x40
)
>
0
;
...
@@ -249,12 +243,12 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
...
@@ -249,12 +243,12 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
// Overwrite a few bytes in Rtp buffer to get HEVC NAL Unit
// Overwrite a few bytes in Rtp buffer to get HEVC NAL Unit
// Rtp Byte 0 -> Ignore
// Rtp Byte 0 -> Ignore
// Rtp Byte 1 ->
Byte 0 of HEVC NAL Header
// Rtp Byte 1 ->
nal_unit_type, RFC7798 Section 1.1.4
// Rtp Byte 2 ->
Byte 1 of HEVC NAL Header
// Rtp Byte 2 ->
layerId required to be zero so copying only tid, RFC7798 Section 1.1.4
// Rtp Payload -> HEVC NAL bytes, so leave them unchanged
// Rtp Payload -> HEVC NAL bytes, so leave them unchanged
// Set data position from byte 1 as byte 0 was ignored
// Set data position from byte 1 as byte 0 was ignored
data
.
getData
()[
1
]
=
(
byte
)
nalHeader
[
0
]
;
data
.
getData
()[
1
]
=
(
byte
)
(
nalUnitType
<<
1
)
;
data
.
getData
()[
2
]
=
(
byte
)
nalHeader
[
1
]
;
data
.
getData
()[
2
]
=
(
byte
)
tid
;
fuScratchBuffer
.
reset
(
data
.
getData
());
fuScratchBuffer
.
reset
(
data
.
getData
());
fuScratchBuffer
.
setPosition
(
1
);
fuScratchBuffer
.
setPosition
(
1
);
}
else
{
}
else
{
...
...
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