9841 Commits

Author SHA1 Message Date
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
christosts
a0d99a6ac8 Fix flaky unit tests
PiperOrigin-RevId: 334580007
2020-10-06 14:29:52 +01:00
andrewlewis
c35787a08f Add ImaUtil for IMA extension utilities
PiperOrigin-RevId: 334567234
2020-09-30 11:55:52 +01:00
andrewlewis
8728706c6e Use Builder in ImaAdsLoader constructor
PiperOrigin-RevId: 334562209
2020-09-30 11:55:44 +01: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
samrobinson
c95e43d9bd Do not require subtitleButton in custom layouts of StyledPlayerView
Every other subtitleButton has an if not null check, but does not force non null.

Issue: #7962
PiperOrigin-RevId: 334124323
2020-09-30 11:55:18 +01:00
andrewlewis
151a3d3bf5 Fix position reporting with fetch errors
On receiving a fetch error for an ad that would otherwise play based on an
initial/seek position, the pending content position wasn't cleared which meant
that position reporting was broken after a fetch error. Fix this by always
clearing the pending position (if there was a pending position that will have
triggered the fetch error).

Also deduplicate the code for handling empty ad groups (fetch errors)
and ad group load errors.

Issue: #7956
PiperOrigin-RevId: 334113131
2020-09-30 11:55:09 +01:00
Oliver Woodman
19a0258bac Merge pull request #7798 from yoobi:trackSelectionView
PiperOrigin-RevId: 333751261
2020-09-25 17:49:12 +01:00
kimvde
908785b701 Parse TLEN duration in Mp3Extractor
Issue: #7949
PiperOrigin-RevId: 333733615
2020-09-25 16:34:46 +01:00
bachinger
ea57e5d28b Always pass true for ongoing with the first notification
ISSUE: #7977
PiperOrigin-RevId: 333726625
2020-09-25 16:34:37 +01:00
bachinger
d1416aeb98 Align live window to available DASH segments
PiperOrigin-RevId: 333720336
2020-09-25 16:34:28 +01:00
bachinger
c107017a4b Ensure implicit manifest updates arrives asap
PiperOrigin-RevId: 333714978
2020-09-25 16:34:19 +01:00
christosts
397fe8f305 Bring back setRenderTimeLimitMs
PiperOrigin-RevId: 333712782
2020-09-25 16:34:10 +01:00
christosts
9b39268e0b Mark DataSpec with FLAG_MIGHT_NOT_USE_FULL_NETWORK_SPEED
Set the FLAG_MIGHT_NOT_USE_FULL_NETWORK_SPEED on live load DataSpecs
for segments that are not yet fully available.

PiperOrigin-RevId: 333712684
2020-09-25 16:34:01 +01:00
samrobinson
851ca20cc0 Add support for mp2 boxes.
Issue: #7967
PiperOrigin-RevId: 333709003
2020-09-25 16:33:52 +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
krocard
aa7309cdea Release wakelock when sleeping for offload
#exo-offload

PiperOrigin-RevId: 333512383
2020-09-25 16:32:55 +01:00
krocard
d97af76280 Retry after offload playback failure
Do that by adding a recoverable state to
the ExoPlaybackException marking when
it is needed to recreate the renderers.

PiperOrigin-RevId: 333507849
2020-09-25 16:32:46 +01:00
christosts
cf30ee504e Util.getStringForTime() prefixes negative times
Fix bug to place the negative sign in the beginning
of the returned String.

PiperOrigin-RevId: 333504868
2020-09-25 16:32:37 +01:00
christosts
3b14b05d93 Remove MediaCodecOperationMode
Remove MediaCodecOperationMode and replace it with a boolean
flag to enable/disable asynchronous queueing.

PiperOrigin-RevId: 333504817
2020-09-25 16:32:28 +01:00
krocard
dd99d23621 Remove unnecessary AudioTrack alias
Those aliases were introduced when the class
was also called AudioTrack.

PiperOrigin-RevId: 333499360
2020-09-25 16:32:18 +01:00
krocard
f37d79a4dd Callback when sleeping for offload and existing from it
#exo-offload

PiperOrigin-RevId: 333497538
2020-09-25 16:32:09 +01:00
tonihei
294ae10ef1 Change default of throwsWhenUsingWrongThread to true
Apps can still opt out for now, but this option will be removed in
the future.

