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
d2fb9dda
authored
Oct 20, 2020
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Merge pull request #8088 from xufuji456:dev-v2
PiperOrigin-RevId: 338024866
parent
e7208271
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
30 deletions
RELEASENOTES.md
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mp4/AtomParsers.java
library/extractor/src/test/java/com/google/android/exoplayer2/extractor/mp4/AtomParsersTest.java
RELEASENOTES.md
View file @
d2fb9dda
...
@@ -36,9 +36,11 @@
...
@@ -36,9 +36,11 @@
even though the class was not used
even though the class was not used
(
[
#8058
](
https://github.com/google/ExoPlayer/issues/8058
)
).
(
[
#8058
](
https://github.com/google/ExoPlayer/issues/8058
)
).
*
Extractors:
*
Extractors:
*
Add support for
.mp2 boxes in the
`AtomParsers
`
*
Add support for
`_mp2`
boxes in
`Mp4Extractor
`
(
[
#7967
](
https://github.com/google/ExoPlayer/issues/7967
)
).
(
[
#7967
](
https://github.com/google/ExoPlayer/issues/7967
)
).
*
Use TLEN ID3 tag to compute the duration in Mp3Extractor
*
Fix playback of MP4 and MOV files containing
`pcm_alaw`
or
`pcm_mulaw`
audio tracks, by enabling sample rechunking of such tracks
*
Use TLEN ID3 tag to compute the duration in
`Mp3Extractor`
(
[
#7949
](
https://github.com/google/ExoPlayer/issues/7949
)
).
(
[
#7949
](
https://github.com/google/ExoPlayer/issues/7949
)
).
*
Fix regression for Ogg files with packets that span multiple pages
*
Fix regression for Ogg files with packets that span multiple pages
(
[
#7992
](
https://github.com/google/ExoPlayer/issues/7992
)
).
(
[
#7992
](
https://github.com/google/ExoPlayer/issues/7992
)
).
...
...
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mp4/AtomParsers.java
View file @
d2fb9dda
...
@@ -384,9 +384,13 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
...
@@ -384,9 +384,13 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
}
}
// Fixed sample size raw audio may need to be rechunked.
// Fixed sample size raw audio may need to be rechunked.
boolean
isFixedSampleSizeRawAudio
=
int
fixedSampleSize
=
sampleSizeBox
.
getFixedSampleSize
();
sampleSizeBox
.
isFixedSampleSize
()
@Nullable
String
sampleMimeType
=
track
.
format
.
sampleMimeType
;
&&
MimeTypes
.
AUDIO_RAW
.
equals
(
track
.
format
.
sampleMimeType
)
boolean
rechunkFixedSizeSamples
=
fixedSampleSize
!=
C
.
LENGTH_UNSET
&&
(
MimeTypes
.
AUDIO_RAW
.
equals
(
sampleMimeType
)
||
MimeTypes
.
AUDIO_MLAW
.
equals
(
sampleMimeType
)
||
MimeTypes
.
AUDIO_ALAW
.
equals
(
sampleMimeType
))
&&
remainingTimestampDeltaChanges
==
0
&&
remainingTimestampDeltaChanges
==
0
&&
remainingTimestampOffsetChanges
==
0
&&
remainingTimestampOffsetChanges
==
0
&&
remainingSynchronizationSamples
==
0
;
&&
remainingSynchronizationSamples
==
0
;
...
@@ -399,15 +403,13 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
...
@@ -399,15 +403,13 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
long
timestampTimeUnits
=
0
;
long
timestampTimeUnits
=
0
;
long
duration
;
long
duration
;
if
(
isFixedSampleSizeRawAudio
)
{
if
(
rechunkFixedSizeSamples
)
{
long
[]
chunkOffsetsBytes
=
new
long
[
chunkIterator
.
length
];
long
[]
chunkOffsetsBytes
=
new
long
[
chunkIterator
.
length
];
int
[]
chunkSampleCounts
=
new
int
[
chunkIterator
.
length
];
int
[]
chunkSampleCounts
=
new
int
[
chunkIterator
.
length
];
while
(
chunkIterator
.
moveNext
())
{
while
(
chunkIterator
.
moveNext
())
{
chunkOffsetsBytes
[
chunkIterator
.
index
]
=
chunkIterator
.
offset
;
chunkOffsetsBytes
[
chunkIterator
.
index
]
=
chunkIterator
.
offset
;
chunkSampleCounts
[
chunkIterator
.
index
]
=
chunkIterator
.
numSamples
;
chunkSampleCounts
[
chunkIterator
.
index
]
=
chunkIterator
.
numSamples
;
}
}
int
fixedSampleSize
=
Util
.
getPcmFrameSize
(
track
.
format
.
pcmEncoding
,
track
.
format
.
channelCount
);
FixedSampleSizeRechunker
.
Results
rechunkedResults
=
FixedSampleSizeRechunker
.
Results
rechunkedResults
=
FixedSampleSizeRechunker
.
rechunk
(
FixedSampleSizeRechunker
.
rechunk
(
fixedSampleSize
,
chunkOffsetsBytes
,
chunkSampleCounts
,
timestampDeltaInTimeUnits
);
fixedSampleSize
,
chunkOffsetsBytes
,
chunkSampleCounts
,
timestampDeltaInTimeUnits
);
...
@@ -1661,16 +1663,11 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
...
@@ -1661,16 +1663,11 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
*/
*/
int
getSampleCount
();
int
getSampleCount
();
/**
/** Returns the size of each sample if fixed, or {@link C#LENGTH_UNSET} otherwise. */
* Returns the size for the next sample.
int
getFixedSampleSize
();
*/
int
readNextSampleSize
();
/**
* Returns whether samples have a fixed size.
*/
boolean
isFixedSampleSize
();
/** Returns the size for the next sample. */
int
readNextSampleSize
();
}
}
/**
/**
...
@@ -1685,7 +1682,8 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
...
@@ -1685,7 +1682,8 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
public
StszSampleSizeBox
(
Atom
.
LeafAtom
stszAtom
)
{
public
StszSampleSizeBox
(
Atom
.
LeafAtom
stszAtom
)
{
data
=
stszAtom
.
data
;
data
=
stszAtom
.
data
;
data
.
setPosition
(
Atom
.
FULL_HEADER_SIZE
);
data
.
setPosition
(
Atom
.
FULL_HEADER_SIZE
);
fixedSampleSize
=
data
.
readUnsignedIntToInt
();
int
fixedSampleSize
=
data
.
readUnsignedIntToInt
();
this
.
fixedSampleSize
=
fixedSampleSize
==
0
?
C
.
LENGTH_UNSET
:
fixedSampleSize
;
sampleCount
=
data
.
readUnsignedIntToInt
();
sampleCount
=
data
.
readUnsignedIntToInt
();
}
}
...
@@ -1695,15 +1693,14 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
...
@@ -1695,15 +1693,14 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
}
}
@Override
@Override
public
int
readNext
SampleSize
()
{
public
int
getFixed
SampleSize
()
{
return
fixedSampleSize
==
0
?
data
.
readUnsignedIntToInt
()
:
fixedSampleSize
;
return
fixedSampleSize
;
}
}
@Override
@Override
public
boolean
isFixed
SampleSize
()
{
public
int
readNext
SampleSize
()
{
return
fixedSampleSize
!=
0
;
return
fixedSampleSize
==
C
.
LENGTH_UNSET
?
data
.
readUnsignedIntToInt
()
:
fixedSampleSize
;
}
}
}
}
/**
/**
...
@@ -1732,6 +1729,11 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
...
@@ -1732,6 +1729,11 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
}
}
@Override
@Override
public
int
getFixedSampleSize
()
{
return
C
.
LENGTH_UNSET
;
}
@Override
public
int
readNextSampleSize
()
{
public
int
readNextSampleSize
()
{
if
(
fieldSize
==
8
)
{
if
(
fieldSize
==
8
)
{
return
data
.
readUnsignedByte
();
return
data
.
readUnsignedByte
();
...
@@ -1750,12 +1752,6 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
...
@@ -1750,12 +1752,6 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
}
}
}
}
}
}
@Override
public
boolean
isFixedSampleSize
()
{
return
false
;
}
}
}
}
}
library/extractor/src/test/java/com/google/android/exoplayer2/extractor/mp4/AtomParsersTest.java
View file @
d2fb9dda
...
@@ -18,6 +18,7 @@ package com.google.android.exoplayer2.extractor.mp4;
...
@@ -18,6 +18,7 @@ package com.google.android.exoplayer2.extractor.mp4;
import
static
com
.
google
.
common
.
truth
.
Truth
.
assertThat
;
import
static
com
.
google
.
common
.
truth
.
Truth
.
assertThat
;
import
androidx.test.ext.junit.runners.AndroidJUnit4
;
import
androidx.test.ext.junit.runners.AndroidJUnit4
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.util.ParsableByteArray
;
import
com.google.android.exoplayer2.util.ParsableByteArray
;
import
com.google.android.exoplayer2.util.Util
;
import
com.google.android.exoplayer2.util.Util
;
import
org.junit.Test
;
import
org.junit.Test
;
...
@@ -64,7 +65,7 @@ public final class AtomParsersTest {
...
@@ -64,7 +65,7 @@ public final class AtomParsersTest {
private
static
void
verifyStz2Parsing
(
Atom
.
LeafAtom
stz2Atom
)
{
private
static
void
verifyStz2Parsing
(
Atom
.
LeafAtom
stz2Atom
)
{
AtomParsers
.
Stz2SampleSizeBox
box
=
new
AtomParsers
.
Stz2SampleSizeBox
(
stz2Atom
);
AtomParsers
.
Stz2SampleSizeBox
box
=
new
AtomParsers
.
Stz2SampleSizeBox
(
stz2Atom
);
assertThat
(
box
.
getSampleCount
()).
isEqualTo
(
4
);
assertThat
(
box
.
getSampleCount
()).
isEqualTo
(
4
);
assertThat
(
box
.
isFixedSampleSize
()).
isFalse
(
);
assertThat
(
box
.
getFixedSampleSize
()).
isEqualTo
(
C
.
LENGTH_UNSET
);
for
(
int
i
=
0
;
i
<
box
.
getSampleCount
();
i
++)
{
for
(
int
i
=
0
;
i
<
box
.
getSampleCount
();
i
++)
{
assertThat
(
box
.
readNextSampleSize
()).
isEqualTo
(
i
+
1
);
assertThat
(
box
.
readNextSampleSize
()).
isEqualTo
(
i
+
1
);
}
}
...
...
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