6172 Commits

Author SHA1 Message Date
krocard
b6f5a263f7 Rollforward of commit 5612ac50a332e425dc130c3c13a139b9e6fce9ec.
*** Reason for rollforward ***

Rollforward after making sure the handler is created
from the playback thread and not from an app thread.

*** Original change description ***

Rollback of e1beb1d194

*** Original commit ***

Expose experimental offload scheduling

Add a new scheduling mode that stops ExoPlayer main loop
when the audio offload buffer is full and resume it when
it has been partially played.

This mode needs to be enabled and dissabled manually by the app
for now.

#exo-offload

***

***

PiperOrigin-RevId: 316898804
2020-06-17 22:19:59 +01:00
andrewlewis
2546be51fe Remove some ad playback state change requirements
Ads can appear due to asynchronous ad tag requests completing after
earlier ads in a pod have loaded, so remove the requirement that the
ad count can't change. The MediaPeriodQueue should handling discarding
buffered content if an ad appears before already buffered content, so
I think this case is actually handled correctly by the core player
already.

Also remove the requirement that an ad URI can't change. This is a
defensive measure for now, but it's likely that a later fix in the IMA
SDK for an issue where loadAd is not called after preloading then
seeking before a preloaded ad plays will result in loadAd being called
more than once, and I think it's possible that the second call to
loadAd may have a different URI. Because the ad URI should only change
after an intermediate seek to another MediaPeriod, there shouldn't be
any problems with buffered data not getting discarded.

Issue: #7477
PiperOrigin-RevId: 316871371
2020-06-17 14:32:48 +01:00
tonihei
99954b4ca0 Deflake DecoderVideoRendererTest
The test was trying to synchronize a background decoding thread by
waiting for pending decode calls. However, the background thread needs
to fully queue the newly available output buffer before we can stop
waiting to ensure it's actually fully predictable. So we change the
pending wait to wait until the input buffer is cleared, which only
happens after the decoder is definitely done with it.

Also properly clean-up decoder (including shutting down the background
thread).

PiperOrigin-RevId: 316870659
2020-06-17 14:32:32 +01:00
olly
f85098a88f Update deprecation JavaDoc for ExoPlayer DataSpec
constructor to note that the builder does NOT
infer the http method from the existence of the
post body.

PiperOrigin-RevId: 316765677
2020-06-17 14:31:59 +01:00
olly
c808db9935 Add MIME types for which every sample is known to be a sync sample.
- Leaving the TODO, since there are still MIME types we're unsure about.
- Removing AAC because xHE-AAC does not have this property. We may re-add
  it with an additional profile check to exclude xHE-AAC in the future.

PiperOrigin-RevId: 316715147
2020-06-17 14:31:43 +01:00
olly
e6b6a86a77 Remove support for MKV invisible flag
We haven't seen it used anywhere in practice. It's a niche feature not
supported by any other extractors, and is one of the very few things
stopping us from simplifying MediaSource implementations to not set the
decodeOnly sample flag. This is a simplification that we want to make,
since the current mechanism doesn't work properly for cases where a
downstream decoder adjusts the buffer presentation timestamps so that
they're different on the output side than on the input side.

PiperOrigin-RevId: 316712302
2020-06-17 14:31:27 +01:00
aquilescanta
2273b00a53 Create HlsMediaChunkExtractor
To be the abstraction to use for integrating with MediaParser.

PiperOrigin-RevId: 316710421
2020-06-17 14:31:10 +01:00
tonihei
aed8cad8c3 Remove unused waitingForKeys in renderers.
This flag isn't needed anymore because the waiting for keys happens on
the source side and the source just returns NOTHING_READ under the
same conditions.

PiperOrigin-RevId: 316704214
2020-06-17 14:30:54 +01:00
tonihei
cc97bcb469 Move runUntil method to TestUtil as it's used by multiple tests.
We started using this method from other tests unrelated to
TestExoPlayer, so the method is better placed inside a generic Util
class.

PiperOrigin-RevId: 316675067
2020-06-17 14:30:37 +01:00
bachinger
b7233c28e9 Add Player.getCurrentMediaItem()
PiperOrigin-RevId: 316650017
2020-06-17 14:30:21 +01:00
bachinger
5b28cb5209 Add getMediaItem() to MediaSource
This change adds MediaSource.getMediaItem and deprecates MediaSource.getTag. For backwards compatibility, the tag is made available through the Window with `mediaItem.playbackProperties.tag` as well as in the deprecated `tag` attribute.

PiperOrigin-RevId: 316539752
2020-06-17 14:30:04 +01:00
tonihei
cd54e3e584 Clarify usage of default period-in-window offset in tests.
Using the default offset as a magic constant makes tests hard to
understand. Improve that by looking up the value from the timeline or
setting it explicitly in multiple places, so the relationship becomes
clear.

