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
ef9393a3
authored
Feb 21, 2022
by
Manisha Jajoo
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Fix review comments on RtpMPEG4Reader
parent
706d5ac2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
10 deletions
libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspMediaTrack.java
libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpMPEG4Reader.java
libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspMediaTrack.java
View file @
ef9393a3
...
...
@@ -56,7 +56,7 @@ import com.google.common.collect.ImmutableMap;
/** Prefix for the RFC6381 codecs string for AVC formats. */
private
static
final
String
H264_CODECS_PREFIX
=
"avc1."
;
/** Prefix for the RFC6416 codecs string for MPEG4V-ES formats. */
private
static
final
String
MPEG4_CODECS_PREFIX
=
"mp4v"
;
private
static
final
String
MPEG4_CODECS_PREFIX
=
"mp4v
.
"
;
private
static
final
String
GENERIC_CONTROL_ATTR
=
"*"
;
...
...
@@ -181,12 +181,14 @@ import com.google.common.collect.ImmutableMap;
Format
.
Builder
formatBuilder
,
ImmutableMap
<
String
,
String
>
fmtpAttributes
)
{
@Nullable
String
configInput
=
fmtpAttributes
.
get
(
PARAMETER_MP4V_CONFIG
);
if
(
configInput
!=
null
)
{
byte
[]
c
sd
=
Util
.
getBytesFromHexString
(
configInput
);
formatBuilder
.
setInitializationData
(
ImmutableList
.
of
(
c
sd
));
byte
[]
c
onfigBuffer
=
Util
.
getBytesFromHexString
(
configInput
);
formatBuilder
.
setInitializationData
(
ImmutableList
.
of
(
c
onfigBuffer
));
Pair
<
Integer
,
Integer
>
resolution
=
CodecSpecificDataUtil
.
getVideoResolutionFromMpeg4VideoConfig
(
csd
);
formatBuilder
.
setWidth
(
resolution
.
first
);
formatBuilder
.
setHeight
(
resolution
.
second
);
CodecSpecificDataUtil
.
getVideoResolutionFromMpeg4VideoConfig
(
configBuffer
);
formatBuilder
.
setWidth
(
resolution
.
first
).
setHeight
(
resolution
.
second
);
}
else
{
// set the default width and height
formatBuilder
.
setWidth
(
352
).
setHeight
(
288
);
}
@Nullable
String
profileLevel
=
fmtpAttributes
.
get
(
PARAMETER_PROFILE_LEVEL_ID
);
formatBuilder
.
setCodecs
(
MPEG4_CODECS_PREFIX
+
(
profileLevel
==
null
?
"1"
:
profileLevel
));
...
...
libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpMPEG4Reader.java
View file @
ef9393a3
...
...
@@ -88,7 +88,9 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
// Parse VOP Type and get the buffer flags
int
limit
=
data
.
bytesLeft
();
trackOutput
.
sampleData
(
data
,
limit
);
if
(
sampleLength
==
0
)
bufferFlags
=
getBufferFlagsFromVop
(
data
);
if
(
sampleLength
==
0
)
{
bufferFlags
=
getBufferFlagsFromVop
(
data
);
}
sampleLength
+=
limit
;
// Marker (M) bit: The marker bit is set to 1 to indicate the last RTP
...
...
@@ -122,7 +124,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
*/
@C
.
BufferFlags
private
static
int
getBufferFlagsFromVop
(
ParsableByteArray
data
)
{
int
flags
=
0
;
// search for VOP_START_CODE (00 00 01 B6)
byte
[]
inputData
=
data
.
getData
();
byte
[]
startCode
=
new
byte
[]
{
0x0
,
0x0
,
0x1
,
(
byte
)
0xB6
};
...
...
@@ -130,9 +131,9 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
if
(
vopStartCodePos
!=
-
1
)
{
data
.
setPosition
(
vopStartCodePos
+
4
);
int
vopType
=
data
.
peekUnsignedByte
()
>>
6
;
flags
=
vopType
==
I_VOP
?
C
.
BUFFER_FLAG_KEY_FRAME
:
0
;
return
(
vopType
==
I_VOP
?
C
.
BUFFER_FLAG_KEY_FRAME
:
0
)
;
}
return
flags
;
return
0
;
}
private
static
long
toSampleUs
(
...
...
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