Skip to content

Commit

Permalink
Merge pull request google#6664 from google/dev-v2-r2.10.8
Browse files Browse the repository at this point in the history
r2.10.8
  • Loading branch information
ojw28 authored Nov 19, 2019
2 parents d73d64b + 30f79a4 commit 33938c0
Show file tree
Hide file tree
Showing 31 changed files with 156 additions and 65 deletions.
19 changes: 18 additions & 1 deletion RELEASENOTES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
# Release notes #

### 2.10.7 (2019-11-12) ###
### 2.10.8 (2019-11-19) ###

* E-AC3 JOC
* Handle new signaling in DASH manifests
([#6636](https://github.com/google/ExoPlayer/issues/6636)).
* Fix E-AC3 JOC passthrough playback failing to initialize due to incorrect
channel count check.
* FLAC
* Fix sniffing for some FLAC streams.
* Fix FLAC `Format.bitrate` values.
* Parse ALAC channel count and sample rate information from a more robust source
when contained in MP4
([#6648](https://github.com/google/ExoPlayer/issues/6648)).
* Fix seeking into multi-period content in the edge case that the period
containing the seek position has just been removed
([#6641](https://github.com/google/ExoPlayer/issues/6641)).

### 2.10.7 (2019-11-06) ###

* HLS: Fix detection of Dolby Atmos to match the HLS authoring specification.
* MediaSession extension: Update shuffle and repeat modes when playback state
Expand Down
4 changes: 2 additions & 2 deletions constants.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
// limitations under the License.
project.ext {
// ExoPlayer version and version code.
releaseVersion = '2.10.7'
releaseVersionCode = 2010007
releaseVersion = '2.10.8'
releaseVersionCode = 2010008
minSdkVersion = 16
targetSdkVersion = 28
compileSdkVersion = 28
Expand Down
2 changes: 1 addition & 1 deletion extensions/flac/src/androidTest/assets/bear.flac.0.dump
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ seekMap:
numberOfTracks = 1
track 0:
format:
bitrate = 768000
bitrate = 1536000
id = null
containerMimeType = null
sampleMimeType = audio/raw
Expand Down
2 changes: 1 addition & 1 deletion extensions/flac/src/androidTest/assets/bear.flac.1.dump
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ seekMap:
numberOfTracks = 1
track 0:
format:
bitrate = 768000
bitrate = 1536000
id = null
containerMimeType = null
sampleMimeType = audio/raw
Expand Down
2 changes: 1 addition & 1 deletion extensions/flac/src/androidTest/assets/bear.flac.2.dump
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ seekMap:
numberOfTracks = 1
track 0:
format:
bitrate = 768000
bitrate = 1536000
id = null
containerMimeType = null
sampleMimeType = audio/raw
Expand Down
2 changes: 1 addition & 1 deletion extensions/flac/src/androidTest/assets/bear.flac.3.dump
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ seekMap:
numberOfTracks = 1
track 0:
format:
bitrate = 768000
bitrate = 1536000
id = null
containerMimeType = null
sampleMimeType = audio/raw
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ seekMap:
numberOfTracks = 1
track 0:
format:
bitrate = 768000
bitrate = 1536000
id = null
containerMimeType = null
sampleMimeType = audio/raw
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ seekMap:
numberOfTracks = 1
track 0:
format:
bitrate = 768000
bitrate = 1536000
id = null
containerMimeType = null
sampleMimeType = audio/raw
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ seekMap:
numberOfTracks = 1
track 0:
format:
bitrate = 768000
bitrate = 1536000
id = null
containerMimeType = null
sampleMimeType = audio/raw
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ seekMap:
numberOfTracks = 1
track 0:
format:
bitrate = 768000
bitrate = 1536000
id = null
containerMimeType = null
sampleMimeType = audio/raw
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,8 @@ public final class FlacExtractor implements Extractor {
*/
public static final int FLAG_DISABLE_ID3_METADATA = 1;

/**
* FLAC signature: first 4 is the signature word, second 4 is the sizeof STREAMINFO. 0x22 is the
* mandatory STREAMINFO.
*/
private static final byte[] FLAC_SIGNATURE = {'f', 'L', 'a', 'C', 0, 0, 0, 0x22};
/** FLAC stream marker */
private static final byte[] FLAC_STREAM_MARKER = {'f', 'L', 'a', 'C'};

private final ParsableByteArray outputBuffer;
private final Id3Peeker id3Peeker;
Expand Down Expand Up @@ -126,7 +123,7 @@ public boolean sniff(ExtractorInput input) throws IOException, InterruptedExcept
if (input.getPosition() == 0) {
id3Metadata = peekId3Data(input);
}
return peekFlacSignature(input);
return peekFlacStreamMarker(input);
}

@Override
Expand Down Expand Up @@ -255,15 +252,15 @@ private int handlePendingSeek(
}

/**
* Peeks from the beginning of the input to see if {@link #FLAC_SIGNATURE} is present.
* Peeks from the beginning of the input to see if {@link #FLAC_STREAM_MARKER} is present.
*
* @return Whether the input begins with {@link #FLAC_SIGNATURE}.
* @return Whether the input begins with {@link #FLAC_STREAM_MARKER}.
*/
private static boolean peekFlacSignature(ExtractorInput input)
private static boolean peekFlacStreamMarker(ExtractorInput input)
throws IOException, InterruptedException {
byte[] header = new byte[FLAC_SIGNATURE.length];
input.peekFully(header, /* offset= */ 0, FLAC_SIGNATURE.length);
return Arrays.equals(header, FLAC_SIGNATURE);
byte[] header = new byte[FLAC_STREAM_MARKER.length];
input.peekFully(header, /* offset= */ 0, FLAC_STREAM_MARKER.length);
return Arrays.equals(header, FLAC_STREAM_MARKER);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1433,6 +1433,7 @@ private void handleSourceInfoRefreshEndedPlayback() {
* @throws IllegalSeekPositionException If the window index of the seek position is outside the
* bounds of the timeline.
*/
@Nullable
private Pair<Object, Long> resolveSeekPosition(
SeekPosition seekPosition, boolean trySubsequentPeriods) {
Timeline timeline = playbackInfo.timeline;
Expand Down Expand Up @@ -1467,11 +1468,12 @@ private Pair<Object, Long> resolveSeekPosition(
}
if (trySubsequentPeriods) {
// Try and find a subsequent period from the seek timeline in the internal timeline.
@Nullable
Object periodUid = resolveSubsequentPeriod(periodPosition.first, seekTimeline, timeline);
if (periodUid != null) {
// We found one. Map the SeekPosition onto the corresponding default position.
// We found one. Use the default position of the corresponding window.
return getPeriodPosition(
timeline, timeline.getPeriod(periodIndex, period).windowIndex, C.TIME_UNSET);
timeline, timeline.getPeriodByUid(periodUid, period).windowIndex, C.TIME_UNSET);
}
}
// We didn't find one. Give up.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ public final class ExoPlayerLibraryInfo {

/** The version of the library expressed as a string, for example "1.2.3". */
// Intentionally hardcoded. Do not derive from other constants (e.g. VERSION_INT) or vice versa.
public static final String VERSION = "2.10.7";
public static final String VERSION = "2.10.8";

/** The version of the library expressed as {@code "ExoPlayerLib/" + VERSION}. */
// Intentionally hardcoded. Do not derive from other constants (e.g. VERSION) or vice versa.
public static final String VERSION_SLASHY = "ExoPlayerLib/2.10.7";
public static final String VERSION_SLASHY = "ExoPlayerLib/2.10.8";

/**
* The version of the library expressed as an integer, for example 1002003.
Expand All @@ -43,7 +43,7 @@ public final class ExoPlayerLibraryInfo {
* integer version 123045006 (123-045-006).
*/
// Intentionally hardcoded. Do not derive from other constants (e.g. VERSION) or vice versa.
public static final int VERSION_INT = 2010007;
public static final int VERSION_INT = 2010008;

/**
* Whether the library was compiled with {@link com.google.android.exoplayer2.util.Assertions}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,8 @@ protected void onOutputFormatChanged(MediaCodec codec, MediaFormat outputFormat)
@C.Encoding
protected int getPassthroughEncoding(int channelCount, String mimeType) {
if (MimeTypes.AUDIO_E_AC3_JOC.equals(mimeType)) {
if (audioSink.supportsOutput(channelCount, C.ENCODING_E_AC3_JOC)) {
// E-AC3 JOC is object-based so the output channel count is arbitrary.
if (audioSink.supportsOutput(/* channelCount= */ Format.NO_VALUE, C.ENCODING_E_AC3_JOC)) {
return MimeTypes.getEncoding(MimeTypes.AUDIO_E_AC3_JOC);
}
// E-AC3 receivers can decode JOC streams, but in 2-D rather than 3-D, so try to fall back.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1114,8 +1114,8 @@ private static void parseAudioSampleEntry(ParsableByteArray parent, int atomType
mimeType = mimeTypeAndInitializationData.first;
initializationData = mimeTypeAndInitializationData.second;
if (MimeTypes.AUDIO_AAC.equals(mimeType)) {
// TODO: Do we really need to do this? See [Internal: b/10903778]
// Update sampleRate and channelCount from the AudioSpecificConfig initialization data.
// Update sampleRate and channelCount from the AudioSpecificConfig initialization data,
// which is more reliable. See [Internal: b/10903778].
Pair<Integer, Integer> audioSpecificConfig =
CodecSpecificDataUtil.parseAacAudioSpecificConfig(initializationData);
sampleRate = audioSpecificConfig.first;
Expand Down Expand Up @@ -1160,6 +1160,12 @@ private static void parseAudioSampleEntry(ParsableByteArray parent, int atomType
initializationData = new byte[childAtomBodySize];
parent.setPosition(childPosition + Atom.FULL_HEADER_SIZE);
parent.readBytes(initializationData, /* offset= */ 0, childAtomBodySize);
// Update sampleRate and channelCount from the AudioSpecificConfig initialization data,
// which is more reliable. See https://github.com/google/ExoPlayer/pull/6629.
Pair<Integer, Integer> audioSpecificConfig =
CodecSpecificDataUtil.parseAlacAudioSpecificConfig(initializationData);
sampleRate = audioSpecificConfig.first;
channelCount = audioSpecificConfig.second;
}
childPosition += childAtomSize;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ protected boolean readHeaders(ParsableByteArray packet, long position, SetupData
byte[] data = packet.data;
if (streamMetadata == null) {
streamMetadata = new FlacStreamMetadata(data, 17);
int maxInputSize =
streamMetadata.maxFrameSize == 0 ? Format.NO_VALUE : streamMetadata.maxFrameSize;
byte[] metadata = Arrays.copyOfRange(data, 9, packet.limit());
metadata[4] = (byte) 0x80; // Set the last metadata block flag, ignore the other blocks
List<byte[]> initializationData = Collections.singletonList(metadata);
Expand All @@ -82,7 +84,7 @@ protected boolean readHeaders(ParsableByteArray packet, long position, SetupData
MimeTypes.AUDIO_FLAC,
/* codecs= */ null,
streamMetadata.bitRate(),
/* maxInputSize= */ Format.NO_VALUE,
maxInputSize,
streamMetadata.channels,
streamMetadata.sampleRate,
initializationData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public final class CodecSpecificDataUtil {
private CodecSpecificDataUtil() {}

/**
* Parses an AudioSpecificConfig, as defined in ISO 14496-3 1.6.2.1
* Parses an AAC AudioSpecificConfig, as defined in ISO 14496-3 1.6.2.1
*
* @param audioSpecificConfig A byte array containing the AudioSpecificConfig to parse.
* @return A pair consisting of the sample rate in Hz and the channel count.
Expand All @@ -95,7 +95,7 @@ public static Pair<Integer, Integer> parseAacAudioSpecificConfig(byte[] audioSpe
}

/**
* Parses an AudioSpecificConfig, as defined in ISO 14496-3 1.6.2.1
* Parses an AAC AudioSpecificConfig, as defined in ISO 14496-3 1.6.2.1
*
* @param bitArray A {@link ParsableBitArray} containing the AudioSpecificConfig to parse. The
* position is advanced to the end of the AudioSpecificConfig.
Expand All @@ -104,8 +104,8 @@ public static Pair<Integer, Integer> parseAacAudioSpecificConfig(byte[] audioSpe
* @return A pair consisting of the sample rate in Hz and the channel count.
* @throws ParserException If the AudioSpecificConfig cannot be parsed as it's not supported.
*/
public static Pair<Integer, Integer> parseAacAudioSpecificConfig(ParsableBitArray bitArray,
boolean forceReadToEnd) throws ParserException {
public static Pair<Integer, Integer> parseAacAudioSpecificConfig(
ParsableBitArray bitArray, boolean forceReadToEnd) throws ParserException {
int audioObjectType = getAacAudioObjectType(bitArray);
int sampleRate = getAacSamplingFrequency(bitArray);
int channelConfiguration = bitArray.readBits(4);
Expand Down Expand Up @@ -166,10 +166,10 @@ public static Pair<Integer, Integer> parseAacAudioSpecificConfig(ParsableBitArra
* Builds a simple HE-AAC LC AudioSpecificConfig, as defined in ISO 14496-3 1.6.2.1
*
* @param sampleRate The sample rate in Hz.
* @param numChannels The number of channels.
* @param channelCount The channel count.
* @return The AudioSpecificConfig.
*/
public static byte[] buildAacLcAudioSpecificConfig(int sampleRate, int numChannels) {
public static byte[] buildAacLcAudioSpecificConfig(int sampleRate, int channelCount) {
int sampleRateIndex = C.INDEX_UNSET;
for (int i = 0; i < AUDIO_SPECIFIC_CONFIG_SAMPLING_RATE_TABLE.length; ++i) {
if (sampleRate == AUDIO_SPECIFIC_CONFIG_SAMPLING_RATE_TABLE[i]) {
Expand All @@ -178,13 +178,13 @@ public static byte[] buildAacLcAudioSpecificConfig(int sampleRate, int numChanne
}
int channelConfig = C.INDEX_UNSET;
for (int i = 0; i < AUDIO_SPECIFIC_CONFIG_CHANNEL_COUNT_TABLE.length; ++i) {
if (numChannels == AUDIO_SPECIFIC_CONFIG_CHANNEL_COUNT_TABLE[i]) {
if (channelCount == AUDIO_SPECIFIC_CONFIG_CHANNEL_COUNT_TABLE[i]) {
channelConfig = i;
}
}
if (sampleRate == C.INDEX_UNSET || channelConfig == C.INDEX_UNSET) {
throw new IllegalArgumentException("Invalid sample rate or number of channels: "
+ sampleRate + ", " + numChannels);
throw new IllegalArgumentException(
"Invalid sample rate or number of channels: " + sampleRate + ", " + channelCount);
}
return buildAacAudioSpecificConfig(AUDIO_OBJECT_TYPE_AAC_LC, sampleRateIndex, channelConfig);
}
Expand All @@ -205,6 +205,22 @@ public static byte[] buildAacAudioSpecificConfig(int audioObjectType, int sample
return specificConfig;
}

/**
* Parses an ALAC AudioSpecificConfig (i.e. an <a
* href="https://github.com/macosforge/alac/blob/master/ALACMagicCookieDescription.txt">ALACSpecificConfig</a>).
*
* @param audioSpecificConfig A byte array containing the AudioSpecificConfig to parse.
* @return A pair consisting of the sample rate in Hz and the channel count.
*/
public static Pair<Integer, Integer> parseAlacAudioSpecificConfig(byte[] audioSpecificConfig) {
ParsableByteArray byteArray = new ParsableByteArray(audioSpecificConfig);
byteArray.setPosition(9);
int channelCount = byteArray.readUnsignedByte();
byteArray.setPosition(20);
int sampleRate = byteArray.readUnsignedIntToInt();
return Pair.create(sampleRate, channelCount);
}

/**
* Builds an RFC 6381 AVC codec string using the provided parameters.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public int maxDecodedFrameSize() {

/** Returns the bit-rate of the FLAC stream. */
public int bitRate() {
return bitsPerSample * sampleRate;
return bitsPerSample * sampleRate * channels;
}

/** Returns the duration of the FLAC stream in microseconds. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static DolbyVisionConfig parse(ParsableByteArray data) {
int dvProfile = (profileData >> 1);
int dvLevel = ((profileData & 0x1) << 5) | ((data.readUnsignedByte() >> 3) & 0x1F);
String codecsPrefix;
if (dvProfile == 4 || dvProfile == 5) {
if (dvProfile == 4 || dvProfile == 5 || dvProfile == 7) {
codecsPrefix = "dvhe";
} else if (dvProfile == 8) {
codecsPrefix = "hev1";
Expand Down
4 changes: 2 additions & 2 deletions library/core/src/test/assets/ogg/bear_flac.ogg.0.dump
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ seekMap:
numberOfTracks = 1
track 0:
format:
bitrate = 768000
bitrate = 1536000
id = null
containerMimeType = null
sampleMimeType = audio/flac
maxInputSize = -1
maxInputSize = 5776
width = -1
height = -1
frameRate = -1.0
Expand Down
4 changes: 2 additions & 2 deletions library/core/src/test/assets/ogg/bear_flac.ogg.1.dump
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ seekMap:
numberOfTracks = 1
track 0:
format:
bitrate = 768000
bitrate = 1536000
id = null
containerMimeType = null
sampleMimeType = audio/flac
maxInputSize = -1
maxInputSize = 5776
width = -1
height = -1
frameRate = -1.0
Expand Down
4 changes: 2 additions & 2 deletions library/core/src/test/assets/ogg/bear_flac.ogg.2.dump
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ seekMap:
numberOfTracks = 1
track 0:
format:
bitrate = 768000
bitrate = 1536000
id = null
containerMimeType = null
sampleMimeType = audio/flac
maxInputSize = -1
maxInputSize = 5776
width = -1
height = -1
frameRate = -1.0
Expand Down
Loading

0 comments on commit 33938c0

Please sign in to comment.