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
531959c6
authored
Apr 13, 2023
by
michaelkatz
Committed by
Rohit Singh
Apr 17, 2023
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Use default profile-level-id if absent in Describe SDP for MPEG4-LATM
PiperOrigin-RevId: 524003092
parent
07707c20
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
4 deletions
library/rtsp/src/main/java/com/google/android/exoplayer2/source/rtsp/RtspMediaTrack.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/RtspMediaTrack.java
View file @
531959c6
...
...
@@ -227,7 +227,8 @@ import com.google.common.collect.ImmutableMap;
.
setChannelCount
(
aacConfig
.
channelCount
)
.
setCodecs
(
aacConfig
.
codecs
);
}
processAacFmtpAttribute
(
formatBuilder
,
fmtpParameters
,
channelCount
,
clockRate
);
processAacFmtpAttribute
(
formatBuilder
,
fmtpParameters
,
mediaEncoding
,
channelCount
,
clockRate
);
break
;
case
MimeTypes
.
AUDIO_AMR_NB
:
case
MimeTypes
.
AUDIO_AMR_WB
:
...
...
@@ -309,11 +310,17 @@ import com.google.common.collect.ImmutableMap;
private
static
void
processAacFmtpAttribute
(
Format
.
Builder
formatBuilder
,
ImmutableMap
<
String
,
String
>
fmtpAttributes
,
String
mediaEncoding
,
int
channelCount
,
int
sampleRate
)
{
@Nullable
String
profileLevel
=
fmtpAttributes
.
get
(
PARAMETER_PROFILE_LEVEL_ID
);
if
(
profileLevel
==
null
&&
mediaEncoding
.
equals
(
RtpPayloadFormat
.
RTP_MEDIA_MPEG4_LATM_AUDIO
))
{
// As defined in RFC3016 Section 5.3 for MPEG4-LATM, if profile-level-id is not specified,
// then a default value of 30 should be used.
profileLevel
=
"30"
;
}
checkArgument
(
fmtpAttributes
.
containsKey
(
PARAMETER_PROFILE_LEVEL_ID
),
"missing profile-level-id param"
);
String
profileLevel
=
checkNotNull
(
fmtpAttributes
.
get
(
PARAMETER_PROFILE_LEVEL_ID
));
profileLevel
!=
null
&&
!
profileLevel
.
isEmpty
(),
"missing profile-level-id param"
);
formatBuilder
.
setCodecs
(
AAC_CODECS_PREFIX
+
profileLevel
);
formatBuilder
.
setInitializationData
(
ImmutableList
.
of
(
...
...
library/rtsp/src/test/java/com/google/android/exoplayer2/source/rtsp/RtspMediaTrackTest.java
View file @
531959c6
...
...
@@ -404,6 +404,22 @@ public class RtspMediaTrackTest {
@Test
public
void
generatePayloadFormat_withMpeg4LatmMediaDescriptionMissingProfileLevel_generatesCorrectProfileLevel
()
{
MediaDescription
mediaDescription
=
new
MediaDescription
.
Builder
(
MEDIA_TYPE_AUDIO
,
/* port= */
0
,
RTP_AVP_PROFILE
,
/* payloadType= */
96
)
.
setConnection
(
"IN IP4 0.0.0.0"
)
.
setBitrate
(
96_000
)
.
addAttribute
(
ATTR_RTPMAP
,
"96 MP4A-LATM/44100"
)
.
addAttribute
(
ATTR_FMTP
,
"96 config=40002410adca00; cpresent=0"
)
.
addAttribute
(
ATTR_CONTROL
,
"track1"
)
.
build
();
RtpPayloadFormat
rtpPayloadFormat
=
RtspMediaTrack
.
generatePayloadFormat
(
mediaDescription
);
assertThat
(
rtpPayloadFormat
.
format
.
codecs
).
isEqualTo
(
"mp4a.40.30"
);
}
@Test
public
void
generatePayloadFormat_withAacMediaDescriptionMissingFmtpAttribute_throwsIllegalArgumentException
()
{
MediaDescription
mediaDescription
=
new
MediaDescription
.
Builder
(
...
...
@@ -420,7 +436,7 @@ public class RtspMediaTrackTest {
@Test
public
void
generatePayloadFormat_withMediaDescriptionMissingProfileLevel_throwsIllegalArgumentException
()
{
generatePayloadFormat_withM
peg4GenericM
ediaDescriptionMissingProfileLevel_throwsIllegalArgumentException
()
{
MediaDescription
mediaDescription
=
new
MediaDescription
.
Builder
(
MEDIA_TYPE_AUDIO
,
/* port= */
0
,
RTP_AVP_PROFILE
,
/* payloadType= */
97
)
...
...
@@ -439,6 +455,25 @@ public class RtspMediaTrackTest {
@Test
public
void
generatePayloadFormat_withMpeg4GenericMediaDescriptionEmptyProfileLevel_throwsIllegalArgumentException
()
{
MediaDescription
mediaDescription
=
new
MediaDescription
.
Builder
(
MEDIA_TYPE_AUDIO
,
/* port= */
0
,
RTP_AVP_PROFILE
,
/* payloadType= */
97
)
.
setConnection
(
"IN IP4 0.0.0.0"
)
.
setBitrate
(
96_000
)
.
addAttribute
(
ATTR_RTPMAP
,
"97 MPEG4-GENERIC/44100"
)
.
addAttribute
(
ATTR_FMTP
,
"97 streamtype=5;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3;config=1208;profile-level-id=;"
)
.
addAttribute
(
ATTR_CONTROL
,
"track1"
)
.
build
();
assertThrows
(
IllegalArgumentException
.
class
,
()
->
RtspMediaTrack
.
generatePayloadFormat
(
mediaDescription
));
}
@Test
public
void
generatePayloadFormat_withH264MediaDescriptionMissingFmtpAttribute_throwsIllegalArgumentException
()
{
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