PiperOrigin-RevId: 316421977
2020-06-17 14:29:31 +01:00
aquilescanta
3ec4ec4dac Make ChunkExtractor.read return a boolean instead of an int
PiperOrigin-RevId: 316172860
2020-06-17 14:29:14 +01:00
christosts
41d4a132c4 Add configure() in MediaCodecAdapter
The correct order of initializing the MediaCodec should be (as per
documentation
https://developer.android.com/reference/android/media/MediaCodec#initialization)

"create -> setCallback -> configure -> start"

but the MediaCodecRenderer currently does

"create -> configure -> setCallback -> start"

MediaCodec implementations did not complain about this so far, but the
wrong sequence does not work with the MediaCodec in block mode (new mode
in Android R) and also the ShadowMediaCodec won't operate in
asynchronous mode otherwise. To initialize the MediaCodec in the correct
order, this commit adds configure() in the MediaCodecAdapter so the
MediaCodecRenderer can do:

adapter.configure(); // sets the callback and then configures the codec
adapter.start();     // starts the codec

PiperOrigin-RevId: 316127680
2020-06-17 14:28:57 +01:00
olly
0a617146b0 Remove duplicate DECODE_ONLY check
PiperOrigin-RevId: 316119460
2020-06-12 18:11:48 +01:00
andrewlewis
f1b94f6f90 Add AdPlaybackState toString
This is useful for debugging both in tests and via logging.

PiperOrigin-RevId: 316102968
2020-06-12 18:11:39 +01:00
andrewlewis
28a7e59d7b Fix javadoc
PiperOrigin-RevId: 316071392
2020-06-12 18:11:12 +01:00
Oliver Woodman
df86278289 Merge pull request #7451 from szaboa:dev-v2-4511
PiperOrigin-RevId: 315995776
2020-06-12 00:26:45 +01:00
andrewlewis
5612ac50a3 Rollback of e1beb1d194
*** Original commit ***

Expose experimental offload scheduling

Add a new scheduling mode that stops ExoPlayer main loop
when the audio offload buffer is full and resume it when
it has been partially played.

This mode needs to be enabled and dissabled manually by the app
for now.

#exo-offload

***

PiperOrigin-RevId: 315948869
2020-06-12 00:26:35 +01:00
andrewlewis
fc0e0d4cb8 Rollback of 2aac0717d7
*** Original commit ***

Propagate format in supportsOutput

It is needed to know if gapless is needed,
as gapless offload might not be supported.

***

PiperOrigin-RevId: 315947888
2020-06-12 00:26:26 +01:00
andrewlewis
8afc0c3424 Rollback of 962e08d3be
*** Original commit ***

Add Offload gapless support

Confirmed to work on a Pixel 4 after enabling the feature:
 `setprop vendor.audio.offload.gapless.enabled true`

***

PiperOrigin-RevId: 315946947
2020-06-12 00:26:17 +01:00
olly
5324dc37e3 Support passing custom manifest parsers to Downloaders
Issue: #5978
PiperOrigin-RevId: 315941765
2020-06-12 00:26:08 +01:00
tonihei
73283d495a Add test that asserts correct offsets are used in renderer.
The test uses two items with period-in-window offsets and a non-zero default start position. The test also prepares the first item lazily so
that the start position (and thus the renderer offsets) need to change.
This is arguably the most complicated setup that needs to be tested.

PiperOrigin-RevId: 315903958
2020-06-12 00:26:00 +01:00
krocard
962e08d3be Add Offload gapless support
Confirmed to work on a Pixel 4 after enabling the feature:
 `setprop vendor.audio.offload.gapless.enabled true`

PiperOrigin-RevId: 315889054
2020-06-12 00:25:51 +01:00
tonihei
0b608dd19c Fix order of events in ProgressiveMediaPeriod.
The order of source info refresh and onPrepared was accidentally
changed by ed88f4f1dd. This changes it back to the correct order
and adds a test

PiperOrigin-RevId: 315885164
2020-06-12 00:25:42 +01:00
krocard
2aac0717d7 Propagate format in supportsOutput
It is needed to know if gapless is needed,
as gapless offload might not be supported.

PiperOrigin-RevId: 315877127
2020-06-12 00:25:33 +01:00
christosts
285cce629f Rename DedicatedThreadAsyncMediaCodecAdapter
Rename the DedicatedThreadAsyncMediaCodecAdapter to
AsynchronousMediaCodecAdapter as it is the only asynchronous adapter
implementation left after the clean-up.

PiperOrigin-RevId: 315873431
2020-06-12 00:25:24 +01:00
krocard
e1beb1d194 Expose experimental offload scheduling
Add a new scheduling mode that stops ExoPlayer main loop
when the audio offload buffer is full and resume it when
it has been partially played.

This mode needs to be enabled and dissabled manually by the app
for now.

#exo-offload

PiperOrigin-RevId: 315860373
2020-06-12 00:24:57 +01:00
kimvde
88b36abce6 Sniff all inferred extractors in DefaultHlsExtractorFactory
PiperOrigin-RevId: 315857270
2020-06-11 10:11:40 +01:00
Oliver Woodman
2fcd759edb Merge pull request #7479 from sravan1213:dev-v2
PiperOrigin-RevId: 315794031
2020-06-11 10:11:30 +01:00
aquilescanta
e7da26368a Add MediaParser-based implementation of ChunkExtractor
PiperOrigin-RevId: 315720712
2020-06-11 10:11:20 +01:00
christosts
3ce57ae2e8 Remove dropped MediaCodecAdadpters
Delete the AsynchronousMediaCodecAdapter, the
MultiLockAsyncMediaCodecAdapter and their tests.

PiperOrigin-RevId: 315694296
2020-06-11 10:11:11 +01:00
tonihei
95b61eb835 Split TrackSelection.evalauteQueueSize in discard and cancelation.
The option to cancel ongoing loads as part of the queue size evalation
was added recently. This split out the decision to a new method so that
a TrackSelection implementation can independently cancel loads and
discard upstream data. It also clarifies that evaluateQueueSize will
only be called if there is no ongoing load.

Issue: #2848
PiperOrigin-RevId: 315659735
2020-06-11 10:11:02 +01:00
tonihei
2a9144fa56 Fix loadCompleted flag in MediaChunk implementations.
This flag was always set even if the load was canceled and not completed.

PiperOrigin-RevId: 315659262
2020-06-11 10:10:53 +01:00
tonihei
b0d98a2e22 Find correct next chunk if previous one didn't finish loading.
If the previous chunk didn't finish loading, we need to find the appropriate
next chunk based on the current loading position (or the previous chunk's
start time if not independent).

PiperOrigin-RevId: 315658435
2020-06-11 10:10:45 +01:00
andrewlewis
b0457da038 Simplify timestamp tracking
An integer multiple/divide can be removed without loss of precision.

PiperOrigin-RevId: 315653905
2020-06-11 10:10:36 +01:00
krocard
0caada8b8c Fix formating in javadoc
PiperOrigin-RevId: 315516836
2020-06-11 10:10:27 +01:00
olly
5aa8a7a507 Prevent shutter closing for within-window seeks to unprepared periods
Issue: #5507
PiperOrigin-RevId: 315512207
2020-06-11 10:10:18 +01:00
kimvde
1f17756ad2 Optimize DefaultExtractorsFactory order using MIME types
PiperOrigin-RevId: 315485985
2020-06-11 10:10:00 +01:00
olly
c759b5b1a9 Add option to hide Prev/Rwnd/Ffwd/Next buttons
Issue: #7410
PiperOrigin-RevId: 315480798
2020-06-09 16:05:44 +01:00
aquilescanta
a11f7b8cdd Document DataSource.getResponseHeaders case-insensitivity
PiperOrigin-RevId: 315480048
2020-06-09 16:05:33 +01:00
ibaker
947485e2b7 CEA-608: Position top-of-screen roll-up cues with bottom-line=row
Reasoning and screenshots here:
https://github.com/google/ExoPlayer/issues/7475#issuecomment-640770791

Issue: #7475
PiperOrigin-RevId: 315475888
2020-06-09 16:05:22 +01:00
christosts
d23ca7b11a Set MediaCodec operation mode for audio/video
Add experimental APIs to set the MediaCodecOperationMode separately
for audio and video.

PiperOrigin-RevId: 315467157
2020-06-09 16:05:11 +01:00
samrobinson
83758577e3 Temporary fix for gapless regression for MP3.
PiperOrigin-RevId: 315334491
2020-06-09 16:04:49 +01:00
kimvde
b1e56304a1 Add support for inferring file format from MIME type
PiperOrigin-RevId: 315283926
2020-06-08 17:41:16 +01:00
bachinger
99d805f6a8 Make media item of SinglePeriodTimeline non-null
This change makes the media item argument in any constructors of the SinglePeriodTimeline non-null. Further a dummy media item is created for deprecated constructors using a tag only.

PiperOrigin-RevId: 315283842
2020-06-08 17:41:06 +01:00
aquilescanta
c37af0b543 Make ChunkExtractor return a ChunkIndex instead of a SeekMap
PiperOrigin-RevId: 315283645
2020-06-08 17:40:55 +01:00
ibaker
770df8636a CEA-608: Don't assume roll-up captions are at the bottom of the screen
ANSI/CTA-608-E R-2014 Annex B.5 says:
"The concept of a movable base row for a roll-up caption is new."

It means "new" compared to TC1 and TC2 (released in or before 1985).

Issue: #7475
PiperOrigin-RevId: 315258859
2020-06-08 17:40:44 +01:00
ibaker
b7486f4883 Add a test for 33-bit HLS WebVTT wraparound
This also gives some general test coverage for HLS' WebvttExtractor

Issue: #7462
PiperOrigin-RevId: 315257252
2020-06-08 17:40:33 +01:00
andrewlewis
bc7310240d Suppress repeated logging for invalid MP3 headers
PiperOrigin-RevId: 315243493
2020-06-08 17:40:22 +01:00