11644 Commits

Author SHA1 Message Date
ibaker
ef61d81d8d Upgrade to Robolectric 4.6
The tests now pass without @DoNotInstrument

I had to tweak the jetification settings due to a bug in the jetifier
shipped with the Android Gradle Plugin. More details:
https://github.com/robolectric/robolectric/issues/6521#issuecomment-851736355

PiperOrigin-RevId: 382757006
2021-07-09 08:48:13 +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
7b0a7f1295 Remove stray space
PiperOrigin-RevId: 382297051
2021-07-09 08:24:44 +01:00
olly
a55c0654fb Improve Cronet and OkHttp READMEs
PiperOrigin-RevId: 382279955
2021-06-30 13:54:16 +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
02db70bdd0 Amend RTSP dev guide to match the current code status.
PiperOrigin-RevId: 381852972
2021-06-30 13:46:13 +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
olly
ea99c3fa94 Add ability to set Cronet request priority
PiperOrigin-RevId: 381833403
2021-06-30 13:42:42 +01:00
Oliver Woodman
8588bdb02a Merge pull request #9119 from chvp:media2-dispatch-previous-next
PiperOrigin-RevId: 381833313
2021-06-30 13:41:35 +01:00
olly
bb82e7df9d Cronet: Align terminology with documentation
PiperOrigin-RevId: 381472436
2021-06-30 13:40:24 +01:00
olly
6fe2f25fe9 Update DataSource extension documentation
Also upgrade the RTMP extension to use an inner class
for its factory.

PiperOrigin-RevId: 381469114
2021-06-30 13:39:09 +01:00
olly
ec9f512fee OkHttp: Upgrade to 4.9.1 (minSdkVersion 21)
Until now, we have stuck with the 3.12 long-term branch so as
to keep support for older API levels. However, this means that
the version we're using is 2.5 years old at this point. The
3.12 branch will stop receiving critical updates in December
2021.

Since use of the OkHttp extension is optional anyway, it seems
preferable to move to a modern version of OkHttp at this point.

PiperOrigin-RevId: 381465269
2021-06-30 13:37:58 +01:00
olly
c9193fdcf7 Fix release notes
PiperOrigin-RevId: 381443205
2021-06-30 13:36:52 +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
olly
bcd4bb87e5 Deprecate CronetEngineWrapper
PiperOrigin-RevId: 381239971
2021-06-30 13:32:43 +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
olly
75c06cc4e7 Cronet: Cleanup and simplify CronetEngineWrapper
A subsequent change will deprecate CronetEngineWrapper and move
all of the logic into a utility class for obtaining a suitable
CronetEngine.

This change also deprioritizes use of unknown cronet providers.

PiperOrigin-RevId: 381051164
2021-06-30 13:24:01 +01:00
aquilescanta
d6a95482d6 Add release notes for PlaybackException-related changes
PiperOrigin-RevId: 381021014
2021-06-30 13:22:53 +01:00
olly
116e50f365 Cronet: Deprecate internal fallback
The way CronetDataSource.Factory can internally fall back to another
factory is confusing and unnecessary. In the case the application cannot
instantiate a CronetEngine, it should directly use another factory.

This makes CronetDataSource more consistent with OkHttpDataSource. In
both cases, their factory constructors take the component that the
respective libraries advise should only be created once by the application,
which are CronetEngine and OkHttpClient respectively.

CronetEngineWrapper will be deprecated in a subsequent change.

PiperOrigin-RevId: 381016504
2021-06-30 13:21:39 +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
krocard
5e2197d82e Remove extra test checks intended to debug flaky test.
Those test are no longer flaky since the test clock
was made deterministic.

The removed assertions were introduced in a4ad351fb1.

PiperOrigin-RevId: 380793961
2021-06-30 13:15:21 +01:00