9888 Commits

Author SHA1 Message Date
ibaker
2371b024dd Switch to an 'api' dependency on Guava
The 'implementation' dependency causes problems when resolving
ListenableFuture in contexts that also include the
com.google.guava:listenablefuture:1.0 dependency.

Issue: #7905
Issue: #7997
Issue: #7993
PiperOrigin-RevId: 337093024
2020-10-17 01:34:15 +01:00
andrewlewis
eccc00bca8 Add a way to override ad media MIME types
Issue: #7961
PiperOrigin-RevId: 337069152
2020-10-17 01:34:06 +01:00
andrewlewis
cfe267a568 Encapsulate ImaAdsLoader configuration in a class
This will reduce the amount of boilerplate required to pass the configuration
values around (especially in a planned future change when logic is factored out
of ImaAdsLoader).

PiperOrigin-RevId: 337058355
2020-10-17 01:33:56 +01:00
kimvde
58ddfe046f Add SVC layer count to MP4 metadata
This is necessary to implement SEF video flattening.

PiperOrigin-RevId: 337048264
2020-10-17 01:33:47 +01:00
christosts
c4b346e49d Integrate playback speed control in ExoPlayerImplInternal
Issue: #4904
PiperOrigin-RevId: 337048010
2020-10-17 01:33:37 +01:00
christosts
f00584b02a Improve FakeClock and AutoAdvancingFakeClock
Issue: #4904
PiperOrigin-RevId: 337047518
2020-10-17 01:33:28 +01:00
christosts
41b58d503a Use low latency properties in DashMediaSource
Issue: #4904
PiperOrigin-RevId: 337046645
2020-10-17 01:33:19 +01:00
kimvde
6f66e7d0ba Small fix in IndexSeekMap
This change was meant to be in 2e5f2f12ad but
was not added my mistake.

PiperOrigin-RevId: 337041686
2020-10-17 01:33:09 +01:00
bachinger
bb7c934812 Add missing properties of MediaItem.Subtitle
Issue: #8044
PiperOrigin-RevId: 336955479
2020-10-17 01:32:59 +01:00
kim-vde
2e5f2f12ad Merge pull request #7378 from shenwill:dev-v2
PiperOrigin-RevId: 336875300
2020-10-13 16:30:01 +01:00
ibaker
d700627ec2 Move Robolectric-related test utils methods to robolectricutils module
This moves TestUtil#runMainLooperUntil and
TestUtil#createRobolectricConditionVariable to a new RobolectricUtil
class.

Also move testutil classes that use Robolectric-related utils classes
(e.g. TestPlayerRunHelper, TestDownloadManagerListener).

PiperOrigin-RevId: 336864959
2020-10-13 16:29:50 +01:00
samrobinson
9e1c6321ee Adjust static metadata logging to only list non-empty Metadata.
PiperOrigin-RevId: 336864814
2020-10-13 16:29:41 +01:00
christosts
8fdadade7b Add targetLiveOffsetUs parameter to LoadControl.shouldStartPlayback
This allows a LoadControl to start playback earlier if the target
live offset is very low.

Issue: #4904
PiperOrigin-RevId: 336863824
2020-10-13 16:29:31 +01:00
christosts
76b7f76437 Allow speed adjustments close to 1f in SonicAudioProcessor
Issue: #4904
PiperOrigin-RevId: 336841791
2020-10-13 16:29:22 +01:00
christosts
09598580f2 Allow to set live properties on DefaultMediaSourceFactory
Issue: #4904
PiperOrigin-RevId: 336841049
2020-10-13 16:29:13 +01:00
christosts
0756f304d6 Allow to configure custom LivePlaybackSpeedControl in player builders.
Use default implementation otherwise and forward chosen implementation to
internal player.

Issue: #4904
PiperOrigin-RevId: 336840530
2020-10-13 16:29:03 +01:00
christosts
867d27fa72 Add LivePlaybackSpeedControl interface and default implementation.
Issue: #4904
PiperOrigin-RevId: 336839908
2020-10-13 16:28:54 +01:00
christosts
13f1f3b3eb Add live configuration to MediaItem
Issue: #4904
PiperOrigin-RevId: 336839370
2020-10-13 16:28:44 +01:00
christosts
ed873322d3 Parse ServiceDescription from DASH manifest
Issue: #4904
PiperOrigin-RevId: 336838559
2020-10-13 16:28:35 +01:00
olly
d47258381f Remove reflection and call Surface.setFrameRate directly
PiperOrigin-RevId: 336838201
2020-10-13 16:28:26 +01:00
olly
5e1c96ad99 Fix a couple of StyledPlayerControlView bugs
1. The first time the player controls are are made visible,
   there is no animation.
