7878 Commits

Author SHA1 Message Date
kimvde
10b4e10f43 Move SimpleExoPlayer.Builder to ExoPlayer
- Remove ExoPlayer.Builder
- Copy SimpleExoPlayer.Builder to ExoPlayer
- Deprecate SimpleExoPlayer.Builder

PiperOrigin-RevId: 389890299
2021-08-11 12:07:16 +01:00
olly
f5d8c211f5 Remove some deprecated source/sink classes
PiperOrigin-RevId: 389879570
2021-08-11 12:06:02 +01:00
olly
31a839c848 Move non-player specific classes to common
These will all be needed in common to break dependencies
between decoder extension modules and the core module.

PiperOrigin-RevId: 389871983
2021-08-10 15:01:42 +01:00
christosts
b4e99304c4 Bump version to 2.15.0 and tidy release notes
#minor-release

PiperOrigin-RevId: 389871495
2021-08-10 15:00:24 +01:00
olly
b627d70054 Migrate uses of deprecated DataSource factories
PiperOrigin-RevId: 389844289
2021-08-10 14:56:20 +01:00
ibaker
ff078cb4b5 Add explicit protected constructor to Timeline.
Timeline is already abstract, so it can only be constructed from a
subclass anyway.

PiperOrigin-RevId: 389827960
2021-08-10 14:53:23 +01:00
olly
700ec93994 Move DeviceInfo into root package
PiperOrigin-RevId: 389681733
2021-08-09 20:11:23 +01:00
olly
7e8ba03147 Deprecate final non-nested Factory classes in upstream
PiperOrigin-RevId: 389661768
2021-08-09 20:07:24 +01:00
olly
e2ffb5e11b Remove DeviceListener
PiperOrigin-RevId: 389640670
2021-08-09 20:06:05 +01:00
olly
5dc8eeb4bf Remove IntArrayQueue from public API
PiperOrigin-RevId: 389622428
2021-08-09 20:03:22 +01:00
ibaker
db1fe8041b Remove @DoNotInstrument from test classes
This isn't needed now we've updated to Robolectric 4.6

Follow-up to 0df0df9aee

PiperOrigin-RevId: 389616471
2021-08-09 20:02:05 +01:00
ibaker
849c307402 Move requiresSecureDecoder logic into ExoMediaDrm
The result is plumbed back to `MediaCodecRenderer` via a new
`DrmSession#requiresSecureDecoder` method.

This allows us to use the `MediaDrm#requiresSecureDecoder` method added
in Android 12:
https://developer.android.com/reference/android/media/MediaDrm#requiresSecureDecoder(java.lang.String)

This change also removes
`FrameworkMediaCrypto#forceAllowInsecureDecoderComponents`, replacing it
with equivalent logic in `FrameworkMediaDrm#requiresSecureDecoder`.

PiperOrigin-RevId: 389616038
2021-08-09 20:00:42 +01:00
olly
0097a79c2d Add ability to disable Surface.setFrameRate calls
Adding a CHANGE_FRAME_RATE_STRATEGY_ALWAYS strategy is
omitted from this commit, since adding it is more complicated
than just plumbing it through and leaving everything else
unchanged. Specifically, VideoFrameReleaseTimeHelper would
need updating to behave differently when such a strategy is
enabled. It currently calls setFrameRate in cases such as
pausing, seeking and re-buffering, on the assumption that
changes to the underlying display refresh rate will only be
made if they can be done seamlessly. For a mode in which
this will not be the case, it makes more sense to stick to
the content frame-rate when these events occur. It may also
make sense to only use explicit content frame-rate values,
and not those inferred from individual frame timestamps.
Finally, for adaptive content containing a mix of frame-rates,
it makes sense to use the maximal frame-rate across all
variants, and to avoid calling setFrameRate on switches from
one variant to another.

