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
0ac84fe1
authored
Oct 03, 2022
by
Rakesh Kumar
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Fix review comment in mp4a-latm Reader
Change-Id: I004f4a9ed9bd7cc48708d82a01c945789d1e9e5e
parent
9f8d6992
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
24 deletions
libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspMediaTrack.java
libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpMp4aReader.java
libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspMediaTrack.java
View file @
0ac84fe1
...
@@ -55,7 +55,7 @@ import com.google.common.collect.ImmutableMap;
...
@@ -55,7 +55,7 @@ import com.google.common.collect.ImmutableMap;
private
static
final
String
PARAMETER_H265_SPROP_VPS
=
"sprop-vps"
;
private
static
final
String
PARAMETER_H265_SPROP_VPS
=
"sprop-vps"
;
private
static
final
String
PARAMETER_H265_SPROP_MAX_DON_DIFF
=
"sprop-max-don-diff"
;
private
static
final
String
PARAMETER_H265_SPROP_MAX_DON_DIFF
=
"sprop-max-don-diff"
;
private
static
final
String
PARAMETER_MP4V_CONFIG
=
"config"
;
private
static
final
String
PARAMETER_MP4V_CONFIG
=
"config"
;
private
static
final
String
PARAMETER_MP4A_CPRESENT
=
"cpresent"
;
private
static
final
String
PARAMETER_MP4A_C
_
PRESENT
=
"cpresent"
;
/** 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."
;
...
@@ -212,13 +212,13 @@ import com.google.common.collect.ImmutableMap;
...
@@ -212,13 +212,13 @@ import com.google.common.collect.ImmutableMap;
checkArgument
(
channelCount
!=
C
.
INDEX_UNSET
);
checkArgument
(
channelCount
!=
C
.
INDEX_UNSET
);
checkArgument
(!
fmtpParameters
.
isEmpty
());
checkArgument
(!
fmtpParameters
.
isEmpty
());
if
(
mediaEncoding
.
equals
(
RtpPayloadFormat
.
RTP_MEDIA_MPEG4_AUDIO
))
{
if
(
mediaEncoding
.
equals
(
RtpPayloadFormat
.
RTP_MEDIA_MPEG4_AUDIO
))
{
boolean
isC
Present
=
true
;
boolean
isC
onfigPresent
=
true
;
if
(
fmtpParameters
.
get
(
PARAMETER_MP4A_CPRESENT
)
!=
null
&&
fmtpParameters
.
get
(
if
(
fmtpParameters
.
get
(
PARAMETER_MP4A_C
_
PRESENT
)
!=
null
&&
fmtpParameters
.
get
(
PARAMETER_MP4A_CPRESENT
).
equals
(
"0"
))
{
PARAMETER_MP4A_C
_
PRESENT
).
equals
(
"0"
))
{
isC
Present
=
false
;
isC
onfigPresent
=
false
;
}
}
@Nullable
String
configInput
=
fmtpParameters
.
get
(
PARAMETER_MP4V_CONFIG
);
@Nullable
String
configInput
=
fmtpParameters
.
get
(
PARAMETER_MP4V_CONFIG
);
if
(!
isC
Present
&&
configInput
!=
null
&&
configInput
.
length
()
%
2
==
0
)
{
if
(!
isC
onfigPresent
&&
configInput
!=
null
&&
configInput
.
length
()
%
2
==
0
)
{
Pair
<
Integer
,
Integer
>
configParameters
=
getSampleRateAndChannelCount
(
configInput
);
Pair
<
Integer
,
Integer
>
configParameters
=
getSampleRateAndChannelCount
(
configInput
);
channelCount
=
configParameters
.
first
;
channelCount
=
configParameters
.
first
;
clockRate
=
configParameters
.
second
;
clockRate
=
configParameters
.
second
;
...
@@ -326,25 +326,22 @@ import com.google.common.collect.ImmutableMap;
...
@@ -326,25 +326,22 @@ import com.google.common.collect.ImmutableMap;
* configuration (ISO/IEC14496-3, Chapter 1.7.3).
* configuration (ISO/IEC14496-3, Chapter 1.7.3).
*/
*/
private
static
Pair
<
Integer
,
Integer
>
getSampleRateAndChannelCount
(
String
configInput
)
{
private
static
Pair
<
Integer
,
Integer
>
getSampleRateAndChannelCount
(
String
configInput
)
{
int
channelCount
=
0
,
sampleRate
=
0
;
ParsableBitArray
config
=
new
ParsableBitArray
(
Util
.
getBytesFromHexString
(
configInput
));
byte
[]
configBuffer
=
Util
.
getBytesFromHexString
(
configInput
);
int
audioMuxVersion
=
config
.
readBits
(
1
);
ParsableBitArray
scratchBits
=
new
ParsableBitArray
(
configBuffer
);
int
audioMuxVersion
=
scratchBits
.
readBits
(
1
);
if
(
audioMuxVersion
==
0
)
{
if
(
audioMuxVersion
==
0
)
{
checkArgument
(
scratchBits
.
readBits
(
1
)
==
1
,
"Invalid
allStreamsSameTimeFraming."
);
checkArgument
(
config
.
readBits
(
1
)
==
1
,
"Only supports one
allStreamsSameTimeFraming."
);
scratchBits
.
readBits
(
6
);
config
.
readBits
(
6
);
checkArgument
(
scratchBits
.
readBits
(
4
)
==
0
,
"Invalid numP
rogram."
);
checkArgument
(
config
.
readBits
(
4
)
==
0
,
"Only supports one p
rogram."
);
checkArgument
(
scratchBits
.
readBits
(
3
)
==
0
,
"Invalid
numLayer."
);
checkArgument
(
config
.
readBits
(
3
)
==
0
,
"Only supports one
numLayer."
);
@Nullable
AacUtil
.
Config
aacConfig
=
null
;
@Nullable
AacUtil
.
Config
aacConfig
=
null
;
try
{
try
{
aacConfig
=
AacUtil
.
parseAudioSpecificConfig
(
scratchBits
,
false
);
aacConfig
=
AacUtil
.
parseAudioSpecificConfig
(
config
,
false
);
}
catch
(
ParserException
e
)
{
}
catch
(
ParserException
e
)
{
throw
new
IllegalArgumentException
(
e
);
throw
new
IllegalArgumentException
(
e
);
}
}
sampleRate
=
aacConfig
.
sampleRateHz
;
return
Pair
.
create
(
aacConfig
.
channelCount
,
aacConfig
.
sampleRateHz
);
channelCount
=
aacConfig
.
channelCount
;
}
}
return
Pair
.
create
(
channelCount
,
sampleRate
);
throw
new
IllegalArgumentException
(
"Only support audio mux version 0"
);
}
}
private
static
void
processMPEG4FmtpAttribute
(
private
static
void
processMPEG4FmtpAttribute
(
...
...
libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpMp4aReader.java
View file @
0ac84fe1
...
@@ -104,18 +104,14 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
...
@@ -104,18 +104,14 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
* Each subframe starts with a variable length encoding.
* Each subframe starts with a variable length encoding.
*/
*/
for
(;
audioPayloadOffset
<
data
.
bytesLeft
();
audioPayloadOffset
++)
{
for
(;
audioPayloadOffset
<
data
.
bytesLeft
();
audioPayloadOffset
++)
{
int
payloadMuxLength
=
data
.
peek
UnsignedByte
();
int
payloadMuxLength
=
data
.
read
UnsignedByte
();
sampleLength
+=
payloadMuxLength
;
sampleLength
+=
payloadMuxLength
;
if
(
payloadMuxLength
!=
0xff
)
{
if
(
payloadMuxLength
!=
0xff
)
{
break
;
break
;
}
else
{
data
.
setPosition
(
audioPayloadOffset
+
1
);
}
}
}
}
audioPayloadOffset
++;
data
.
setPosition
(
audioPayloadOffset
);
/
* Write the audio sample */
/
/ Write the audio sample
trackOutput
.
sampleData
(
data
,
sampleLength
);
trackOutput
.
sampleData
(
data
,
sampleLength
);
audioPayloadOffset
+=
sampleLength
;
audioPayloadOffset
+=
sampleLength
;
fragmentedSampleSizeBytes
+=
sampleLength
;
fragmentedSampleSizeBytes
+=
sampleLength
;
...
...
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