2. The first time the player controls are made visible, the
   "select tracks" button isn't displayed. When tapping to
   subsequently hide the player controls, the button briefly
   becomes visible and then is hidden again. This bug is due
   to state in StyledPlayerControlViewLayoutManager being
   out of sync, resulting in StyledPlayerControlView's
   onVisibilityChange not being called properly.

After this change both of these issues should be resolved.

PiperOrigin-RevId: 336704031
2020-10-13 16:28:17 +01:00
andrewlewis
c21529def3 Update translations for UI module
This should fix gradle errors like: "warn: removing resource
com.google.android.exoplayer2.demo:string/exo_controls_fastforward_by_amount_description
without required default value."

PiperOrigin-RevId: 336670827
2020-10-13 16:28:08 +01:00
ibaker
506e9e951f Use MP4VTT MIME type in DashManifestParser (again)
We stopped using using this MIME type in
74a9d8f680

This broke subtitle decoding in some cases (Issue: #7985), which I
fixed in
7b8895d655.

After some discussion we've decided SubtitleDecoderFactory shouldn't
depend on Format.containerMimeType (since the samples have already been
extracted by this point, so the container shouldn't matter). So this
change fixes DashManifestParser to use MimeTypes.APPLICATION_MP4VTT (and
reverts the no-longer-needed SubtitleDecoderFactory change).

PiperOrigin-RevId: 336668450
2020-10-13 16:27:58 +01:00
ibaker
d2db0bb74a Ensure ParsableByteArray is large enough when appending in VorbisReader
PiperOrigin-RevId: 336643621
2020-10-13 16:27:48 +01:00
ibaker
ca3b420cf6 Split TestExoPlayer into Builder and RunHelper classes
TestExoPlayerBuilder can be used from both emulator and robolectric
tests, TestPlayerRunHelper uses Robolectric Looper behaviour, meaning
it can be moved to the robolectricutils module in a follow-up change.

PiperOrigin-RevId: 336634225
2020-10-13 16:27:39 +01:00
bachinger
cf2f9fd7b5 Fix flaky test case
PiperOrigin-RevId: 336558226
2020-10-13 16:27:29 +01:00
tonihei
94b8fab25e Remove deprecated MediaSource builder methods and constructors.
All these methods have been deprecated since at least 2.9.0.

PiperOrigin-RevId: 336320219
2020-10-13 16:27:20 +01:00
insun
850510ac68 Expand bottom button's height and extend greyed background area to seekbar
Adjusted the bottom layout of StyledPlayerControlView :
- Enlarged bottom button's height to make tapping easier.
- Extended greyed background area to upper edge of seekbar.
- Gave padding between bottom edge of the overall layout and bottom buttons.
- Reduced horizontal margins between bottom buttons.

PiperOrigin-RevId: 336041160
2020-10-13 16:27:10 +01:00
insun
7228b2d718 Show overflow button only when there is no enough space
Previously, the overflow button was always shown at the bottom in StyledPlayerControlView
and hided the settings cog even when there is enough space.

With this change, the settings cog moves out from overflow and
the overflow button is shown only when the buttom space is not enough.

PiperOrigin-RevId: 336029179
2020-10-13 16:27:00 +01:00
kimvde
c898e71908 Read until the track formats are available in TestUtil.extractSeekMap()
Otherwise, some extractor tests are seeking without making sure that the
extractor has retrieved the formats.

This is needed for PR Issue: #7378.

PiperOrigin-RevId: 335934326
2020-10-13 16:26:51 +01:00
bachinger
0a9b11d3dd Make resetPosition reset the position if true
Issue: #8024
PiperOrigin-RevId: 335846035
2020-10-13 16:26:41 +01:00
aquilescanta
64d5be8719 Fix HLS chunkful preparation bug affecting certain master playlists
The bug affects playlists that start with an I-FRAME only variant.

Issue: #8025
PiperOrigin-RevId: 335819497
2020-10-13 16:26:32 +01:00
andrewlewis
9753c3fcfb Add back copybara stripping
PiperOrigin-RevId: 335683390
2020-10-06 19:49:15 +01:00
tonihei
ed163db1c1 Enable detach surface timeout by default.
Experiments showed the timeout is beneficial to avoid ANRs and
we can thus enable the feature by default.

Also add configuration to set the timeout if required.

Issue: #5887
PiperOrigin-RevId: 335652506
2020-10-06 16:57:43 +00:00
andrewlewis
ac782235ca Fix miscellaneous nits/typos
PiperOrigin-RevId: 335642909
2020-10-06 16:57:31 +00:00
tonihei
008c80812b Enable release timeout by default and make config non-experimental.
Using a timeout prevents ANRs in cases where the underlying platform
gets blocked forever, so we enable this feature by default.

Issue: #4352
PiperOrigin-RevId: 335642485
2020-10-06 16:57:19 +00:00
kimvde
53f50f7c0e Ignore negative payload size in TS PesReader
Issue: #8005
PiperOrigin-RevId: 335625992
2020-10-06 14:31:59 +01:00
andrewlewis
39277ebe95 Pass ad tags via AdsMediaSource
This is in preparation for supporting playlists of ads media sources using
ImaAdsLoader.

Existing ways of passing ad tags should still function but are deprecated (and
won't be supported with playlists).

Issue: #3750
PiperOrigin-RevId: 335618364
2020-10-06 14:31:50 +01:00
kimvde
6ed371aaf3 Add search bytes parameter to TsExtractor
Context: Issue: #7988
PiperOrigin-RevId: 335608610
2020-10-06 14:31:41 +01:00
samrobinson
a552e35f6a Add getter and callbacks for static metadata retrieval.
Issue:#7266
PiperOrigin-RevId: 335416280
2020-10-06 14:31:32 +01:00
andrewlewis
41192ee046 Allow apps to add a VideoAdPlayerCallback
Issue: #7944
PiperOrigin-RevId: 335012643
2020-10-06 14:31:23 +01:00
bachinger
067712f599 Fix flaky test
PiperOrigin-RevId: 334801561
2020-10-06 14:31:14 +01:00
ibaker
43fe38672c Bump compileSdkVersion to 30
Without this, depending on Robolectric 4.5 causes compilation failures.

PiperOrigin-RevId: 334795155
2020-10-06 14:31:05 +01:00
andrewlewis
3e8dacc284 Move DataSource reading methods into Util
This will be used to read ads responses out of data: URLs in a subsequent
change.

PiperOrigin-RevId: 334778780
2020-10-06 14:30:56 +01:00
ibaker
907e2e0515 Tweak null-checking in TextRenderer#getNextEventTime()
`subtitle` is only guaranteed to be non-null if
`nextSubtitleEventIndex != C.INDEX_UNSET`. The null check added in
0efec5f6c1
was too early.

Issue: #8017
PiperOrigin-RevId: 334777742
2020-10-06 14:30:47 +01:00
ibaker
990051f5c5 Merge 2 UI sections in dev-v2 part of release notes
PiperOrigin-RevId: 334771927
2020-10-06 14:30:38 +01:00
ibaker
7b8895d655 Use Mp4WebvttDecoder for WebVTT content in DASH MP4 containers
This was broken by 74a9d8f680
because DashManifestParser switched to setting Format.sampleMimeType to
text/vtt while SubtitleDecoderFactory was still expecting
application/x-mp4-vtt. This change teaches SubtitleDecoderFactory to
check both Format.containerMimeType and Format.sampleMimeType.

I'll investigate a follow-up change to remove
MimeTypes.APPLICATION_MP4VTT completely (it's currently still used in
AtomParsers).

Issue: #7985
PiperOrigin-RevId: 334771672
2020-10-06 14:30:29 +01:00
claincly
4d3a781ca4 End to end playback test for gapless playback
In the test, a real instance of SimpleExoplayer plays two identical Mp3 files.
The GaplessMp3Decoder will write randomized data to decoder output on receiving
input. The test compares the bytes written by the decoder with the bytes
received by the AudioTrack, to verify that the trimming of encoder delay/
padding is correctly carried out.

Test mp3 has delay 576 frames and padding 1404 frames. File generated from:
ffmpeg -f lavfi -i "sine=frequency=1000:duration=1" test.mp3

This change needs robolectric version 4.5, which is not currently released (2020 Sep 30).

PiperOrigin-RevId: 334648486
2020-10-06 14:30:19 +01:00
ibaker
8cee5c5f6b Create a robolectricutils module
This holds shared test infrastructure that needs to depend on
Robolectric.

PiperOrigin-RevId: 334604041
2020-10-06 14:30:10 +01:00
ibaker
ae0d9b1359 Preserve limit when resetting ParsableByteArray in OggPacket#populate
When I moved ParsableByteArray#data behind a getter I replaced some
assignments with calls to reset(byte[]):
ce2e6e2fd6

reset(byte[]) deliberately sets `limit` to `data.length`, in order to
handle cases that were reassigning `data` but not updating `limit`.
However OggPacket was already using `limit` to track where to write
'new' data into the array, so changing `limit` to `data.length` caused
us to try and write new data beyond the end of the array.

I looked at other uses of reset(byte[]) in ce2e6e2fd6
and condluded the only other usage in MatroskaExtractor is legit and
shouldn't be updated like this (because MatroskaExtractor previously
*wasn't* correctly updating/maintaining `limit`).

Issue: #7992
PiperOrigin-RevId: 334601586
2020-10-06 14:30:01 +01:00