Applications that know the frame-rate of their content can
set ExoPlayer's strategy to CHANGE_FRAME_RATE_STRATEGY_OFF and
then use setFrameRate directly on the output surface. Note that
this is likely to be a better option for apps than anything we
could implement in ExoPlayer, because the application layer
most likely knows the frame-rate of the content earlier than
ExoPlayer does (e.g., to perform the disruptive mode switch
at the same time as an activity transition).

Adding CHANGE_FRAME_RATE_STRATEGY_ALWAYS will be deferred
until there's clear demand for it. In the meantime, we'll
recommend the alternative approach above.

PiperOrigin-RevId: 389610965
2021-08-09 19:59:16 +01:00
claincly
be19624a20 Add a factory option to enable logging RTSP messages.
Many GH users find it hard to print out RTSP messages if they use ExoPlayer
as an external dependency.

PiperOrigin-RevId: 389197812
2021-08-09 19:56:22 +01:00
christosts
d698e96a57 Fix bug in Timeline.getRemovedAdGroupCount()
#minor-release

PiperOrigin-RevId: 389174519
2021-08-06 16:02:43 +01:00
olly
225081721d Statically import TRACK_TYPE constants in SimpleExoPlayer
PiperOrigin-RevId: 389170562
2021-08-06 16:01:22 +01:00
apodob
a5e772f91f Move SubtitleDecoder to common
This CL moves SubtitleDecoder and all its dependencies
to common in order to enable using it in extractor
module while implementing SubtitleExtractor.

PiperOrigin-RevId: 388979021
2021-08-06 16:00:03 +01:00
apodob
281fc84d15 Add CueDecoder and CueEncoder.
This CL introduces two classes:
* CueEncoder - encodes list of Cue object into byte array.
* CueDecoder - decodes byte array into list of Cue objects.

This two classes are necessary in order to push Cues through SampleQueue. This classes are meant to be used by subtitle Extractor.

PiperOrigin-RevId: 388932088
2021-08-06 15:58:45 +01:00
kimvde
9e798a647e Miscalleneous small fixes in Transformer
PiperOrigin-RevId: 388911857
2021-08-06 15:56:01 +01:00
olly
8525ef70ba Remove SDK_INT codename checks for R and S
These API levels have both been finalized. We're also calling methods
from these API levels directly, which may not exist if a device is
running a non-finalized R or S release.

PiperOrigin-RevId: 388903410
2021-08-06 15:53:08 +01:00
olly
9dcfd90ef7 Cleanup some deprecated constants
PiperOrigin-RevId: 388893920
2021-08-05 12:33:28 +01:00
andrewlewis
d0e426080b Set StreamIndex Name as format.label in SS
Issue: #9252

#minor-release

PiperOrigin-RevId: 388889406
2021-08-05 12:32:15 +01:00
claincly
a5cbd9f6c2 Handle RTSP session id properly.
Issue: #9254

#minor-release

We used to allow only alphanumerical characters in session id. The spec also
allows "$", "-", "_", ".", "+" (RFC2326 Sections 3.4 and 15.1).

PiperOrigin-RevId: 388873742
2021-08-05 12:31:06 +01:00
sungsoo
a533d8190a Add a method to distinguish whether a player can be set by MediaSession
PiperOrigin-RevId: 388835913
2021-08-05 12:28:34 +01:00
aquilescanta
7375fe3105 Simplify network-related error codes
This change removes ERROR_CODE_IO_NETWORK_UNAVAILABLE,
ERROR_CODE_IO_NETWORK_CONNECTION_CLOSED, and ERROR_CODE_IO_DNS_FAILED
in favor of keeping only ERROR_CODE_IO_NETWORK_CONNECTION_FAILED.

PiperOrigin-RevId: 388715972
2021-08-04 18:47:32 +01:00
Christos Tsilopoulos
81d0fe2d0f Merge pull request #9247 from colinbarr:dev-v2-rtsp-fmtp-trailing-semicolon
PiperOrigin-RevId: 388713101
2021-08-04 18:42:00 +01:00
olly
a34809bb9d Tweak use of TimestampAdjuster for seeking
- Fix use of getTimestampOffsetUs in TsExtractor where
  getFirstSampleTimestampUs should have been used.
