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
dfef2d13
authored
Feb 08, 2022
by
Manisha Jajoo
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Some minor cleanup in RTPMpeg4Reader
parent
743437e3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 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/RtpMPEG4Reader.java
libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/RtspMediaTrack.java
View file @
dfef2d13
...
...
@@ -45,7 +45,7 @@ import com.google.common.collect.ImmutableMap;
// Format specific parameter names.
private
static
final
String
PARAMETER_PROFILE_LEVEL_ID
=
"profile-level-id"
;
private
static
final
String
PARAMETER_SPROP_PARAMS
=
"sprop-parameter-sets"
;
private
static
final
String
PARAMETER_CONFIG
=
"config"
;
private
static
final
String
PARAMETER_
MP4V_
CONFIG
=
"config"
;
/** Prefix for the RFC6381 codecs string for AAC formats. */
private
static
final
String
AAC_CODECS_PREFIX
=
"mp4a.40."
;
...
...
@@ -171,7 +171,7 @@ import com.google.common.collect.ImmutableMap;
private
static
void
processMPEG4FmtpAttribute
(
Format
.
Builder
formatBuilder
,
ImmutableMap
<
String
,
String
>
fmtpAttributes
)
{
@Nullable
String
configInput
=
fmtpAttributes
.
get
(
PARAMETER_CONFIG
);
@Nullable
String
configInput
=
fmtpAttributes
.
get
(
PARAMETER_
MP4V_
CONFIG
);
if
(
configInput
!=
null
)
{
byte
[]
csd
=
Util
.
getBytesFromHexString
(
configInput
);
ImmutableList
<
byte
[]>
initializationData
=
ImmutableList
.
of
(
csd
);
...
...
libraries/exoplayer_rtsp/src/main/java/androidx/media3/exoplayer/rtsp/reader/RtpMPEG4Reader.java
View file @
dfef2d13
...
...
@@ -30,7 +30,7 @@ import com.google.common.primitives.Bytes;
import
org.checkerframework.checker.nullness.qual.MonotonicNonNull
;
/**
* Parses an
H265 byte stream carried on RTP packets, and extracts H265
Access Units. Refer to
* Parses an
MPEG4 byte stream carried on RTP packets, and extracts MPEG4
Access Units. Refer to
* RFC6416 for more details.
*/
/* package */
final
class
RtpMPEG4Reader
implements
RtpPayloadReader
{
...
...
@@ -44,16 +44,11 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
private
static
final
int
I_VOP
=
0
;
private
final
RtpPayloadFormat
payloadFormat
;
private
@MonotonicNonNull
TrackOutput
trackOutput
;
@C
.
BufferFlags
private
int
bufferFlags
;
private
long
firstReceivedTimestamp
;
private
int
previousSequenceNumber
;
private
long
startTimeOffsetUs
;
private
int
sampleLength
;
/** Creates an instance. */
...
...
@@ -64,15 +59,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
sampleLength
=
0
;
}
private
static
long
toSampleUs
(
long
startTimeOffsetUs
,
long
rtpTimestamp
,
long
firstReceivedRtpTimestamp
)
{
return
startTimeOffsetUs
+
Util
.
scaleLargeTimestamp
(
(
rtpTimestamp
-
firstReceivedRtpTimestamp
),
/* multiplier= */
C
.
MICROS_PER_SECOND
,
/* divisor= */
MEDIA_CLOCK_FREQUENCY
);
}
@Override
public
void
createTracks
(
ExtractorOutput
extractorOutput
,
int
trackId
)
{
trackOutput
=
extractorOutput
.
track
(
trackId
,
C
.
TRACK_TYPE_VIDEO
);
...
...
@@ -113,6 +99,15 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
previousSequenceNumber
=
sequenceNumber
;
}
@Override
public
void
seek
(
long
nextRtpTimestamp
,
long
timeUs
)
{
firstReceivedTimestamp
=
nextRtpTimestamp
;
startTimeOffsetUs
=
timeUs
;
sampleLength
=
0
;
}
// Internal methods.
/**
* Parses VOP Coding type
*
...
...
@@ -130,15 +125,17 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
}
}
private
static
long
toSampleUs
(
long
startTimeOffsetUs
,
long
rtpTimestamp
,
long
firstReceivedRtpTimestamp
)
{
return
startTimeOffsetUs
+
Util
.
scaleLargeTimestamp
(
(
rtpTimestamp
-
firstReceivedRtpTimestamp
),
/* multiplier= */
C
.
MICROS_PER_SECOND
,
/* divisor= */
MEDIA_CLOCK_FREQUENCY
);
}
@C
.
BufferFlags
private
static
int
getBufferFlagsFromVopType
(
int
vopType
)
{
return
vopType
==
I_VOP
?
C
.
BUFFER_FLAG_KEY_FRAME
:
0
;
}
@Override
public
void
seek
(
long
nextRtpTimestamp
,
long
timeUs
)
{
firstReceivedTimestamp
=
nextRtpTimestamp
;
startTimeOffsetUs
=
timeUs
;
sampleLength
=
0
;
}
}
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