Skip to content

Commit

Permalink
Merge pull request google#5895 from google/dev-v2-r2.10.1
Browse files Browse the repository at this point in the history
r2.10.1
  • Loading branch information
ojw28 authored May 20, 2019
2 parents 44293e8 + 9ec330e commit 35e030f
Show file tree
Hide file tree
Showing 33 changed files with 365 additions and 125 deletions.
12 changes: 12 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Release notes #

### 2.10.1 ###

* Offline: Add option to remove all downloads.
* HLS: Fix `NullPointerException` when using HLS chunkless preparation
([#5868](https://github.com/google/ExoPlayer/issues/5868)).
* Fix handling of empty values and line terminators in SHOUTcast ICY metadata
([#5876](https://github.com/google/ExoPlayer/issues/5876)).
* Fix DVB subtitles for SDK 28
([#5862](https://github.com/google/ExoPlayer/issues/5862)).
* Add a workaround for a decoder failure on ZTE Axon7 mini devices when playing
48kHz audio ([#5821](https://github.com/google/ExoPlayer/issues/5821)).

### 2.10.0 ###

* Core library:
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.0'
releaseVersionCode = 2010000
releaseVersion = '2.10.1'
releaseVersionCode = 2010001
minSdkVersion = 16
targetSdkVersion = 28
compileSdkVersion = 28
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,12 @@
import com.google.android.exoplayer2.offline.DownloadManager;
import com.google.android.exoplayer2.offline.DownloadRequest;
import com.google.android.exoplayer2.offline.DownloadService;
import com.google.android.exoplayer2.offline.StreamKey;
import com.google.android.exoplayer2.trackselection.MappingTrackSelector.MappedTrackInfo;
import com.google.android.exoplayer2.upstream.DataSource;
import com.google.android.exoplayer2.util.Log;
import com.google.android.exoplayer2.util.Util;
import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.CopyOnWriteArraySet;

/** Tracks media that has been downloaded. */
Expand Down Expand Up @@ -86,11 +83,9 @@ public boolean isDownloaded(Uri uri) {
}

@SuppressWarnings("unchecked")
public List<StreamKey> getOfflineStreamKeys(Uri uri) {
public DownloadRequest getDownloadRequest(Uri uri) {
Download download = downloads.get(uri);
return download != null && download.state != Download.STATE_FAILED
? download.request.streamKeys
: Collections.emptyList();
return download != null && download.state != Download.STATE_FAILED ? download.request : null;
}

public void toggleDownload(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
import com.google.android.exoplayer2.drm.UnsupportedDrmException;
import com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.DecoderInitializationException;
import com.google.android.exoplayer2.mediacodec.MediaCodecUtil.DecoderQueryException;
import com.google.android.exoplayer2.offline.StreamKey;
import com.google.android.exoplayer2.offline.DownloadHelper;
import com.google.android.exoplayer2.offline.DownloadRequest;
import com.google.android.exoplayer2.source.BehindLiveWindowException;
import com.google.android.exoplayer2.source.ConcatenatingMediaSource;
import com.google.android.exoplayer2.source.MediaSource;
Expand Down Expand Up @@ -75,7 +76,6 @@
import java.net.CookieHandler;
import java.net.CookieManager;
import java.net.CookiePolicy;
import java.util.List;
import java.util.UUID;

/** An activity that plays media using {@link SimpleExoPlayer}. */
Expand Down Expand Up @@ -457,33 +457,26 @@ private MediaSource buildMediaSource(Uri uri) {
}

private MediaSource buildMediaSource(Uri uri, @Nullable String overrideExtension) {
DownloadRequest downloadRequest =
((DemoApplication) getApplication()).getDownloadTracker().getDownloadRequest(uri);
if (downloadRequest != null) {
return DownloadHelper.createMediaSource(downloadRequest, dataSourceFactory);
}
@ContentType int type = Util.inferContentType(uri, overrideExtension);
List<StreamKey> offlineStreamKeys = getOfflineStreamKeys(uri);
switch (type) {
case C.TYPE_DASH:
return new DashMediaSource.Factory(dataSourceFactory)
.setStreamKeys(offlineStreamKeys)
.createMediaSource(uri);
return new DashMediaSource.Factory(dataSourceFactory).createMediaSource(uri);
case C.TYPE_SS:
return new SsMediaSource.Factory(dataSourceFactory)
.setStreamKeys(offlineStreamKeys)
.createMediaSource(uri);
return new SsMediaSource.Factory(dataSourceFactory).createMediaSource(uri);
case C.TYPE_HLS:
return new HlsMediaSource.Factory(dataSourceFactory)
.setStreamKeys(offlineStreamKeys)
.createMediaSource(uri);
return new HlsMediaSource.Factory(dataSourceFactory).createMediaSource(uri);
case C.TYPE_OTHER:
return new ProgressiveMediaSource.Factory(dataSourceFactory).createMediaSource(uri);
default: {
default:
throw new IllegalStateException("Unsupported type: " + type);
}
}
}

private List<StreamKey> getOfflineStreamKeys(Uri uri) {
return ((DemoApplication) getApplication()).getDownloadTracker().getOfflineStreamKeys(uri);
}

private DefaultDrmSessionManager<FrameworkMediaCrypto> buildDrmSessionManagerV18(
UUID uuid, String licenseUrl, String[] keyRequestPropertiesArray, boolean multiSession)
throws UnsupportedDrmException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public InterruptedIOException(InterruptedException e) {

private final CronetEngine cronetEngine;
private final Executor executor;
private final Predicate<String> contentTypePredicate;
@Nullable private final Predicate<String> contentTypePredicate;
private final int connectTimeoutMs;
private final int readTimeoutMs;
private final boolean resetTimeoutOnRedirects;
Expand Down Expand Up @@ -146,6 +146,18 @@ public InterruptedIOException(InterruptedException e) {

private volatile long currentConnectTimeoutMs;

/**
* @param cronetEngine A CronetEngine.
* @param executor The {@link java.util.concurrent.Executor} that will handle responses. This may
* be a direct executor (i.e. executes tasks on the calling thread) in order to avoid a thread
* hop from Cronet's internal network thread to the response handling thread. However, to
* avoid slowing down overall network performance, care must be taken to make sure response
* handling is a fast operation when using a direct executor.
*/
public CronetDataSource(CronetEngine cronetEngine, Executor executor) {
this(cronetEngine, executor, /* contentTypePredicate= */ null);
}

/**
* @param cronetEngine A CronetEngine.
* @param executor The {@link java.util.concurrent.Executor} that will handle responses. This may
Expand All @@ -158,7 +170,9 @@ public InterruptedIOException(InterruptedException e) {
* #open(DataSpec)}.
*/
public CronetDataSource(
CronetEngine cronetEngine, Executor executor, Predicate<String> contentTypePredicate) {
CronetEngine cronetEngine,
Executor executor,
@Nullable Predicate<String> contentTypePredicate) {
this(
cronetEngine,
executor,
Expand Down Expand Up @@ -188,7 +202,7 @@ public CronetDataSource(
public CronetDataSource(
CronetEngine cronetEngine,
Executor executor,
Predicate<String> contentTypePredicate,
@Nullable Predicate<String> contentTypePredicate,
int connectTimeoutMs,
int readTimeoutMs,
boolean resetTimeoutOnRedirects,
Expand Down Expand Up @@ -225,7 +239,7 @@ public CronetDataSource(
public CronetDataSource(
CronetEngine cronetEngine,
Executor executor,
Predicate<String> contentTypePredicate,
@Nullable Predicate<String> contentTypePredicate,
int connectTimeoutMs,
int readTimeoutMs,
boolean resetTimeoutOnRedirects,
Expand All @@ -246,7 +260,7 @@ public CronetDataSource(
/* package */ CronetDataSource(
CronetEngine cronetEngine,
Executor executor,
Predicate<String> contentTypePredicate,
@Nullable Predicate<String> contentTypePredicate,
int connectTimeoutMs,
int readTimeoutMs,
boolean resetTimeoutOnRedirects,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -948,8 +948,8 @@ public void resumeAd() {
@Override
public void onTimelineChanged(
Timeline timeline, @Nullable Object manifest, @Player.TimelineChangeReason int reason) {
if (reason == Player.TIMELINE_CHANGE_REASON_RESET) {
// The player is being reset and this source will be released.
if (timeline.isEmpty()) {
// The player is being reset or contains no media.
return;
}
Assertions.checkArgument(timeline.getPeriodCount() == 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ public class OkHttpDataSource extends BaseDataSource implements HttpDataSource {
private long bytesSkipped;
private long bytesRead;

/**
* @param callFactory A {@link Call.Factory} (typically an {@link okhttp3.OkHttpClient}) for use
* by the source.
* @param userAgent An optional User-Agent string.
*/
public OkHttpDataSource(Call.Factory callFactory, @Nullable String userAgent) {
this(callFactory, userAgent, /* contentTypePredicate= */ null);
}

/**
* @param callFactory A {@link Call.Factory} (typically an {@link okhttp3.OkHttpClient}) for use
* by the source.
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ android.useAndroidX=true
android.enableJetifier=true
android.enableUnitTestBinaryResources=true
buildDir=buildout
org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m
5 changes: 4 additions & 1 deletion javadoc_library.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@ android.libraryVariants.all { variant ->
if (!name.equals("release")) {
return; // Skip non-release builds.
}
def allSourceDirs = variant.sourceSets.inject ([]) {
acc, val -> acc << val.javaDirectories
}
task("generateJavadoc", type: Javadoc) {
description = "Generates Javadoc for the ${javadocTitle}."
title = "ExoPlayer ${javadocTitle}"
source = variant.javaCompileProvider.get().source
source = allSourceDirs
options {
links "http://docs.oracle.com/javase/7/docs/api/"
linksOffline "https://developer.android.com/reference",
Expand Down
9 changes: 6 additions & 3 deletions library/core/proguard-rules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,21 @@

# Constructors accessed via reflection in DownloadHelper
-dontnote com.google.android.exoplayer2.source.dash.DashMediaSource$Factory
-keepclassmembers class com.google.android.exoplayer2.source.dash.DashMediaSource$Factory {
-keepclasseswithmembers class com.google.android.exoplayer2.source.dash.DashMediaSource$Factory {
<init>(com.google.android.exoplayer2.upstream.DataSource$Factory);
** setStreamKeys(java.util.List);
com.google.android.exoplayer2.source.dash.DashMediaSource createMediaSource(android.net.Uri);
}
-dontnote com.google.android.exoplayer2.source.hls.HlsMediaSource$Factory
-keepclassmembers class com.google.android.exoplayer2.source.hls.HlsMediaSource$Factory {
-keepclasseswithmembers class com.google.android.exoplayer2.source.hls.HlsMediaSource$Factory {
<init>(com.google.android.exoplayer2.upstream.DataSource$Factory);
** setStreamKeys(java.util.List);
com.google.android.exoplayer2.source.hls.HlsMediaSource createMediaSource(android.net.Uri);
}
-dontnote com.google.android.exoplayer2.source.smoothstreaming.SsMediaSource$Factory
-keepclassmembers class com.google.android.exoplayer2.source.smoothstreaming.SsMediaSource$Factory {
-keepclasseswithmembers class com.google.android.exoplayer2.source.smoothstreaming.SsMediaSource$Factory {
<init>(com.google.android.exoplayer2.upstream.DataSource$Factory);
** setStreamKeys(java.util.List);
com.google.android.exoplayer2.source.smoothstreaming.SsMediaSource createMediaSource(android.net.Uri);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1053,11 +1053,14 @@ private void maybeTriggerPendingMessages(long oldPeriodPositionUs, long newPerio
&& nextInfo.resolvedPeriodIndex == currentPeriodIndex
&& nextInfo.resolvedPeriodTimeUs > oldPeriodPositionUs
&& nextInfo.resolvedPeriodTimeUs <= newPeriodPositionUs) {
sendMessageToTarget(nextInfo.message);
if (nextInfo.message.getDeleteAfterDelivery() || nextInfo.message.isCanceled()) {
pendingMessages.remove(nextPendingMessageIndex);
} else {
nextPendingMessageIndex++;
try {
sendMessageToTarget(nextInfo.message);
} finally {
if (nextInfo.message.getDeleteAfterDelivery() || nextInfo.message.isCanceled()) {
pendingMessages.remove(nextPendingMessageIndex);
} else {
nextPendingMessageIndex++;
}
}
nextInfo =
nextPendingMessageIndex < pendingMessages.size()
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.0";
public static final String VERSION = "2.10.1";

/** 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.0";
public static final String VERSION_SLASHY = "ExoPlayerLib/2.10.1";

/**
* 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 = 2010000;
public static final int VERSION_INT = 2010001;

/**
* 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 @@ -1231,7 +1231,7 @@ private void verifyApplicationThread() {
Log.w(
TAG,
"Player is accessed on the wrong thread. See "
+ "https://exoplayer.dev/faqs.html#"
+ "https://exoplayer.dev/troubleshooting.html#"
+ "what-do-player-is-accessed-on-the-wrong-thread-warnings-mean",
hasNotifiedFullWrongThreadWarning ? null : new IllegalStateException());
hasNotifiedFullWrongThreadWarning = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ final class EventTime {
public final Timeline timeline;

/**
* Window index in the {@code timeline} this event belongs to, or the prospective window index
* Window index in the {@link #timeline} this event belongs to, or the prospective window index
* if the timeline is not yet known and empty.
*/
public final int windowIndex;
Expand All @@ -76,7 +76,7 @@ final class EventTime {
public final long eventPlaybackPositionMs;

/**
* Position in the current timeline window ({@code timeline.getCurrentWindowIndex()} or the
* Position in the current timeline window ({@link Player#getCurrentWindowIndex()}) or the
* currently playing ad at the time of the event, in milliseconds.
*/
public final long currentPlaybackPositionMs;
Expand All @@ -91,15 +91,15 @@ final class EventTime {
* @param realtimeMs Elapsed real-time as returned by {@code SystemClock.elapsedRealtime()} at
* the time of the event, in milliseconds.
* @param timeline Timeline at the time of the event.
* @param windowIndex Window index in the {@code timeline} this event belongs to, or the
* @param windowIndex Window index in the {@link #timeline} this event belongs to, or the
* prospective window index if the timeline is not yet known and empty.
* @param mediaPeriodId Media period identifier for the media period this event belongs to, or
* {@code null} if the event is not associated with a specific media period.
* @param eventPlaybackPositionMs Position in the window or ad this event belongs to at the time
* of the event, in milliseconds.
* @param currentPlaybackPositionMs Position in the current timeline window ({@code
* timeline.getCurrentWindowIndex()} or the currently playing ad at the time of the event,
* in milliseconds.
* @param currentPlaybackPositionMs Position in the current timeline window ({@link
* Player#getCurrentWindowIndex()}) or the currently playing ad at the time of the event, in
* milliseconds.
* @param totalBufferedDurationMs Total buffered duration from {@link
* #currentPlaybackPositionMs} at the time of the event, in milliseconds. This includes
* pre-buffered data for subsequent ads and windows.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ protected MediaFormat getMediaFormat(
// Set codec configuration values.
if (Util.SDK_INT >= 23) {
mediaFormat.setInteger(MediaFormat.KEY_PRIORITY, 0 /* realtime priority */);
if (codecOperatingRate != CODEC_OPERATING_RATE_UNSET) {
if (codecOperatingRate != CODEC_OPERATING_RATE_UNSET && !deviceDoesntSupportOperatingRate()) {
mediaFormat.setFloat(MediaFormat.KEY_OPERATING_RATE, codecOperatingRate);
}
}
Expand All @@ -809,6 +809,17 @@ private void updateCurrentPosition() {
}
}

/**
* Returns whether the device's decoders are known to not support setting the codec operating
* rate.
*
* <p>See <a href="https://github.com/google/ExoPlayer/issues/5821">GitHub issue #5821</a>.
*/
private static boolean deviceDoesntSupportOperatingRate() {
return Util.SDK_INT == 23
&& ("ZTE B2017G".equals(Util.MODEL) || "AXON 7 mini".equals(Util.MODEL));
}

/**
* Returns whether the decoder is known to output six audio channels when provided with input with
* fewer than six channels.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
* The threshold number of samples to trim from the start/end of an audio track when applying an
* edit below which gapless info can be used (rather than removing samples from the sample table).
*/
private static final int MAX_GAPLESS_TRIM_SIZE_SAMPLES = 3;
private static final int MAX_GAPLESS_TRIM_SIZE_SAMPLES = 4;

/** The magic signature for an Opus Identification header, as defined in RFC-7845. */
private static final byte[] opusMagic = Util.getUtf8Bytes("OpusHead");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public final class IcyDecoder implements MetadataDecoder {

private static final String TAG = "IcyDecoder";

private static final Pattern METADATA_ELEMENT = Pattern.compile("(.+?)='(.+?)';");
private static final Pattern METADATA_ELEMENT = Pattern.compile("(.+?)='(.*?)';", Pattern.DOTALL);
private static final String STREAM_KEY_NAME = "streamtitle";
private static final String STREAM_KEY_URL = "streamurl";

Expand Down
Loading

0 comments on commit 35e030f

Please sign in to comment.