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
6f67cb83
authored
Aug 02, 2021
by
Colin Barr
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Handle trailing semicolon on RTSP fmtp attribute
parent
f329adbc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
1 deletions
library/rtsp/src/main/java/com/google/android/exoplayer2/source/rtsp/MediaDescription.java
library/rtsp/src/test/java/com/google/android/exoplayer2/source/rtsp/RtspMediaTrackTest.java
library/rtsp/src/main/java/com/google/android/exoplayer2/source/rtsp/MediaDescription.java
View file @
6f67cb83
...
...
@@ -314,7 +314,8 @@ import java.util.HashMap;
// Format of the parameter: RFC3640 Section 4.4.1:
// <parameter name>=<value>[; <parameter name>=<value>].
String
[]
parameters
=
Util
.
split
(
fmtpComponents
[
1
],
";\\s?"
);
// Split with implicit limit of 0 to handle an optional trailing semicolon.
String
[]
parameters
=
fmtpComponents
[
1
].
split
(
";\\s?"
);
ImmutableMap
.
Builder
<
String
,
String
>
formatParametersBuilder
=
new
ImmutableMap
.
Builder
<>();
for
(
String
parameter
:
parameters
)
{
// The parameter values can bear equal signs, so splitAtFirst must be used.
...
...
library/rtsp/src/test/java/com/google/android/exoplayer2/source/rtsp/RtspMediaTrackTest.java
View file @
6f67cb83
...
...
@@ -81,6 +81,48 @@ public class RtspMediaTrackTest {
}
@Test
public
void
generatePayloadFormat_withH264MediaDescriptionAndFmtpTrailingSemicolon_succeeds
()
{
MediaDescription
mediaDescription
=
new
MediaDescription
.
Builder
(
MEDIA_TYPE_VIDEO
,
/* port= */
0
,
RTP_AVP_PROFILE
,
/* payloadType= */
96
)
.
setConnection
(
"IN IP4 0.0.0.0"
)
.
setBitrate
(
500_000
)
.
addAttribute
(
ATTR_RTPMAP
,
"96 H264/90000"
)
.
addAttribute
(
ATTR_FMTP
,
"96 packetization-mode=1;profile-level-id=64001F;sprop-parameter-sets=Z2QAH6zZQPARabIAAAMACAAAAwGcHjBjLA==,aOvjyyLA;"
)
.
addAttribute
(
ATTR_CONTROL
,
"track1"
)
.
build
();
RtpPayloadFormat
format
=
RtspMediaTrack
.
generatePayloadFormat
(
mediaDescription
);
RtpPayloadFormat
expectedFormat
=
new
RtpPayloadFormat
(
new
Format
.
Builder
()
.
setSampleMimeType
(
MimeTypes
.
VIDEO_H264
)
.
setAverageBitrate
(
500_000
)
.
setPixelWidthHeightRatio
(
1.0f
)
.
setHeight
(
544
)
.
setWidth
(
960
)
.
setCodecs
(
"avc1.64001F"
)
.
setInitializationData
(
ImmutableList
.
of
(
new
byte
[]
{
0
,
0
,
0
,
1
,
103
,
100
,
0
,
31
,
-
84
,
-
39
,
64
,
-
16
,
17
,
105
,
-
78
,
0
,
0
,
3
,
0
,
8
,
0
,
0
,
3
,
1
,
-
100
,
30
,
48
,
99
,
44
},
new
byte
[]
{
0
,
0
,
0
,
1
,
104
,
-
21
,
-
29
,
-
53
,
34
,
-
64
}))
.
build
(),
/* rtpPayloadType= */
96
,
/* clockRate= */
90_000
,
/* fmtpParameters= */
ImmutableMap
.
of
(
"packetization-mode"
,
"1"
,
"profile-level-id"
,
"64001F"
,
"sprop-parameter-sets"
,
"Z2QAH6zZQPARabIAAAMACAAAAwGcHjBjLA==,aOvjyyLA"
));
assertThat
(
format
).
isEqualTo
(
expectedFormat
);
}
@Test
public
void
generatePayloadFormat_withAacMediaDescription_succeeds
()
{
MediaDescription
mediaDescription
=
new
MediaDescription
.
Builder
(
...
...
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