Skip to content

Commit

Permalink
Merge pull request google#3151 from google/dev-v2-r2.5.1
Browse files Browse the repository at this point in the history
r2.5.1
  • Loading branch information
ojw28 authored Aug 8, 2017
2 parents deb9b30 + a6fd4bd commit 2f8c31d
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 22 deletions.
7 changes: 7 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Release notes #

### r2.5.1 ###

* Fix an issue that could cause the reported playback position to stop advancing
in some cases.
* Fix an issue where a Surface could be released whilst still in use by the
player.

### r2.5.0 ###

* IMA extension: Wraps the Google Interactive Media Ads (IMA) SDK to provide an
Expand Down
2 changes: 1 addition & 1 deletion constants.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ project.ext {
supportLibraryVersion = '25.4.0'
dexmakerVersion = '1.2'
mockitoVersion = '1.9.5'
releaseVersion = 'r2.5.0'
releaseVersion = 'r2.5.1'
modulePrefix = ':'
if (gradle.ext.has('exoplayerModulePrefix')) {
modulePrefix += gradle.ext.exoplayerModulePrefix
Expand Down
4 changes: 2 additions & 2 deletions demo/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.android.exoplayer2.demo"
android:versionCode="2500"
android:versionName="2.5.0">
android:versionCode="2501"
android:versionName="2.5.1">

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -975,11 +975,10 @@ private void handleSourceInfoRefreshed(Pair<Timeline, Object> timelineAndManifes
mediaPeriodInfoSequence.setTimeline(timeline);
Object manifest = timelineAndManifest.second;

int processedInitialSeekCount = 0;
if (oldTimeline == null) {
if (pendingInitialSeekCount > 0) {
Pair<Integer, Long> periodPosition = resolveSeekPosition(pendingSeekPosition);
processedInitialSeekCount = pendingInitialSeekCount;
int processedInitialSeekCount = pendingInitialSeekCount;
pendingInitialSeekCount = 0;
pendingSeekPosition = null;
if (periodPosition == null) {
Expand All @@ -996,7 +995,7 @@ private void handleSourceInfoRefreshed(Pair<Timeline, Object> timelineAndManifes
}
} else if (playbackInfo.startPositionUs == C.TIME_UNSET) {
if (timeline.isEmpty()) {
handleSourceInfoRefreshEndedPlayback(manifest, processedInitialSeekCount);
handleSourceInfoRefreshEndedPlayback(manifest);
} else {
Pair<Integer, Long> defaultPosition = getPeriodPosition(0, C.TIME_UNSET);
int periodIndex = defaultPosition.first;
Expand All @@ -1005,8 +1004,10 @@ private void handleSourceInfoRefreshed(Pair<Timeline, Object> timelineAndManifes
startPositionUs);
playbackInfo = new PlaybackInfo(periodId, periodId.isAd() ? 0 : startPositionUs,
startPositionUs);
notifySourceInfoRefresh(manifest, processedInitialSeekCount);
notifySourceInfoRefresh(manifest);
}
} else {
notifySourceInfoRefresh(manifest);
}
return;
}
Expand All @@ -1015,7 +1016,7 @@ private void handleSourceInfoRefreshed(Pair<Timeline, Object> timelineAndManifes
MediaPeriodHolder periodHolder = playingPeriodHolder != null ? playingPeriodHolder
: loadingPeriodHolder;
if (periodHolder == null && playingPeriodIndex >= oldTimeline.getPeriodCount()) {
notifySourceInfoRefresh(manifest, processedInitialSeekCount);
notifySourceInfoRefresh(manifest);
return;
}
Object playingPeriodUid = periodHolder == null
Expand All @@ -1027,7 +1028,7 @@ private void handleSourceInfoRefreshed(Pair<Timeline, Object> timelineAndManifes
int newPeriodIndex = resolveSubsequentPeriod(playingPeriodIndex, oldTimeline, timeline);
if (newPeriodIndex == C.INDEX_UNSET) {
// We failed to resolve a suitable restart position.
handleSourceInfoRefreshEndedPlayback(manifest, processedInitialSeekCount);
handleSourceInfoRefreshEndedPlayback(manifest);
return;
}
// We resolved a subsequent period. Seek to the default position in the corresponding window.
Expand Down Expand Up @@ -1055,7 +1056,7 @@ private void handleSourceInfoRefreshed(Pair<Timeline, Object> timelineAndManifes
MediaPeriodId periodId = new MediaPeriodId(newPeriodIndex);
newPositionUs = seekToPeriodPosition(periodId, newPositionUs);
playbackInfo = new PlaybackInfo(periodId, newPositionUs);
notifySourceInfoRefresh(manifest, processedInitialSeekCount);
notifySourceInfoRefresh(manifest);
return;
}

Expand All @@ -1072,14 +1073,14 @@ private void handleSourceInfoRefreshed(Pair<Timeline, Object> timelineAndManifes
long newPositionUs = seekToPeriodPosition(periodId, playbackInfo.contentPositionUs);
long contentPositionUs = periodId.isAd() ? playbackInfo.contentPositionUs : C.TIME_UNSET;
playbackInfo = new PlaybackInfo(periodId, newPositionUs, contentPositionUs);
notifySourceInfoRefresh(manifest, processedInitialSeekCount);
notifySourceInfoRefresh(manifest);
return;
}
}

if (periodHolder == null) {
// We don't have any period holders, so we're done.
notifySourceInfoRefresh(manifest, processedInitialSeekCount);
notifySourceInfoRefresh(manifest);
return;
}

Expand Down Expand Up @@ -1117,7 +1118,7 @@ private void handleSourceInfoRefreshed(Pair<Timeline, Object> timelineAndManifes
}
}

notifySourceInfoRefresh(manifest, processedInitialSeekCount);
notifySourceInfoRefresh(manifest);
}

private MediaPeriodHolder updatePeriodInfo(MediaPeriodHolder periodHolder, int periodIndex) {
Expand All @@ -1131,6 +1132,10 @@ private MediaPeriodHolder updatePeriodInfo(MediaPeriodHolder periodHolder, int p
}
}

private void handleSourceInfoRefreshEndedPlayback(Object manifest) {
handleSourceInfoRefreshEndedPlayback(manifest, 0);
}

private void handleSourceInfoRefreshEndedPlayback(Object manifest,
int processedInitialSeekCount) {
// Set the playback position to (0,0) for notifying the eventHandler.
Expand All @@ -1143,6 +1148,10 @@ private void handleSourceInfoRefreshEndedPlayback(Object manifest,
resetInternal(false);
}

private void notifySourceInfoRefresh(Object manifest) {
notifySourceInfoRefresh(manifest, 0);
}

private void notifySourceInfoRefresh(Object manifest, int processedInitialSeekCount) {
eventHandler.obtainMessage(MSG_SOURCE_INFO_REFRESHED,
new SourceInfo(timeline, manifest, playbackInfo, processedInitialSeekCount)).sendToTarget();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ 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.5.0";
public static final String VERSION = "2.5.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.5.0";
public static final String VERSION_SLASHY = "ExoPlayerLib/2.5.1";

/**
* The version of the library expressed as an integer, for example 1002003.
Expand All @@ -47,7 +47,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 = 2005000;
public static final int VERSION_INT = 2005001;

/**
* 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 @@ -749,12 +749,12 @@ private void setVideoSurfaceInternal(Surface surface, boolean ownsSurface) {
}
}
if (this.surface != null && this.surface != surface) {
// If we created this surface, we are responsible for releasing it.
// We're replacing a surface. Block to ensure that it's not accessed after the method returns.
player.blockingSendMessages(messages);
// If we created the previous surface, we are responsible for releasing it.
if (this.ownsSurface) {
this.surface.release();
}
// We're replacing a surface. Block to ensure that it's not accessed after the method returns.
player.blockingSendMessages(messages);
} else {
player.sendMessages(messages);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ public final class ClippingMediaSource implements MediaSource, MediaSource.Liste
* start providing samples, in microseconds.
* @param endPositionUs The end position within {@code mediaSource}'s timeline at which to stop
* providing samples, in microseconds. Specify {@link C#TIME_END_OF_SOURCE} to provide samples
* from the specified start point up to the end of the source.
* from the specified start point up to the end of the source. Specifying a position that
* exceeds the {@code mediaSource}'s duration will also result in the end of the source not
* being clipped.
*/
public ClippingMediaSource(MediaSource mediaSource, long startPositionUs, long endPositionUs) {
this(mediaSource, startPositionUs, endPositionUs, true);
Expand All @@ -66,7 +68,9 @@ public ClippingMediaSource(MediaSource mediaSource, long startPositionUs, long e
* start providing samples, in microseconds.
* @param endPositionUs The end position within {@code mediaSource}'s timeline at which to stop
* providing samples, in microseconds. Specify {@link C#TIME_END_OF_SOURCE} to provide samples
* from the specified start point up to the end of the source.
* from the specified start point up to the end of the source. Specifying a position that
* exceeds the {@code mediaSource}'s duration will also result in the end of the source not
* being clipped.
* @param enableInitialDiscontinuity Whether the initial discontinuity should be enabled.
*/
public ClippingMediaSource(MediaSource mediaSource, long startPositionUs, long endPositionUs,
Expand Down Expand Up @@ -149,8 +153,10 @@ public ClippingTimeline(Timeline timeline, long startUs, long endUs) {
Assertions.checkArgument(!window.isDynamic);
long resolvedEndUs = endUs == C.TIME_END_OF_SOURCE ? window.durationUs : endUs;
if (window.durationUs != C.TIME_UNSET) {
if (resolvedEndUs > window.durationUs) {
resolvedEndUs = window.durationUs;
}
Assertions.checkArgument(startUs == 0 || window.isSeekable);
Assertions.checkArgument(resolvedEndUs <= window.durationUs);
Assertions.checkArgument(startUs <= resolvedEndUs);
}
Period period = timeline.getPeriod(0, new Period());
Expand Down

0 comments on commit 2f8c31d

Please sign in to comment.