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
624d212d
authored
Sep 07, 2021
by
claincly
Committed by
Christos Tsilopoulos
Sep 16, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Handle when additional spaces are in SDP's RTPMAP atrribute
Issue: #9379 PiperOrigin-RevId: 395226701
parent
28d5b357
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
10 deletions
RELEASENOTES.md
library/rtsp/src/main/java/com/google/android/exoplayer2/source/rtsp/MediaDescription.java
library/rtsp/src/main/java/com/google/android/exoplayer2/source/rtsp/RtspMediaTrack.java
library/rtsp/src/test/java/com/google/android/exoplayer2/source/rtsp/SessionDescriptionTest.java
RELEASENOTES.md
View file @
624d212d
...
...
@@ -18,6 +18,9 @@
thrown from
`Requirements.isInternetConnectivityValidated`
on devices
running Android 11
(
[
#9002
](
https://github.com/google/ExoPlayer/issues/9002
)
).
*
RTSP:
*
Handle when additional spaces are in SDP's RTPMAP atrribute
(
[
#9379
](
https://github.com/google/ExoPlayer/issues/9379
)
).
*
UI:
*
Use
`defStyleAttr`
when obtaining styled attributes in
`StyledPlayerView`
,
`PlayerView`
and
`PlayerControlView`
...
...
library/rtsp/src/main/java/com/google/android/exoplayer2/source/rtsp/MediaDescription.java
View file @
624d212d
...
...
@@ -43,11 +43,11 @@ import java.util.HashMap;
/** Parses the RTPMAP attribute value (with the part "a=rtpmap:" removed). */
public
static
RtpMapAttribute
parse
(
String
rtpmapString
)
throws
ParserException
{
String
[]
rtpmapInfo
=
Util
.
split
(
rtpmapString
,
" "
);
String
[]
rtpmapInfo
=
Util
.
split
AtFirst
(
rtpmapString
,
" "
);
checkArgument
(
rtpmapInfo
.
length
==
2
);
int
payloadType
=
parseInt
(
rtpmapInfo
[
0
]);
String
[]
mediaInfo
=
Util
.
split
(
rtpmapInfo
[
1
],
"/"
);
String
[]
mediaInfo
=
Util
.
split
(
rtpmapInfo
[
1
]
.
trim
()
,
"/"
);
checkArgument
(
mediaInfo
.
length
>=
2
);
int
clockRate
=
parseInt
(
mediaInfo
[
1
]);
int
encodingParameters
=
C
.
INDEX_UNSET
;
...
...
library/rtsp/src/main/java/com/google/android/exoplayer2/source/rtsp/RtspMediaTrack.java
View file @
624d212d
...
...
@@ -18,7 +18,6 @@ package com.google.android.exoplayer2.source.rtsp;
import
static
com
.
google
.
android
.
exoplayer2
.
source
.
rtsp
.
MediaDescription
.
MEDIA_TYPE_AUDIO
;
import
static
com
.
google
.
android
.
exoplayer2
.
source
.
rtsp
.
RtpPayloadFormat
.
getMimeTypeFromRtpMediaType
;
import
static
com
.
google
.
android
.
exoplayer2
.
source
.
rtsp
.
SessionDescription
.
ATTR_CONTROL
;
import
static
com
.
google
.
android
.
exoplayer2
.
source
.
rtsp
.
SessionDescription
.
ATTR_RTPMAP
;
import
static
com
.
google
.
android
.
exoplayer2
.
util
.
Assertions
.
checkArgument
;
import
static
com
.
google
.
android
.
exoplayer2
.
util
.
Assertions
.
checkNotNull
;
import
static
com
.
google
.
android
.
exoplayer2
.
util
.
NalUnitUtil
.
NAL_START_CODE
;
...
...
@@ -95,13 +94,6 @@ import com.google.common.collect.ImmutableMap;
formatBuilder
.
setAverageBitrate
(
mediaDescription
.
bitrate
);
}
// rtpmap is mandatory in an RTSP session with dynamic payload types (RFC2326 Section C.1.3).
checkArgument
(
mediaDescription
.
attributes
.
containsKey
(
ATTR_RTPMAP
));
String
rtpmapAttribute
=
castNonNull
(
mediaDescription
.
attributes
.
get
(
ATTR_RTPMAP
));
// rtpmap string format: RFC2327 Page 22.
String
[]
rtpmap
=
Util
.
split
(
rtpmapAttribute
,
" "
);
checkArgument
(
rtpmap
.
length
==
2
);
int
rtpPayloadType
=
mediaDescription
.
rtpMapAttribute
.
payloadType
;
String
mimeType
=
getMimeTypeFromRtpMediaType
(
mediaDescription
.
rtpMapAttribute
.
mediaEncoding
);
...
...
library/rtsp/src/test/java/com/google/android/exoplayer2/source/rtsp/SessionDescriptionTest.java
View file @
624d212d
...
...
@@ -192,6 +192,25 @@ public class SessionDescriptionTest {
}
@Test
public
void
parse_sdpStringWithExtraSpaceInRtpMapAttribute_succeeds
()
throws
Exception
{
String
testMediaSdpInfo
=
"v=0\r\n"
+
"o=MNobody 2890844526 2890842807 IN IP4 192.0.2.46\r\n"
+
"s=SDP Seminar\r\n"
+
"t=0 0\r\n"
+
"a=control:*\r\n"
+
"m=audio 3456 RTP/AVP 0\r\n"
+
"a=rtpmap:97 AC3/44100 \r\n"
;
SessionDescription
sessionDescription
=
SessionDescriptionParser
.
parse
(
testMediaSdpInfo
);
MediaDescription
.
RtpMapAttribute
rtpMapAttribute
=
sessionDescription
.
mediaDescriptionList
.
get
(
0
).
rtpMapAttribute
;
assertThat
(
rtpMapAttribute
.
payloadType
).
isEqualTo
(
97
);
assertThat
(
rtpMapAttribute
.
mediaEncoding
).
isEqualTo
(
"AC3"
);
assertThat
(
rtpMapAttribute
.
clockRate
).
isEqualTo
(
44100
);
}
@Test
public
void
buildMediaDescription_withInvalidRtpmapAttribute_throwsIllegalStateException
()
{
assertThrows
(
IllegalStateException
.
class
,
...
...
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