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
3a1325b0
authored
Apr 22, 2015
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Make TsExtractor consistent with AdtsExtractor.
parent
55e08ff7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
library/src/main/java/com/google/android/exoplayer/extractor/ts/TsExtractor.java
library/src/main/java/com/google/android/exoplayer/extractor/ts/TsExtractor.java
View file @
3a1325b0
...
...
@@ -49,7 +49,7 @@ public final class TsExtractor implements Extractor {
private
final
ParsableByteArray
tsPacketBuffer
;
private
final
SparseArray
<
ElementaryStreamReader
>
streamReaders
;
// Indexed by streamType
private
final
SparseArray
<
TsPayloadReader
>
tsPayloadReaders
;
// Indexed by pid
private
final
long
firstSampleTimestamp
;
private
final
long
firstSampleTimestamp
Us
;
private
final
ParsableBitArray
tsScratch
;
// Accessed only by the loading thread.
...
...
@@ -57,8 +57,12 @@ public final class TsExtractor implements Extractor {
private
long
timestampOffsetUs
;
private
long
lastPts
;
public
TsExtractor
(
long
firstSampleTimestamp
)
{
this
.
firstSampleTimestamp
=
firstSampleTimestamp
;
public
TsExtractor
()
{
this
(
0
);
}
public
TsExtractor
(
long
firstSampleTimestampUs
)
{
this
.
firstSampleTimestampUs
=
firstSampleTimestampUs
;
tsScratch
=
new
ParsableBitArray
(
new
byte
[
3
]);
tsPacketBuffer
=
new
ParsableByteArray
(
TS_PACKET_SIZE
);
streamReaders
=
new
SparseArray
<
ElementaryStreamReader
>();
...
...
@@ -138,7 +142,7 @@ public final class TsExtractor implements Extractor {
long
timeUs
=
(
pts
*
C
.
MICROS_PER_SECOND
)
/
90000
;
// If we haven't done the initial timestamp adjustment, do it now.
if
(
lastPts
==
Long
.
MIN_VALUE
)
{
timestampOffsetUs
=
firstSampleTimestamp
-
timeUs
;
timestampOffsetUs
=
firstSampleTimestamp
Us
-
timeUs
;
}
// Record the adjusted PTS to adjust for wraparound next time.
lastPts
=
pts
;
...
...
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