3674 Commits

Author SHA1 Message Date
Oliver Woodman
f1c3928bc9 Merge pull request #7867 from GeneticGenesis:pc/update-expected-http-statuses-for-failover
PiperOrigin-RevId: 338051017
2020-10-20 14:52:14 +01:00
ibaker
7ea1201bc2 Add playback tests for existing MP4 assets
Skip assets with >2 audio channels - this isn't
currently supported by ShadowAudioSystem. I'll add these when support is
available.

Also skip sample_ac4_protected.mp4 because DRM isn't supported in this
test environment either.

PiperOrigin-RevId: 338023738
2020-10-20 14:51:50 +01:00
ibaker
57e884b671 Add support for AC-3, AC-4, E-AC-3 and E-AC-3-JOC to playback tests
I added the TS playback tests for these assets without adding support
for the relevant MIME types to ShadowMediaCodec.

Also remove test assets with more than 2 audio channels - this isn't
currently supported by ShadowAudioSystem. I'll re-add these when support
is available.

PiperOrigin-RevId: 338023290
2020-10-20 14:51:41 +01:00
krocard
f54f763db5 AudioSink: Remove comment about unconfirmed crash
Consensus is that the NoClassDefFoundError does not
causes a crash but only a warning.

PiperOrigin-RevId: 338022354
2020-10-20 14:51:32 +01:00
Oliver Woodman
2f3fdf7c5b Merge pull request #8030 from yqritc:add-output-surface-workaround
PiperOrigin-RevId: 338016707
2020-10-20 14:51:20 +01:00
tonihei
febf5d2031 Use ListenerSet in AnalyticsCollector.
This ensures recursively sent events arrive in the correct order.

Issue: #8048
PiperOrigin-RevId: 337812882
2020-10-20 14:50:50 +01:00
tonihei
68cbf6ddf3 Move listener handling to common util class.
ExoPlayerImpl and CastPlayer repeat the same logic. Moving the listener
and event handling to a common util class allows to reuse the same code
and add unit tests for this logic.

The change is a functional no-op.

PiperOrigin-RevId: 337812358
2020-10-20 14:50:30 +01:00
krocard
e589d7238a Add a getter for sleeping for offload
This allows wakelock releases to be state based
instead of transition based.

#exo-offload

PiperOrigin-RevId: 337286501
2020-10-17 01:35:20 +01:00
ibaker
d97dd8d5eb Add playback tests for existing FLAC assets
PiperOrigin-RevId: 337280116
2020-10-17 01:35:11 +01:00
ibaker
74ac915124 Add playback tests for existing MP3 assets
PiperOrigin-RevId: 337279583
2020-10-17 01:35:01 +01:00
krocard
230f4e5bb5 Do not inherit directly from AudioTrack.StreamEventCallback
This was causing issues old devices where the class
inheriting StreamEventCallback was loaded even though
it was not used.

Instead use an anonymous class that seem to be loaded
more lazily.

PiperOrigin-RevId: 337252687
2020-10-17 01:34:43 +01:00
krocard
bb851c99b9 Add MiTV devices requiring the output surface workaround
Issue: #8014
PiperOrigin-RevId: 337142176
2020-10-17 01:34:33 +01:00
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
christosts
c4b346e49d Integrate playback speed control in ExoPlayerImplInternal
Issue: #4904
PiperOrigin-RevId: 337048010
2020-10-17 01:33:37 +01:00
bachinger
bb7c934812 Add missing properties of MediaItem.Subtitle
Issue: #8044
PiperOrigin-RevId: 336955479
2020-10-17 01:32:59 +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
olly
d47258381f Remove reflection and call Surface.setFrameRate directly
PiperOrigin-RevId: 336838201
2020-10-13 16:28:26 +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
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
bachinger
0a9b11d3dd Make resetPosition reset the position if true
Issue: #8024
PiperOrigin-RevId: 335846035
2020-10-13 16:26:41 +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
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
samrobinson
a552e35f6a Add getter and callbacks for static metadata retrieval.
Issue:#7266
PiperOrigin-RevId: 335416280
2020-10-06 14:31:32 +01:00
bachinger
067712f599 Fix flaky test
PiperOrigin-RevId: 334801561
2020-10-06 14:31:14 +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
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
christosts
a0d99a6ac8 Fix flaky unit tests
PiperOrigin-RevId: 334580007
2020-10-06 14:29:52 +01:00
yqritc
eaff9d5105 apply setOutputSurface workaround for more devices 2020-10-02 14:27:13 +09:00
ibaker
88999da3be Add playback tests for more TS assets
PiperOrigin-RevId: 334549894
2020-09-30 11:55:35 +01:00
andrewlewis
6b13640eeb Fix position ramping behavior with AudioTrack speed params
Non-realtime AudioTrack playback speed was not taken into account when
extrapolating the old mode's position, causing the position not to
advance smoothly.

This should be a no-op when not using AudioTrack playback params for
speed adjustment.

Issue: #7982
PiperOrigin-RevId: 334151163
2020-09-30 11:55:27 +01:00
Phil Cluff
1a63f9e3d2 Update HTTP status codes expected in failover scenarios. 2020-09-28 18:27:26 +01:00
christosts
397fe8f305 Bring back setRenderTimeLimitMs
PiperOrigin-RevId: 333712782
2020-09-25 16:34:10 +01:00
christosts
0066586499 Remove SynchronousMediaCodecBufferEnqueuer
Remove the SynchronousMediaCodecBufferEnqueuer interface
since we only keep the AsynchronousMediaCodecBufferEnqueuer
implementation.

PiperOrigin-RevId: 333701115
2020-09-25 16:33:42 +01:00
krocard
7dfdde9246 Retry AudioTrack init and write before throwing
Retry AudioTrack init and write for 100ms before
giving up and aborting playback.

This was tested by throwing every 2 init/write and
making sure playback did not stopped.

#exo-offload

PiperOrigin-RevId: 333536841
2020-09-25 16:33:33 +01:00
krocard
56cb327f1e Clarify offload stream event callback impl
#exo-offload

PiperOrigin-RevId: 333532900
2020-09-25 16:33:23 +01:00
krocard
55a13d8871 Callback on audio track failure
Intended for statistics now that all errors
are not surfaced to the app.

PiperOrigin-RevId: 333519898
2020-09-25 16:33:14 +01:00
krocard
fad2846d1c Workaround AudioTrack incorrect error code
#exo-offload

PiperOrigin-RevId: 333513385
2020-09-25 16:33:05 +01:00