12775 Commits

Author SHA1 Message Date
tonihei
8bae89f1c4 Fully support per-track-type selection overrides.
Currently, TrackSelectionOverrides are documented as being applied
per track type, meaning that one override for a type disables all
other selections for the same track type. However, the actual
implementation only applies it per track group, relying on the
track selector to never select another renderer of the same type.

This change fixes DefaultTrackSelector to fully adhere to the
TrackSelectionsOverride definition. This solves problems when
overriding tracks for extension renderers (see Issue: google/ExoPlayer#9675)
and also simplifies a workaround added to StyledPlayerView.

#minor-release

PiperOrigin-RevId: 409121711
2021-11-11 13:54:45 +00:00
christosts
aa2a4e3055 Async buffer queueing: do not throw from flush/shutdown
The asynchronous MediaCodec adapter queues input buffers in a
background thread. If a codec queueuing operation throws an exception,
the buffer enqueuer will store it as a pending exception and re-throw it
the next time the adapter will attempt to queue another input buffer.

The buffer enqueuer's flush() and shutdown() may throw an exception if
the pending error is set. This is subject to a race-condition in which
the pending error can be set while the adapter is flushing/shutting down
the enqueuer, e.g., if an input buffer is still being queued and the
codec throws an exception. As a result, the adapter cannot flush or
shutdown gracefully.

This change makes the buffer enqueuer to ignore any pending error
when flushing/shuttinf down so that the adapter can flush/release
gracefully even if a queueing error was detected.

PiperOrigin-RevId: 409113054
2021-11-11 13:54:33 +00:00
christosts
ac413a14b3 Add experimental method to turn-off async flush
When operating the MediaCodec in asynchronous mode, after a
MediaCodec.flush(), we start MediaCodec in the callback thread,
which might trigger errors in some platforms. This change adds an
experimental flag to move the call to MediaCodec.start() back to the
playback thread.

PiperOrigin-RevId: 407801013
2021-11-11 13:53:42 +00:00
christosts
84c24fb677 Add DefaultMediaCodecFactory.getCodecAdapter() method
Add protected method DefaultRenderersFactory.getCodecAdapter(), so that
subclasses of DefaultRenderersFactory that override
buildVideoRenderers() or buildAudioRenderers() can access the
DefaultRenderersFactory codec adapter factory and pass it to
MediaCodecRenderer instances they may create.

PiperOrigin-RevId: 407345431
2021-11-11 13:53:10 +00:00
tonihei
e408a474af Make TrackSelectionOverride.getTrackType public
This method is helpful when iterating the list of track overrides
to figure out which type the override applies to.

Issue: google/ExoPlayer#9665
PiperOrigin-RevId: 409108977
2021-11-11 13:51:18 +00:00
tonihei
91f6e40922 Add repeat/shuffle mode documentation to the playlist page.
We only had some documentation for a custom shuffle mode, but none
for generic repeat or shuffle modes.

#minor-release

Issue: google/ExoPlayer#9611
PiperOrigin-RevId: 409089623
2021-11-11 13:51:10 +00:00
tonihei
898da1470d Update track selection documentation.
The Javadoc of DefaultTrackSelector can be shortened as it's not the
right place to document detailed options of the Player track selection
parameters.

The documentation page about track selection is updated to the new
APIs and extended with most relevant options and information needed
to work with ExoPlayer's track selection API.

#minor-release

PiperOrigin-RevId: 409088989
2021-11-11 13:51:02 +00:00
ibaker
4c61476f04 Fix header name in WebServerDispatcher used for testing
HTTP header names are case-insensitive, but all the others in this file
are 'correctly' cased, so we might as well be consistent.

PiperOrigin-RevId: 408840566
2021-11-11 13:50:54 +00:00
ibaker
5891b76ba2 Add contract tests for DataSource#getResponseHeaders
PiperOrigin-RevId: 408840409
2021-11-11 13:50:45 +00:00
ibaker
df0e89c167 Make DefaultHttpDataSourceContractTest an instrumentation test
Robolectric uses the JRE HttpURLConnection [1], while real Android
devices and emulators use OkHttp to implement HttpURLConnection. This
can lead to important differences in behaviour, so it's better to use
instrumentation tests when specific HTTP behaviour is important.

[1] https://github.com/robolectric/robolectric/issues/6769#issuecomment-943556156

PiperOrigin-RevId: 408840295
2021-11-11 13:50:36 +00:00
ibaker
c1aaf580f7 Fix TrackSelectionOverrides javadoc
#minor-release

PiperOrigin-RevId: 408825328
2021-11-11 13:36:37 +00:00
tonihei
5c6ee883e6 Add missing deprecation for old track selection override getters.
The setters in the Builder are already deprecated and using the
old getter is error-prone as they only return the overrides set
with the deprecated setters.

Issue: google/ExoPlayer#9665
PiperOrigin-RevId: 408817640
2021-11-11 13:35:15 +00:00
claincly
86447cb852
Merge branch 'dev-v2' into rtsp-socket-factory 2021-11-11 13:34:56 +00:00
tonihei
eec8d31544 Merge pull request #9543 from KasemJaffer:rf64
PiperOrigin-RevId: 408816643
2021-11-11 13:34:48 +00:00
kimvde
334fe47b60 WavExtractor: skip unknown chunks consistently
#minor-release

PiperOrigin-RevId: 408550935
2021-11-11 13:34:37 +00:00
ibaker
a6334716a8 Update exoplayer.dev copyright notice to 2021
#minor-release

PiperOrigin-RevId: 408331834
2021-11-11 13:34:21 +00:00
ibaker
8ead107181 Rollback of 95e6db931a
*** Original commit ***

Add link to annual media developer survey.

This will be removed after the survey has closed in ~1 month.

***

PiperOrigin-RevId: 408327757
2021-11-11 13:34:11 +00:00
tonihei
864e5a2dbc Add missing @Nullable for ExoPlayer.getPlayerError.
#minor-release

Issue: google/ExoPlayer#9660
PiperOrigin-RevId: 408323173
2021-11-11 13:34:03 +00:00
ibaker
942bfdb140 Add @Deprecated to MediaSourceFactory deprecated overrides
This is needed to ensure the deprecation warning appears on usages in
Android Studio and in javadoc.

#minor-release

PiperOrigin-RevId: 408319182
2021-11-11 13:33:49 +00:00
ibaker
e674a43f6e Remove usages of ParserException from the demo app
PiperOrigin-RevId: 408311942
2021-11-11 13:33:36 +00:00
ibaker
f9c1cab541 Split MediaItemTest#setSubtitles into two tests
Each test exercises one of the setters. Together they assert that both
setters set both fields.

PiperOrigin-RevId: 408309207
2021-11-11 13:33:20 +00:00
ibaker
57df39ffb8 Migrate GL demo from deprecated ExoPlayer.VideoComponent to ExoPlayer
#minor-release

PiperOrigin-RevId: 408304187
2021-11-11 13:32:59 +00:00
tonihei
cb60425aab Fully support per-track-type selection overrides.
Currently, TrackSelectionOverrides are documented as being applied
per track type, meaning that one override for a type disables all
other selections for the same track type. However, the actual
implementation only applies it per track group, relying on the
track selector to never select another renderer of the same type.

This change fixes DefaultTrackSelector to fully adhere to the
TrackSelectionsOverride definition. This solves problems when
overriding tracks for extension renderers (see Issue: google/ExoPlayer#9675)
and also simplifies a workaround added to StyledPlayerView.

#minor-release

PiperOrigin-RevId: 409121711
2021-11-11 13:27:26 +00:00
christosts
f43d6326bf Async buffer queueing: do not throw from flush/shutdown
The asynchronous MediaCodec adapter queues input buffers in a
background thread. If a codec queueuing operation throws an exception,
the buffer enqueuer will store it as a pending exception and re-throw it
the next time the adapter will attempt to queue another input buffer.

The buffer enqueuer's flush() and shutdown() may throw an exception if
the pending error is set. This is subject to a race-condition in which
the pending error can be set while the adapter is flushing/shutting down
the enqueuer, e.g., if an input buffer is still being queued and the
codec throws an exception. As a result, the adapter cannot flush or
shutdown gracefully.

This change makes the buffer enqueuer to ignore any pending error
when flushing/shuttinf down so that the adapter can flush/release
gracefully even if a queueing error was detected.

PiperOrigin-RevId: 409113054
2021-11-11 13:22:43 +00:00
tonihei
954531bd28 Make TrackSelectionOverride.getTrackType public
This method is helpful when iterating the list of track overrides
to figure out which type the override applies to.

Issue: google/ExoPlayer#9665
PiperOrigin-RevId: 409108977
2021-11-11 11:55:36 +00:00
tonihei
86f109c42f Add repeat/shuffle mode documentation to the playlist page.
We only had some documentation for a custom shuffle mode, but none
for generic repeat or shuffle modes.

#minor-release

Issue: google/ExoPlayer#9611
PiperOrigin-RevId: 409089623
2021-11-11 10:58:45 +00:00
tonihei
13806507b0 Update track selection documentation.
The Javadoc of DefaultTrackSelector can be shortened as it's not the
right place to document detailed options of the Player track selection
parameters.

The documentation page about track selection is updated to the new
APIs and extended with most relevant options and information needed
to work with ExoPlayer's track selection API.

#minor-release

PiperOrigin-RevId: 409088989
2021-11-11 10:54:15 +00:00
tonihei
658def4136 Plumb PlayerId to MediaSource.
MediaSource can be reused with other Player instances after they
have been released, so we need to set the PlayerId when preparing
the source. Access can mostly be handled by the implementation in
BaseMediaSource.

PiperOrigin-RevId: 408878824
2021-11-11 10:49:35 +00:00
ibaker
bf1cf13cab Fix header name in WebServerDispatcher used for testing
HTTP header names are case-insensitive, but all the others in this file
are 'correctly' cased, so we might as well be consistent.

PiperOrigin-RevId: 408840566
2021-11-11 10:45:10 +00:00
ibaker
dd95587cf2 Add contract tests for DataSource#getResponseHeaders
PiperOrigin-RevId: 408840409
2021-11-11 10:40:38 +00:00
ibaker
e4695abc18 Make DefaultHttpDataSourceContractTest an instrumentation test
Robolectric uses the JRE HttpURLConnection [1], while real Android
devices and emulators use OkHttp to implement HttpURLConnection. This
can lead to important differences in behaviour, so it's better to use
instrumentation tests when specific HTTP behaviour is important.

[1] https://github.com/robolectric/robolectric/issues/6769#issuecomment-943556156

PiperOrigin-RevId: 408840295
2021-11-11 10:35:56 +00:00
ibaker
0e36bdb2e6 Fix TrackSelectionOverrides javadoc
#minor-release

PiperOrigin-RevId: 408825328
2021-11-11 10:30:28 +00:00
tonihei
ee006ff2b5 Add missing deprecation for old track selection override getters.
The setters in the Builder are already deprecated and using the
old getter is error-prone as they only return the overrides set
with the deprecated setters.

Issue: google/ExoPlayer#9665
PiperOrigin-RevId: 408817640
2021-11-11 10:26:02 +00:00
tonihei
04517e17d4 Merge pull request #9543 from KasemJaffer:rf64
PiperOrigin-RevId: 408816643
2021-11-11 10:21:29 +00:00
hschlueter
5ae60f2be7 Split VideoSamplePipeline from TransformerTranscodingVideoRenderer.
The `VideoSamplePipeline` handles all steps from decoding to
re-encoding that where previously in
`TransformerTranscodingVideoRenderer`. The renderer is now only
responsible for reading the format, reading input, passing it to the
pipeline and passing the pipeline's output to the muxer.

When no transformations are needed, decoding and re-encoding is
skipped using the `PassthroughPipeline`.

PiperOrigin-RevId: 408619407
2021-11-11 10:16:53 +00:00
tonihei
f633e76c15 Plumb PlayerId to renderers.
We can rename the existing setIndex method to a more generic init
as this method is only called by EPII and implemented by BaseRenderer
anyway.

PiperOrigin-RevId: 408616055
2021-11-11 10:12:17 +00:00
hschlueter
30c77e8e1c Refactor buffer duration calculation for clarity.
Follow-up to address comments from 9efa32e49b.

PiperOrigin-RevId: 408600470
2021-11-11 10:07:39 +00:00
Sebastian Roth
c09fa7560d PR feedback 2021-11-10 16:41:48 +00:00
kimvde
4082d8a63d WavExtractor: skip unknown chunks consistently
#minor-release

PiperOrigin-RevId: 408550935
2021-11-09 15:09:42 +00:00
hschlueter
9efa32e49b Accumulate remainder in buffer duration calculations.
When dropping the remainder, the decoder and encoder timestamps start diverging after a few buffers when no speed changes are supposed to occur. Tracking the remainder keeps them in sync.

PiperOrigin-RevId: 408341074
2021-11-08 17:05:09 +00:00
ibaker
ba9ade1c8e Update exoplayer.dev copyright notice to 2021
#minor-release

PiperOrigin-RevId: 408331834
2021-11-08 17:00:35 +00:00
ibaker
1eca6700ae Rollback of 95e6db931a
*** Original commit ***

Add link to annual media developer survey.

This will be removed after the survey has closed in ~1 month.

***

PiperOrigin-RevId: 408327757
2021-11-08 16:56:03 +00:00
tonihei
5de4915fe4 Add missing @Nullable for ExoPlayer.getPlayerError.
#minor-release

Issue: google/ExoPlayer#9660
PiperOrigin-RevId: 408323173
2021-11-08 14:46:28 +00:00
ibaker
d06e8136ee Add @Deprecated to MediaSourceFactory deprecated overrides
This is needed to ensure the deprecation warning appears on usages in
Android Studio and in javadoc.

#minor-release

PiperOrigin-RevId: 408319182
2021-11-08 14:41:45 +00:00
ibaker
364239ac8c Remove usages of ParserException from the demo app
PiperOrigin-RevId: 408311942
2021-11-08 14:36:53 +00:00
ibaker
4404404795 Split MediaItemTest#setSubtitles into two tests
Each test exercises one of the setters. Together they assert that both
setters set both fields.

PiperOrigin-RevId: 408309207
2021-11-08 14:32:04 +00:00
ibaker
b3b4645e69 Migrate GL demo from deprecated ExoPlayer.VideoComponent to ExoPlayer
#minor-release

PiperOrigin-RevId: 408304187
2021-11-08 14:27:05 +00:00
tonihei
136ce57f1e Create wrapper class for LogSessionId.
The platform class is only available from API 31, so we need
a generic wrapper that can be used on all API levels. The wrapper
essentially provides an identifier for a player instance, so naming
it accordingly.

PiperOrigin-RevId: 408292802
2021-11-08 14:22:02 +00:00
christosts
3bc7ffe644 Minor fix in AsynchronousMediaCodecAdapter.signalEndOfInputStream()
PiperOrigin-RevId: 407635099
2021-11-08 10:47:31 +00:00
olly
a9473796b1 Update security mailing list
PiperOrigin-RevId: 407540705
2021-11-08 10:47:16 +00:00