- Don't reset TimestampAdjuster if it's in no-offset mode.
- Improve comment clarity

#minor-release

PiperOrigin-RevId: 388682711
2021-08-04 18:40:45 +01:00
christosts
4b1609d569 Set HlsSampleStreamWrapper.trackType for audio-only playlists
For audio-only playlists, when formats are communicated to the app with
AnalyticsListener.onDownstreamFormatChanged(), the passed MediaLoadData
do not indicate this is an audio track and therefore the
PlaybackStatsListener cannot derive audio format-related information.

This change sets the main SampleStreamWrappers track type to AUDIO, if
the master playlist contains only audio variants.

Issue: #9175

#minor-release

PiperOrigin-RevId: 388676060
2021-08-04 18:38:37 +01:00
christosts
07c49cdad8 Change how AnalyticsCollector releases listeners
The AnalyticsCollector releases listeners lazily so that listener
callbacks triggered on the application looper after
SimpleExoPlayer.release() are still handled. The change in ListenerSet
to post the onEvents callback on the front of the application looper
changed (correctly) how onEvents are propagated, however this made
the AnalyticsCollector deliver onEvents with out-of-order EventTimes.

This change fixes AnalyticsCollector to trigger onPlayerReleased() and
the matching onEvents() event in the correct order.

#minor-release

PiperOrigin-RevId: 388668739
2021-08-04 18:37:16 +01:00
ibaker
6157c615b2 Standardise API-level specific nested classes
This change aligns all the names for classes that are 'holders of static
methods' to be `ApiNN`. Classes that hold state are named meaningfully
based on that state.

PiperOrigin-RevId: 388641064
2021-08-04 18:35:50 +01:00
andrewlewis
5e4cd1293e Use AudioTrack.isDirectPlaybackSupported on TVs only
Issue: #9239

#minor-release

