7741 Commits

Author SHA1 Message Date
aquilescanta
5bb2d0386f Remove createRendererException which doesn't take errorCode
And assign error codes to all callers.

PiperOrigin-RevId: 383118513
2021-07-09 08:59:47 +01:00
ibaker
0df0df9aee Remove @DoNotInstrument from test classes
This isn't needed now we've updated to Robolectric 4.6

PiperOrigin-RevId: 383109343
2021-07-09 08:58:38 +01:00
aquilescanta
d7bb6e7235 Fix typo in internal class name
PiperOrigin-RevId: 382766969
2021-07-09 08:56:25 +01:00
ibaker
227ac89eff Change TestPlayerRunHelper to fail-fast on playback error
If a test expects an error they can use runUntilError()

PiperOrigin-RevId: 382765060
2021-07-09 08:55:22 +01:00
ibaker
ee488e6625 Clarify the thread requirements of a SurfaceView or SurfaceHolder
Issue: #9005
PiperOrigin-RevId: 382765045
2021-07-09 08:54:07 +01:00
ibaker
22247d65c7 Use the content URI as well as mediaId for the auto-generated ad ID
MediaItem.mediaId used to default to the content URI, but this changed:
cc26a92e07

Before the mediaId change linked above, a playlist of different content
all with the same ad URI would play the ads for every item. After the
change the ad would only play once (because mediaId == "" for every
item, so they're all the same). This change restores roughly the
original behaviour by always considering both mediaId and the content
URI.

#minor-release

Issue: #9106
PiperOrigin-RevId: 382763618
2021-07-09 08:52:51 +01:00
ibaker
3bd662eb9a Don't propagate attrs into child SubtitleOutput from SubtitleView
#minor-release

PiperOrigin-RevId: 382763308
2021-07-09 08:51:39 +01:00
ibaker
5e4056eb4c Encode emsg duration & ID as int64 instead of uint32
The serialization scheme used here is custom, it doesn't need
to be compatible with emsg-v0 or emsg-v1 (since
97183ef558).

This means that C.TIME_UNSET will propagate correctly through the
serialization.

#minor-release

Issue: #9123
PiperOrigin-RevId: 382762873
2021-07-09 08:49:27 +01:00
ibaker
ee426822ee Mark BasePlayer constructor as protected
This is an abstract class so it can only be constructed from the context
of a subclass anyway.

PiperOrigin-RevId: 382756293
2021-07-09 08:46:58 +01:00
ibaker
6e43ea97e7 Add @Deprecated to SEP methods that override deprecated methods
Without this annotation it seems that `SimpleExoPlayer` effectively
'un-deprecates' the method, specifically:
* A usage of these methods isn't flagged by Android Studio if the
  declared type is `SimpleExoPlayer` (up-casting to e.g.
  `ExoPlayer.VideoComponent` results in the warning showing up).
* The `SimpleExoPlayer` javadoc doesn't mention this method is
  deprecated:
  https://exoplayer.dev/doc/reference/com/google/android/exoplayer2/SimpleExoPlayer.html#addVideoListener(com.google.android.exoplayer2.video.VideoListener)
* The Metalava API output for `SimpleExoPlayer` doesn't show these
  methods as deprecated.

PiperOrigin-RevId: 382756174
2021-07-09 08:45:51 +01:00
claincly
6035932fa3 Make HttpDataSourceException use PlaybackException error codes.
PiperOrigin-RevId: 382710409
2021-07-09 08:44:36 +01:00
claincly
747b0f057b Make DataSourceException use PlaybackException error codes.
- Use `PlaybackException.ErrorCode` IntDef for `DataSourceException` error code
- Deprecate `DataSourceException.POSITION_OUT_OF_RANGE`
- All other changes are related to replacing the deprecated constant and
  constructor

PiperOrigin-RevId: 382683522
2021-07-09 08:43:22 +01:00
claincly
ee0d905eed Add ERROR_CODE_TIMEOUT.
Also remove the method for creating a TYPE_RENDERER ExoPlaybackException
with unknown renderer name and index.

PiperOrigin-RevId: 382589655
2021-07-09 08:40:38 +01:00
claincly
dda1d37368 Make HttpDataSourceException subclass DataSourceException.
PiperOrigin-RevId: 382551642
2021-07-09 08:39:26 +01:00
aquilescanta
b0ddef5bcf Assign DRM error codes
PiperOrigin-RevId: 382527115
2021-07-09 08:38:13 +01:00
aquilescanta
c1995745e7 Move platform error mapping to common
In order to use it for error code assignment. Note that these DRM errors
could be thrown on API < 18 (from MediaCodec.CryptoException), which is
the reason we can't put the mapping in FrameworkMediaDrm.

PiperOrigin-RevId: 382512414
2021-07-09 08:36:53 +01:00
christosts
db454973f2 Rename packages for HLS module
PiperOrigin-RevId: 382508442
2021-07-09 08:35:49 +01:00
aquilescanta
124a6aea50 Remove unused method Log.getLogStackTraces
It was impossible to call because it was a non-static method in a class
with a private constructor.

PiperOrigin-RevId: 382504128
2021-07-09 08:34:38 +01:00
krocard
4de4f85739 Document threading guarantee of Player.addListener
These guarantees were documented for `EventListener` and
hold as well for Listener but were not documented.

PiperOrigin-RevId: 382498188
2021-07-09 08:33:26 +01:00
aquilescanta
a24bbbdd5e Reimplement getErrorCodeFromPlatformDiagnosticsInfo to save the pattern
PiperOrigin-RevId: 382494191
2021-07-09 08:31:10 +01:00
olly
91cb54b84e Make SkipAndContinueIfSampleTooLarge as default behavior.
Remove experimentalSetSkipAndContinueIfSampleTooLarge() api

PiperOrigin-RevId: 382383498
2021-07-09 08:29:58 +01:00
klhyun
3c97815d55 PlayerView sets aspect ratio when setting a new player
PlayerView and StyledPlayerView handled this in
onVideoSizeChanged but it can be omitted.
(e.g. if the player is MediaController)

PiperOrigin-RevId: 382340927
2021-07-09 08:28:37 +01:00
aquilescanta
d9d02710c0 Add tests for Util.getErrorCodeFromPlatformDiagnosticsInfo
PiperOrigin-RevId: 382311518
2021-07-09 08:27:17 +01:00
aquilescanta
2ca7432bf6 Move Util.getErrorCodeFromPlatformDiagnosticsInfo into common
Will be needed for error code assignment.

PiperOrigin-RevId: 382305328
2021-07-09 08:26:03 +01:00
olly
dea52048cb Bump dependency versions
PiperOrigin-RevId: 382277352
2021-06-30 13:53:01 +01:00
samrobinson
9013facdd7 Rename PlaylistMediaMetadata to PlaylistMetadata in Player.
This affects the setter, getter and callback, as well as various
media 3 methods.

PiperOrigin-RevId: 382275672
2021-06-30 13:51:51 +01:00
aquilescanta
764f9f20d6 Add info about trick-playness to the Format log string
PiperOrigin-RevId: 382139109
2021-06-30 13:50:32 +01:00
kimvde
6e4508daec Improve support for Ogg truncated content
#minor-release

Issue:#7608
PiperOrigin-RevId: 382081687
2021-06-30 13:49:15 +01:00
aquilescanta
155e27ec7c Move ExoPlaybackException back into core
PiperOrigin-RevId: 381941053
2021-06-30 13:47:30 +01:00
claincly
ffbec2234d Assign PlaybackException.ErrorCode to renderer failures.
PiperOrigin-RevId: 381852092
2021-06-30 13:45:02 +01:00
olly
7aaba1ffe5 Migrate usage of Player.EventListener to Player.Listener
PiperOrigin-RevId: 381837274
2021-06-30 13:43:51 +01:00
aquilescanta
b58fce1bd9 Assign some more IO error codes
Specifically:
- ERROR_CODE_IO_NETWORK_CONNECTION_TIMEOUT
- ERROR_CODE_IO_NETWORK_CONNECTION_FAILED
- ERROR_CODE_IO_NETWORK_CONNECTION_CLOSED
PiperOrigin-RevId: 381441329
2021-06-30 13:35:37 +01:00
aquilescanta
465f7c06d8 Add ERROR_CODE_IO_CLEARTEXT_NOT_PERMITTED
And assign it to CleartextNotPermittedException.

PiperOrigin-RevId: 381247430
2021-06-30 13:34:31 +01:00
aquilescanta
1cc62c65a7 Add @ErrorCode to local variables in ExoPlayerImplInternal
PiperOrigin-RevId: 381236418
2021-06-30 13:30:58 +01:00
aquilescanta
cca4ac73ca Assign ERROR_CODE_IO_DNS_FAILED to UnknownHostException
PiperOrigin-RevId: 381235721
2021-06-30 13:29:53 +01:00
olly
1e9b6d66a3 [CronetDataSource] Support keeping the POST method and body for 302
Currently when a HTTP POST request receives a 302, CronetDataSource will change the request method from POST to GET for the redirected request, and drop the post body. This aligns with the behaviours of many user agents, but our use case would like to keep the POST method and the post body.

org.chromium.net.UrlRequest.followRedirect also changes POST to GET for 302, so should be avoided here.

PiperOrigin-RevId: 381233011
2021-06-30 13:28:50 +01:00
aquilescanta
fc26d4eeb1 Remove the last deprecated ParserException constructor
PiperOrigin-RevId: 381221669
2021-06-30 13:27:45 +01:00
bachinger
1cb4fb290f Change signature of ChunkSource.onChunkLoadError
A no-op change that changes the signature of the onChunkLoadError method of the ChunkSource. Implementors can get the exclusion duration directly from the LoadErrorHndlingPolicy instead of receiving it as an argument of the callback.

PiperOrigin-RevId: 381102935
2021-06-30 13:26:32 +01:00
bachinger
ed471fae96 Add @FallbackType to LoadErrorHandlingPolicy
No-op change that adds the @FallbackType IntDef and changes the signature of getBlacklistDurationMsFor(LoadErrorInfo) to getExclusionDurationMsFor(@FallbackType, LoadErrorInfo).

PiperOrigin-RevId: 381075496
2021-06-30 13:25:08 +01:00
samrobinson
2d44f82aa4 Correct naming of compilation field MediaMetadata.
PiperOrigin-RevId: 381016088
2021-06-30 13:20:18 +01:00
andrewlewis
7d05f20493 Signal container MIME type for JPEGs
Before this change the `Format` on the image track output by the
`JpegExtractor` doesn't have a MIME type.

PiperOrigin-RevId: 381015819
2021-06-30 13:19:00 +01:00
aquilescanta
1a8592c5c0 Add Player.Listener.onPlayerErrorChanged
Equivalent to onPlayerError, except it's also called for null.

PiperOrigin-RevId: 381015336
2021-06-30 13:17:49 +01:00
claincly
620ab67fee Improve timeout handling and allow customizing the timeout.
Previously, a SocketTimeourException is used to signal the end of the stream
that is caused by "no RTP packets received for a while". However, such
signaling is inappropriate under TransferRtpDataChannel, or FakeRtpDataChannel
in RtspPlaybackTests.

Hence, the signaling of end of stream is changed to use RESULT_END_OF_INPUT.
The RtpDataChannel implementations will Still block until a set timeout, but
will return a C.RESULT_END_OF_INPUT should a timeout occur, instead of
throwing a nested SocketTimeoutException.

This also allowed customization of the timeout amount, in
RtspMediaSource.Factory

PiperOrigin-RevId: 380981534
2021-06-30 13:16:44 +01:00
aquilescanta
d87fdaa370 Fix the single-sample SampleStream regarding FLAG_REQUIRE_FORMAT
The current FLAG_REQUIRE_FORMAT documentation states: If an end of
stream buffer would be read were the flag not set, then behavior is
unchanged.

PiperOrigin-RevId: 380792251
2021-06-30 13:14:12 +01:00
aquilescanta
ddd6a22561 Fix EventSampleStream's implementation regarding FLAG_REQUIRE_FORMAT
The current FLAG_REQUIRE_FORMAT documentation states: If an end of
stream buffer would be read were the flag not set, then behavior is
unchanged.

PiperOrigin-RevId: 380781976
2021-06-30 13:12:44 +01:00
bachinger
b48b618bce Parse multiple BaseURL elements
After this change, multiple BaseURL elements are parsed, but the player still only uses the first BaseURL element appearing in the manifest and its corresponding availabilityTimeOffsetUs.

PiperOrigin-RevId: 380775256
2021-06-30 13:11:25 +01:00
olly
9df2e42d4d Fix expansion of items within StyledPlayerView popup
Issue: #9086
#minor-release
PiperOrigin-RevId: 380756562
2021-06-22 10:17:28 +01:00
olly
c7b3fa367b HLS: Fix issue where a live event doesn't transition to STATE_ENDED
The problem occurs when the primary media playlist URL switches
from one whose latest snapshot has not yet got the ended tag, to
one whose latest snapshot already has the ended tag. In this case:

- We trigger a redundant load of the ended playlist.
- When the redundant load completes,
  MediaPlaylistBundle.processLoadedPlaylist detects that the
  playlist is unchanged from the one it already has, and so
  doesn't call onPlaylistUpdated.
- PrimaryPlaylistListener.onPrimaryPlaylistRefreshed is never
  called with the new primary. Hence the externally visible primary
  is still the one that hasn't ended. HlsMediaSource therefore thinks
  the event hasn't ended, which in turn prevents the player from
  transitioning to the ended state.

This commit detects when the new primary already has the ended tag.
In this case, we call onPrimaryPlaylistRefreshed directly and remove
the unnecessary playlist load.

Issue: #9067
#minor-release
PiperOrigin-RevId: 380680532
2021-06-21 23:53:59 +01:00
olly
b1dda6a02a Fix DefaultTimeBar glitches
The glitches were introduced in:
https://github.com/google/ExoPlayer/commit/6c31e34528

The problem is that Listener.onEvents is called in a later looper iteration
than the listener methods that were previously used. This created a gap on
the main thread between the UI component dispatching a seek operation to the
player, and onEvents being called to update the progress bar's position.

At the start of this gap the progress bar is rendering the new position,
but its position member variable is still set to the old position. If the
progress bar is re-drawn by another message on the main thread within the
gap, it will briefly show the old position until onEvents is called.

There are multiple possible fixes to this, and the best one is probably to
modify ListenerSet to remove the gap. That's high risk though, so for now we
fix the flicker by always updating the progress immediately after the seek
is dispatched, in addition to when onEvents is called.

Issue: #9049
#minor-release
PiperOrigin-RevId: 380678388
2021-06-21 23:52:43 +01:00
olly
3d3ac623a6 Specify a root when inflating child views
#minor-release

PiperOrigin-RevId: 380655806
2021-06-21 22:31:52 +01:00