Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add codeowners file #1

Open
wants to merge 5 commits into
base: release-v2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.fabric/ @unacademy/sre
62 changes: 62 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,67 @@
# Release notes

### dev-v2 (not yet released)

* Core library:
* Fix bug where streams with highly uneven durations may get stuck in a
buffering state
([#7943](https://github.com/google/ExoPlayer/issues/7943)).
* Verify correct thread usage in `SimpleExoPlayer` by default. Opt-out is
still possible until the next major release using
`setThrowsWhenUsingWrongThread(false)`
([#4463](https://github.com/google/ExoPlayer/issues/4463)).
* Add a getter and callback for static metadata to the player
([#7266](https://github.com/google/ExoPlayer/issues/7266)).
* Time out on release to prevent ANRs if the underlying platform call
is stuck ([#4352](https://github.com/google/ExoPlayer/issues/4352)).
* Time out when detaching a surface to prevent ANRs if the underlying
platform call is stuck
([#5887](https://github.com/google/ExoPlayer/issues/5887)).
* Track selection:
* Add option to specify multiple preferred audio or text languages.
* Data sources:
* Add support for `android.resource` URI scheme in `RawResourceDataSource`
([#7866](https://github.com/google/ExoPlayer/issues/7866)).
* Text:
* Add support for `\h` SSA/ASS style override code (non-breaking space).
* Fix WebVTT subtitles in MP4 containers in DASH streams
([#7985](https://github.com/google/ExoPlayer/issues/7985)).
* Fix NPE in `TextRenderer` when playing content with a single subtitle
buffer ([#8017](https://github.com/google/ExoPlayer/issues/8017)).
* UI:
* Do not require subtitleButton in custom layouts of StyledPlayerView
([#7962](https://github.com/google/ExoPlayer/issues/7962)).
* Add the option to sort tracks by `Format` in `TrackSelectionView` and
`TrackSelectionDialogBuilder`
([#7709](https://github.com/google/ExoPlayer/issues/7709)).
* Audio:
* Retry playback after some types of `AudioTrack` error.
* Fix the default audio sink position not advancing correctly when using
`AudioTrack`-based speed adjustment
([#7982](https://github.com/google/ExoPlayer/issues/7982)).
* Extractors:
* Add support for .mp2 boxes in the `AtomParsers`
([#7967](https://github.com/google/ExoPlayer/issues/7967)).
* Use TLEN ID3 tag to compute the duration in Mp3Extractor
([#7949](https://github.com/google/ExoPlayer/issues/7949)).
* Fix regression for Ogg files with packets that span multiple pages
([#7992](https://github.com/google/ExoPlayer/issues/7992)).
* Add TS extractor parameter to configure the number of bytes in which
to search for a timestamp to determine the duration and to seek.
([#7988](https://github.com/google/ExoPlayer/issues/7988)).
* Ignore negative payload size in PES packets
([#8005](https://github.com/google/ExoPlayer/issues/8005)).
* IMA extension:
* Fix position reporting after fetch errors
([#7956](https://github.com/google/ExoPlayer/issues/7956)).
* Allow apps to specify a `VideoAdPlayerCallback`
([#7944](https://github.com/google/ExoPlayer/issues/7944)).
* Accept ad tags via the `AdsMediaSource` constructor and deprecate
passing them via the `ImaAdsLoader` constructor/builders. Passing the
ad tag via media item playback properties continues to be supported.
This is in preparation for supporting ads in playlists
([#3750](https://github.com/google/ExoPlayer/issues/3750)).

### 2.12.0 (2020-09-11) ###

To learn more about what's new in 2.12, read the corresponding
Expand Down
60 changes: 30 additions & 30 deletions core_settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,22 @@ include modulePrefix + 'library-smoothstreaming'
include modulePrefix + 'library-ui'
include modulePrefix + 'testutils'
include modulePrefix + 'testdata'
include modulePrefix + 'extension-av1'
include modulePrefix + 'extension-ffmpeg'
include modulePrefix + 'extension-flac'
include modulePrefix + 'extension-gvr'
include modulePrefix + 'extension-ima'
include modulePrefix + 'extension-cast'
include modulePrefix + 'extension-cronet'
include modulePrefix + 'extension-mediasession'
include modulePrefix + 'extension-media2'
// include modulePrefix + 'extension-av1'
// include modulePrefix + 'extension-ffmpeg'
// include modulePrefix + 'extension-flac'
// include modulePrefix + 'extension-gvr'
// include modulePrefix + 'extension-ima'
// include modulePrefix + 'extension-cast'
// include modulePrefix + 'extension-cronet'
// include modulePrefix + 'extension-mediasession'
// include modulePrefix + 'extension-media2'
include modulePrefix + 'extension-okhttp'
include modulePrefix + 'extension-opus'
include modulePrefix + 'extension-vp9'
include modulePrefix + 'extension-rtmp'
include modulePrefix + 'extension-leanback'
include modulePrefix + 'extension-jobdispatcher'
include modulePrefix + 'extension-workmanager'
// include modulePrefix + 'extension-opus'
// include modulePrefix + 'extension-vp9'
// include modulePrefix + 'extension-rtmp'
// include modulePrefix + 'extension-leanback'
// include modulePrefix + 'extension-jobdispatcher'
// include modulePrefix + 'extension-workmanager'

project(modulePrefix + 'library').projectDir = new File(rootDir, 'library/all')
project(modulePrefix + 'library-common').projectDir = new File(rootDir, 'library/common')
Expand All @@ -58,19 +58,19 @@ project(modulePrefix + 'library-smoothstreaming').projectDir = new File(rootDir,
project(modulePrefix + 'library-ui').projectDir = new File(rootDir, 'library/ui')
project(modulePrefix + 'testutils').projectDir = new File(rootDir, 'testutils')
project(modulePrefix + 'testdata').projectDir = new File(rootDir, 'testdata')
project(modulePrefix + 'extension-av1').projectDir = new File(rootDir, 'extensions/av1')
project(modulePrefix + 'extension-ffmpeg').projectDir = new File(rootDir, 'extensions/ffmpeg')
project(modulePrefix + 'extension-flac').projectDir = new File(rootDir, 'extensions/flac')
project(modulePrefix + 'extension-gvr').projectDir = new File(rootDir, 'extensions/gvr')
project(modulePrefix + 'extension-ima').projectDir = new File(rootDir, 'extensions/ima')
project(modulePrefix + 'extension-cast').projectDir = new File(rootDir, 'extensions/cast')
project(modulePrefix + 'extension-cronet').projectDir = new File(rootDir, 'extensions/cronet')
project(modulePrefix + 'extension-mediasession').projectDir = new File(rootDir, 'extensions/mediasession')
project(modulePrefix + 'extension-media2').projectDir = new File(rootDir, 'extensions/media2')
// project(modulePrefix + 'extension-av1').projectDir = new File(rootDir, 'extensions/av1')
// project(modulePrefix + 'extension-ffmpeg').projectDir = new File(rootDir, 'extensions/ffmpeg')
// project(modulePrefix + 'extension-flac').projectDir = new File(rootDir, 'extensions/flac')
// project(modulePrefix + 'extension-gvr').projectDir = new File(rootDir, 'extensions/gvr')
// project(modulePrefix + 'extension-ima').projectDir = new File(rootDir, 'extensions/ima')
// project(modulePrefix + 'extension-cast').projectDir = new File(rootDir, 'extensions/cast')
// project(modulePrefix + 'extension-cronet').projectDir = new File(rootDir, 'extensions/cronet')
// project(modulePrefix + 'extension-mediasession').projectDir = new File(rootDir, 'extensions/mediasession')
// project(modulePrefix + 'extension-media2').projectDir = new File(rootDir, 'extensions/media2')
project(modulePrefix + 'extension-okhttp').projectDir = new File(rootDir, 'extensions/okhttp')
project(modulePrefix + 'extension-opus').projectDir = new File(rootDir, 'extensions/opus')
project(modulePrefix + 'extension-vp9').projectDir = new File(rootDir, 'extensions/vp9')
project(modulePrefix + 'extension-rtmp').projectDir = new File(rootDir, 'extensions/rtmp')
project(modulePrefix + 'extension-leanback').projectDir = new File(rootDir, 'extensions/leanback')
project(modulePrefix + 'extension-jobdispatcher').projectDir = new File(rootDir, 'extensions/jobdispatcher')
project(modulePrefix + 'extension-workmanager').projectDir = new File(rootDir, 'extensions/workmanager')
// project(modulePrefix + 'extension-opus').projectDir = new File(rootDir, 'extensions/opus')
// project(modulePrefix + 'extension-vp9').projectDir = new File(rootDir, 'extensions/vp9')
// project(modulePrefix + 'extension-rtmp').projectDir = new File(rootDir, 'extensions/rtmp')
// project(modulePrefix + 'extension-leanback').projectDir = new File(rootDir, 'extensions/leanback')
// project(modulePrefix + 'extension-jobdispatcher').projectDir = new File(rootDir, 'extensions/jobdispatcher')
// project(modulePrefix + 'extension-workmanager').projectDir = new File(rootDir, 'extensions/workmanager')
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,17 @@ public final class ExoPlaybackException extends Exception {

/**
* The operation which produced the timeout error. One of {@link #TIMEOUT_OPERATION_RELEASE},
* {@link #TIMEOUT_OPERATION_SET_FOREGROUND_MODE} or {@link #TIMEOUT_OPERATION_UNDEFINED}. Note
* that new operations may be added in the future and error handling should handle unknown
* operation values.
* {@link #TIMEOUT_OPERATION_SET_FOREGROUND_MODE}, {@link #TIMEOUT_OPERATION_DETACH_SURFACE} or
* {@link #TIMEOUT_OPERATION_UNDEFINED}. Note that new operations may be added in the future and
* error handling should handle unknown operation values.
*/
@Documented
@Retention(RetentionPolicy.SOURCE)
@IntDef({
TIMEOUT_OPERATION_UNDEFINED,
TIMEOUT_OPERATION_RELEASE,
TIMEOUT_OPERATION_SET_FOREGROUND_MODE
TIMEOUT_OPERATION_SET_FOREGROUND_MODE,
TIMEOUT_OPERATION_DETACH_SURFACE
})
public @interface TimeoutOperation {}

Expand All @@ -104,6 +105,8 @@ public final class ExoPlaybackException extends Exception {
public static final int TIMEOUT_OPERATION_RELEASE = 1;
/** The error occurred in {@link ExoPlayer#setForegroundMode}. */
public static final int TIMEOUT_OPERATION_SET_FOREGROUND_MODE = 2;
/** The error occurred while detaching a surface from the player. */
public static final int TIMEOUT_OPERATION_DETACH_SURFACE = 3;

/** If {@link #type} is {@link #TYPE_RENDERER}, this is the name of the renderer. */
@Nullable public final String rendererName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@
*/
public interface ExoPlayer extends Player {

/**
* The default timeout for calls to {@link #release} and {@link #setForegroundMode}, in
* milliseconds.
*/
long DEFAULT_RELEASE_TIMEOUT_MS = 500;

/**
* A builder for {@link ExoPlayer} instances.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -665,18 +665,28 @@ public void setForegroundMode(boolean foregroundMode) {
if (this.foregroundMode != foregroundMode) {
this.foregroundMode = foregroundMode;
if (!internalPlayer.setForegroundMode(foregroundMode)) {
notifyListeners(
listener ->
listener.onPlayerError(
ExoPlaybackException.createForTimeout(
new TimeoutException("Setting foreground mode timed out."),
ExoPlaybackException.TIMEOUT_OPERATION_SET_FOREGROUND_MODE)));
stop(
/* reset= */ false,
ExoPlaybackException.createForTimeout(
new TimeoutException("Setting foreground mode timed out."),
ExoPlaybackException.TIMEOUT_OPERATION_SET_FOREGROUND_MODE));
}
}
}

@Override
public void stop(boolean reset) {
stop(reset, /* error= */ null);
}

/**
* Stops the player.
*
* @param reset Whether the playlist should be cleared and whether the playback position and
* playback error should be reset.
* @param error An optional {@link ExoPlaybackException} to set.
*/
public void stop(boolean reset, @Nullable ExoPlaybackException error) {
PlaybackInfo playbackInfo;
if (reset) {
playbackInfo =
Expand All @@ -689,6 +699,9 @@ public void stop(boolean reset) {
playbackInfo.totalBufferedDurationUs = 0;
}
playbackInfo = playbackInfo.copyWithPlaybackState(Player.STATE_IDLE);
if (error != null) {
playbackInfo = playbackInfo.copyWithPlaybackError(error);
}
pendingOperationAcks++;
internalPlayer.stop();
updatePlaybackInfo(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,20 @@ public synchronized boolean isCanceled() {
return isCanceled;
}

/**
* Marks the message as processed. Should only be called by a {@link Sender} and may be called
* multiple times.
*
* @param isDelivered Whether the message has been delivered to its target. The message is
* considered as being delivered when this method has been called with {@code isDelivered} set
* to true at least once.
*/
public synchronized void markAsProcessed(boolean isDelivered) {
this.isDelivered |= isDelivered;
isProcessed = true;
notifyAll();
}

/**
* Blocks until after the message has been delivered or the player is no longer able to deliver
* the message.
Expand All @@ -292,44 +306,30 @@ public synchronized boolean blockUntilDelivered() throws InterruptedException {
return isDelivered;
}

/**
* Marks the message as processed. Should only be called by a {@link Sender} and may be called
* multiple times.
*
* @param isDelivered Whether the message has been delivered to its target. The message is
* considered as being delivered when this method has been called with {@code isDelivered} set
* to true at least once.
*/
public synchronized void markAsProcessed(boolean isDelivered) {
this.isDelivered |= isDelivered;
isProcessed = true;
notifyAll();
}

/**
* Blocks until after the message has been delivered or the player is no longer able to deliver
* the message or the specified waiting time elapses.
* the message or the specified timeout elapsed.
*
* <p>Note that this method can't be called if the current thread is the same thread used by the
* message handler set with {@link #setHandler(Handler)} as it would cause a deadlock.
*
* @param timeoutMs the maximum time to wait in milliseconds.
* @param timeoutMs The timeout in milliseconds.
* @return Whether the message was delivered successfully.
* @throws IllegalStateException If this method is called before {@link #send()}.
* @throws IllegalStateException If this method is called on the same thread used by the message
* handler set with {@link #setHandler(Handler)}.
* @throws TimeoutException If the waiting time elapsed and this message has not been delivered
* and the player is still able to deliver the message.
* @throws TimeoutException If the {@code timeoutMs} elapsed and this message has not been
* delivered and the player is still able to deliver the message.
* @throws InterruptedException If the current thread is interrupted while waiting for the message
* to be delivered.
*/
public synchronized boolean experimentalBlockUntilDelivered(long timeoutMs)
public synchronized boolean blockUntilDelivered(long timeoutMs)
throws InterruptedException, TimeoutException {
return experimentalBlockUntilDelivered(timeoutMs, Clock.DEFAULT);
return blockUntilDelivered(timeoutMs, Clock.DEFAULT);
}

@VisibleForTesting()
/* package */ synchronized boolean experimentalBlockUntilDelivered(long timeoutMs, Clock clock)
/* package */ synchronized boolean blockUntilDelivered(long timeoutMs, Clock clock)
throws InterruptedException, TimeoutException {
Assertions.checkState(isSent);
Assertions.checkState(handler.getLooper().getThread() != Thread.currentThread());
Expand Down
Loading