Issue: #4463
PiperOrigin-RevId: 333489424
2020-09-25 16:32:00 +01:00
kim-vde
a92ccb0184 Merge pull request #7968 from DolbyLaboratories:dev-v2-channelConfiguration
PiperOrigin-RevId: 333485323
2020-09-25 16:31:49 +01:00
tonihei
66636f9ec0 Switch SntpClient to time.android.com and allow to set host.
PiperOrigin-RevId: 333480727
2020-09-25 16:31:38 +01:00
krocard
3be2463a94 Fix offload buffer full detection after setEndOfStream
This issue has been observed on a test app stress
testing setEndOfStream.

The issue has not been observed on ExoPlayer,
probably due to timing differences, but it is fixed
preventively.

#exo-offload

PiperOrigin-RevId: 333472136
2020-09-25 16:31:29 +01:00
ibaker
c76bc43de6 Delete sample_cbs.adts test asset
This seems to be an exact copy of sample.adts. Update the test to use
the same sample but just output to a different dump file.

PiperOrigin-RevId: 333469714
2020-09-25 16:31:20 +01:00
ibaker
d3639a2b20 Add Japanese subtitle examples to the demo app
These are from https://medium.com/google-exoplayer/improved-japanese-subtitle-support-7598fee12cf4

PiperOrigin-RevId: 333296789
2020-09-25 16:31:11 +01:00
andrewlewis
69ca49f939 Add support for 'mett' sample description
PiperOrigin-RevId: 333272292
2020-09-25 16:31:02 +01:00
tonihei
7b51797d4b Add availabilityTimeOffset to last available segment calculation.
This allows the player to load the unfinished segment of a low-latency
DASH stream.

PiperOrigin-RevId: 333077153
2020-09-25 16:30:52 +01:00
tonihei
4c6c1a130f Tweak shrinking guide and update release notes.
The shrinking didn't mention that users of the existing
ProgressiveMediaSource need to pass in ExtractorsFactory.EMPTY to the
SimpleExoPlayer.Builder as well.

Also updated the release notes to mention the changed shrinking
guidance.

Issue: #7937
PiperOrigin-RevId: 333060452
2020-09-25 16:30:43 +01:00
andrewlewis
a196fb0778 Remove unused MP4 atom type
PiperOrigin-RevId: 333051018
2020-09-25 16:30:34 +01:00
tonihei
25e31743d3 Don't require the existence of the next period to wait for its stream.
We have a workaround for uneven sample stream durarions in playlists that
assumes a renderer allows playback if it's reading ahead or waiting for
the next stream.

652c2f9c18 changed this logic to no longer require to
wait until the next stream is prepared due to a change in how we advance
media periods in the queue. However, the code falsely still requires the
next stream to exist (even if it's not prepared). This can cause a stuck
buffering state when the difference in the duration of the streams is more
than what we buffer ahead because we never create the next stream in such
a case.

Note: DefaultMediaClock.shouldUseStandaloneClock has roughly the same logic
and also doesn't require the next stream to be present.

Also fix a test that seemed to rely on this stuck buffering case to test
stuck buffering detection. Changed the test to not read the end of stream
to ensure it runs into the desired stuck buffering case.

Issue:#7943
PiperOrigin-RevId: 333050285
2020-09-25 16:30:25 +01:00
tonihei
12e887438b Add available segment logic to SegmentIndex
This allows to use the same logic from multiple places without duplicating
it, encapsulates in its logical place, and allows to change the available
segments based on the new availabilityTimeOffset value.

The overall effect of this change is a no-op.

PiperOrigin-RevId: 333044186
2020-09-25 16:30:15 +01:00
kim-vde
fb4b705cfe Merge pull request #7950 from friederbluemle:update-gradle-plugin
PiperOrigin-RevId: 333036751
2020-09-25 16:30:04 +01:00
ibaker
32194def67 Exclude PC devices from H.265 GTS tests
PiperOrigin-RevId: 333031399
2020-09-25 16:29:53 +01:00
tonihei
ebfeb2f77a Guava-ify f2c51560c2
PiperOrigin-RevId: 333031301
2020-09-25 16:29:44 +01:00
tonihei
f2c51560c2 Don't assume FakeSampleStream is ended without end of stream signal
PiperOrigin-RevId: 333029935
2020-09-25 16:29:34 +01:00