Merge pull request #8088 from xufuji456:dev-v2
PiperOrigin-RevId: 338024866
This commit is contained in:
parent
e72082710c
commit
d2fb9dda82
@ -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)).
|
||||||
|
@ -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;
|
|||||||
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;
|
|||||||
*/
|
*/
|
||||||
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();
|
||||||
*/
|
|
||||||
|
/** Returns the size for the next sample. */
|
||||||
int readNextSampleSize();
|
int readNextSampleSize();
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns whether samples have a fixed size.
|
|
||||||
*/
|
|
||||||
boolean isFixedSampleSize();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -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;
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int readNextSampleSize() {
|
public int getFixedSampleSize() {
|
||||||
return fixedSampleSize == 0 ? data.readUnsignedIntToInt() : fixedSampleSize;
|
return fixedSampleSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFixedSampleSize() {
|
public int readNextSampleSize() {
|
||||||
return fixedSampleSize != 0;
|
return fixedSampleSize == C.LENGTH_UNSET ? data.readUnsignedIntToInt() : fixedSampleSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1731,6 +1728,11 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
|||||||
return sampleCount;
|
return sampleCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getFixedSampleSize() {
|
||||||
|
return C.LENGTH_UNSET;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int readNextSampleSize() {
|
public int readNextSampleSize() {
|
||||||
if (fieldSize == 8) {
|
if (fieldSize == 8) {
|
||||||
@ -1750,12 +1752,6 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isFixedSampleSize() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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 {
|
|||||||
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);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user