PiperOrigin-RevId: 388437614
2021-08-03 15:37:55 +01:00
apodob
8cddd4d80d Add font-size support to WebVTT CssParser.
This CL addresses the github issue [#8946](https://github.com/google/ExoPlayer/issues/8964). That issue requests support for `font-size` CSS property in WebVTT subtitle format. This CL:
* Adds support for `font-size` property by extending capabilities of WebVTT `CssParser`. Implementation of `font-size` property value parsing is based on the one in `TtmlDecoder`.
* Adds unit test along with test file containing WebVTT subtitles with all currently supported `font-size` units.

#minor-release

PiperOrigin-RevId: 388423859
2021-08-03 15:35:21 +01:00
olly
bffa3e0afb ContentDataSource: Restore ability to open file URIs
PiperOrigin-RevId: 388410558
2021-08-03 15:33:56 +01:00
Colin Barr
0921efab3e
Switch to an explicit limit of 0 for splitting on RTSP fmtp parameters 2021-08-03 10:33:49 +01:00
Colin Barr
6f67cb839c
Handle trailing semicolon on RTSP fmtp attribute 2021-08-02 21:15:33 +01:00
olly
f329adbc23 Opt ExoPlayer out of transcoding when reading content URIs
PiperOrigin-RevId: 388260014
2021-08-02 19:22:23 +01:00
olly
4013612194 HLS: Avoid stuck-buffering issues
Issue: #8850
Issue: #9153
#minor-release
PiperOrigin-RevId: 388257563
2021-08-02 19:20:57 +01:00
olly
f726212180 Simplify TimestampAdjuster logic
- Use timestampOffsetUs == C.TIME_UNSET directly as the way of
  determining whether the adjuster has determined the offset,
  rather than relying on lastSampleTimestampUs checks for this.
- Remove comment referring to lastSampleTimestampUs as holding
  the "adjusted PTS". Its value may not have originated from a PTS
  timestamp. It's also confusing to refer to it as "adjusted"
  given timestampOffsetUs has not been applied to it.
- Fix PassthroughSectionPayloadReader to make sure it'll never
  output a sample with an unset timestamp.

#minor-release

PiperOrigin-RevId: 388226180
2021-08-02 19:19:28 +01:00
olly
ce7c04fac1 Move setFrameRate calls into wrapper class
PiperOrigin-RevId: 388187294
2021-08-02 19:17:53 +01:00
olly
181838168c Fix resetting TimestampAdjuster with DO_NOT_OFFSET
Prior to this change, an initalized TimestampAdjuster that's then
reset with DO_NOT_OFFSET would incorrectly continue to apply the
offset.

Also add a test case for this issue, and for some other simple use
cases.

#minor-release

PiperOrigin-RevId: 388182645
2021-08-02 19:16:15 +01:00
aquilescanta
bbff5f0cc1 Assign missing error codes in UdpDataSource
PiperOrigin-RevId: 387794965
2021-08-02 11:00:34 +01:00
claincly
0bf40f8978 Fix some ErrorCode assigning cases.
DefaultHttpDataSource and OkHttpDataSource can share the same error code
assigning logic.

Fixes CronetDataSource's handling of closed connection.

PiperOrigin-RevId: 387791679
2021-08-02 10:59:30 +01:00
claincly
df49f90b7f Simplify the error code handling.
PiperOrigin-RevId: 387786273
2021-08-02 10:58:11 +01:00
aquilescanta
f19a3674f3 Assign ERROR_CODE_IO_FILE_NOT_FOUND for AssetDataSource
PiperOrigin-RevId: 387777480
2021-08-02 10:56:51 +01:00
aquilescanta
1bad403eec Add fallback case for provisioning errors
PiperOrigin-RevId: 387772641
2021-08-02 10:55:36 +01:00
aquilescanta
c45d54726f Simplify FileDataSource exception management
And change one IO_UNSPECIFIED for a ERROR_CODE_FAILED_RUNTIME_CHECK.

PiperOrigin-RevId: 387772253
2021-08-02 10:54:20 +01:00
aquilescanta
e65bcefad1 Reorder DataSourceException constructors and accept nullable parameters
This CL doesn't introduce functional changes.

PiperOrigin-RevId: 387613057
2021-07-29 21:12:30 +01:00
andrewlewis
337d5aa9b6 Fix parameter names on overridden methods
The dokka javadoc generation tool complains when parameter names don't match between a method and its override. This change updates occurrences where there is currently a mismatch.

PiperOrigin-RevId: 387367509
2021-07-29 21:09:30 +01:00
andrewlewis
9c27cfcda7 Fix parameter names on overridden methods
The dokka javadoc generation tool complains when parameter names don't match between a method and its override. This change updates occurrences where there is currently a mismatch.

Notable renamings that might be controversial:
- `onPlaybackStateChanged(int state)` to `onPlaybackStateChanged(int playbackState)` affected a lot of lines but seems more consistent with other '-Changed' methods.
- `handleMessage(int messageType, Object payload)` to `handleMessage(int messageType, Object message)`
- `ExtractorInput` and `DataSource` inherit `DataReader` which had `read(byte[] target, ...`, while data sources normally called the first parameter `buffer`. I have standardized these all to use `buffer` even though it looks out of place in the `ExtractorInput` interface (which has more `read` methods with `target`).

PiperOrigin-RevId: 387290360
2021-07-28 09:15:29 +01:00
ibaker
41fe5aa1e3 Throw IllegalStateException from Util.gzip() instead of AssertionError
The documentation on ByteArrayOutputStream and GZIPOutputStream isn't
completely clear that an IOException will *never* happen, so
AssertionError seems a bit strong - but it seems very unlikely, so we
just use IllegalStateException instead.

#minor-release

PiperOrigin-RevId: 387169297
2021-07-28 09:14:09 +01:00