531 Commits

Author SHA1 Message Date
olly
576ef82191 Remove explicit use of Robolectric PAUSED looper mode
It's now the default everywhere, so there's no need to specify it
explicitly.

PiperOrigin-RevId: 322153319
2020-07-24 10:41:00 +01:00
aquilescanta
ecc834d704 Make DrmSessionManager.getExoMediaCryptoType cover placeholder sessions
getExoMediaCryptoType will only return null for drmInitData == null and
track types for which placeholder sessions are not used. This change
will allow renderers to abstract themselves from format.drmInitData.

PiperOrigin-RevId: 322131219
2020-07-24 10:39:57 +01:00
christosts
b249480060 Offline: store MIME type and keySetId
Replace `type` with (optional) `mimeType` and add `keySetId` in
DownloadRequest. The DownloadHelper infers the downloading method (DASH,
HLS, SmoothStreaming or Progressive) from the content's MIME type and
URI.

PiperOrigin-RevId: 322117384
2020-07-24 10:39:30 +01:00
olly
21f5914e56 Re-add rawtypes suppression
PiperOrigin-RevId: 322008577
2020-07-24 10:38:35 +01:00
olly
a6640ae377 Stop merging methods through AnalyticsCollector/AnalyticsListener
PiperOrigin-RevId: 321595514
2020-07-24 10:37:59 +01:00
tonihei
3b26c218e1 Deduplicate clear playlist code for stop(true) calls.
The logic to clear the playlist is currently duplicated in various
reset methods so that calls to player.stop(true) can clear the playlist.

This can be deduplicated by clearing the playlist as a seperate
operation that reuses the existing code.

PiperOrigin-RevId: 321578759
2020-07-24 10:37:50 +01:00
ibaker
f55526f7bc Replace overrides of deprecated AnalyticsListener#onPlayerStateChanged
Also remove some duplicate logging from ExoHostedTest - EventLogger
logs the same info already.

PiperOrigin-RevId: 321366052
2020-07-24 10:35:42 +01:00
bachinger
e7b76354b9 Add Player.EventListener.onMediaItemTransition
PiperOrigin-RevId: 321218451
2020-07-24 10:34:57 +01:00
aquilescanta
e486dc602c Release Extractor resources in DASH
PiperOrigin-RevId: 321181453
2020-07-24 10:34:48 +01:00
ibaker
bf5e6c7862 Pass startPositionUs into Renderer.replaceStream
Plumb this down into BaseRenderer.onStreamChanged and use it when
deciding whether to render the first frame of a new period.

PiperOrigin-RevId: 321175627
2020-07-24 10:34:30 +01:00
ibaker
8ae04bcfee Migrate usages of deprecated Window#tag
PiperOrigin-RevId: 321169585
2020-07-24 10:34:03 +01:00
bachinger
d62688cfc0 Mask periodId and loadingPeriodId
This change masks playbackInfo.periodId and playbackInfo.loadingPeriodId for operations which change these periods (set/add/remove sources and seeks).

Because this masking is reflected in the playbackInfo object, player attributes can be retrieved without the maskingXyz variables in EPI. This has the advantage that the playbackInfo object always reflects the public state of the player even when operations are still pending. The maskingXyz variables in EPI are only required for the deprecated use case of an initial seek in an empty timeline.

PiperOrigin-RevId: 321160092
2020-07-24 10:33:18 +01:00
kimvde
92437f3a0f Remove some occurrences of dummy
Remove occurrences in comments and private fields.

ISSUE: #7565
PiperOrigin-RevId: 320948364
2020-07-13 17:00:21 +01:00
olly
21e56f571d Misc analysis fixes
PiperOrigin-RevId: 320921457
2020-07-13 14:04:29 +01:00
tonihei
ebb9569624 Rollback of 75eab31d79
*** Original commit ***

Rollback of 0943886cbd

*** Original commit ***

Use last queue format instead of previous decision to select new track

We currently use the save...

***

PiperOrigin-RevId: 320015109
2020-07-08 13:56:04 +01:00
tonihei
75eab31d79 Rollback of 0943886cbd
*** Original commit ***

Use last queue format instead of previous decision to select new track

We currently use the saved selectionIndex to base our new track
selection decision on. This index might be stale if the previous
selection didn't result in a queue update (e.g. when loading live
streams where the new chunk isn't available yet).

Fix this by using the format of the last chunk to make the new decision.

Issue: #7582

***

PiperOrigin-RevId: 319991676
2020-07-08 13:55:47 +01:00
ibaker
fa594489d9 Completely separate MediaSource & DrmSession EventDispatchers
PiperOrigin-RevId: 319989989
2020-07-08 13:55:38 +01:00
tonihei
0943886cbd Use last queue format instead of previous decision to select new track
We currently use the saved selectionIndex to base our new track
selection decision on. This index might be stale if the previous
selection didn't result in a queue update (e.g. when loading live
streams where the new chunk isn't available yet).

Fix this by using the format of the last chunk to make the new decision.

Issue: #7582
PiperOrigin-RevId: 319957980
2020-07-08 13:55:21 +01:00
kimvde
b30e2b961f Rename some white/blacklist occurrences in core library
ISSUE: #7565
PiperOrigin-RevId: 319734842
2020-07-06 16:43:36 +01:00
tonihei
08478d1163 Remove throws clause from Renderer.stop
We don't need the renderer immediately after stopping, so the
renderer should not throw a checked exception until it's used again.
This is inline with the not throwing from disable().

Also, none of the known implementation throw an exception at the moment
and all reasonable base classes omit the throws clause already.

PiperOrigin-RevId: 319503643
2020-07-03 15:31:41 +01:00
ibaker
752fe1b679 Allow FakeMediaSource to specify the FakeSampleStream data
PiperOrigin-RevId: 319420451
2020-07-03 09:03:15 +01:00
ibaker
316f8a88cd Keep DRM sessions alive for a while before fully releasing them
Issue: #7011
Issue: #6725
Issue: #7066

This also mitigates (but doesn't fix) Issue: #4133 because it
prevents a second key load after a short clear section.

PiperOrigin-RevId: 319184325
2020-07-03 09:01:29 +01:00
krocard
78825a41dc Store encodings in Format instead of just pcm encodings
Previously only pcm encoding were stored in Format,
this was an issue as for audio passthrough and offload
lots of code needs to pass complex format informations
(encoding, sample rate, channel count, gapless metadata)
but could not use Format and each function was taking
each as different parameter.

By allowing Format to contain any encoding, and not only
pcmEncoding, it allows to pass a Format everywhere in ExoPlayer
code that needs a Format.

This patch does not have any functional change. It is only an internal refactor.

PiperOrigin-RevId: 318789444
2020-06-29 13:33:09 +01:00
kimvde
8e09cf45c0 Fix bug unseekable FMP4
The seek start position was set to the first mdat but this box was
always skipped because the moof box was not read.

PiperOrigin-RevId: 318762126
2020-06-29 13:32:44 +01:00
krocard
e386b0b00a Automated g4 rollforward of commit ffa4ad0e77a24168430fb3ac4c2afd13b68a701a.
*** Reason for rollforward ***

Rollforward after making sure the handler is created,
and that a test is written preventing a
similar regression.

*** Original change description ***

Rollback of b6f5a263f7

*** Original commit ***

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 ***

PiperOrigin-RevId: 318274400
2020-06-26 11:23:19 +01:00
ibaker
d0309b3798 Add DefaultDrmSessionManagerTest
This uses a license server implemented using MockWebServer to test
DefaultDrmSessionManager and DefaultDrmSession.

PiperOrigin-RevId: 318086890
2020-06-26 11:14:05 +01:00
tonihei
4138e28d62 Move common gradle setup to a setting file.
This removes a lot of duplication from the module configuration,
avoids divergence, and makes sure that only the important differences
to the default are visible in each module file.

PiperOrigin-RevId: 318024823
2020-06-26 11:13:25 +01:00
tonihei
1836f1df36 Update Checkerframework.
The compat dependency is no longer maintained and we need to keep
it at its old version.

PiperOrigin-RevId: 317658349
2020-06-23 11:07:34 +01:00
tonihei
c5c4c87728 Restrict some Handler to current Looper only.
They currently fall back to the main Looper if the current thread
doesn't have a Looper. All the changed Handlers are guaranteed to
be created on a thread with a Looper (mostly the ExoPlayer playback
Looper) and thus can make this stricter assumption. This makes it
easier to reason about the code as there are no ambiguities as to which
thread the Handler is running on.

PiperOrigin-RevId: 317334503
2020-06-23 11:06:31 +01:00
tonihei
7d66865d20 Rollback of 63ae4cc54b
*** Original commit ***

Rollback of 6ae472243f

*** Original commit ***

PiperOrigin-RevId: 317331407
2020-06-23 11:06:22 +01:00
olly
63ae4cc54b Rollback of 6ae472243f
*** Original commit ***

Rename Util methods to clarify which Looper is used.

The method name didn't clarify that either the main or current
Looper is used.

***

PiperOrigin-RevId: 317283606
2020-06-23 11:05:56 +01:00
tonihei
6ae472243f Rename Util methods to clarify which Looper is used.
The method name didn't clarify that either the main or current
Looper is used.

PiperOrigin-RevId: 317276561
2020-06-23 11:05:46 +01:00
olly
ffa4ad0e77 Rollback of b6f5a263f7
*** Original commit ***

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...

***

PiperOrigin-RevId: 316914147
2020-06-17 22:20:48 +01:00
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
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
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
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
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
ibaker
032bb0498d Move FakeRenderer's DrmSession releasing from onReset() to onDisable()
This seems to match DecoderVideoRenderer more closely:
b1e56304a1/library/core/src/main/java/com/google/android/exoplayer2/video/DecoderVideoRenderer.java (L300)

Although MediaCodecRenderer does it in onReset() and then calls that
from onDisable():
b1e56304a1/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java (L754)

PiperOrigin-RevId: 315859212
2020-06-11 10:11:49 +01:00
Oliver Woodman
2fcd759edb Merge pull request #7479 from sravan1213:dev-v2
PiperOrigin-RevId: 315794031
2020-06-11 10:11:30 +01:00
sravan1213
c3282c9a37 Propagate download exception through onDownloadChanged callback 2020-06-08 18:51:54 +05:30
bachinger
60f907be6d Make FakeTimeline and FakeMediaSource provide a media item
FakeMediaSource and FakeTimeline should put a media item to the window just as other media sources and timelines do. This change provides a fake media item for both of them.

Further the MaskingMediaSource needs to provide a media item for when the real timeline of the masked media source is not available. This can be easily done by using mediaSource.getMediaItem() once available. For now a dummy is used to make ExoPlayerTest run green. This can be easily change to use mediaSource.getMediaSource as soon as this method is defined by the MediaSource interface.

PiperOrigin-RevId: 314897474
2020-06-05 13:05:48 +01:00
ibaker
9699889569 Assert that a negative extractor sniff never advances the read position
Extractor#sniff() javadoc says:
"If true is returned, the input's reading position may have been
modified. Otherwise, only its peek position may have been modified."
https://exoplayer.dev/doc/reference/com/google/android/exoplayer2/extractor/Extractor.html#sniff-com.google.android.exoplayer2.extractor.ExtractorInput-

PiperOrigin-RevId: 314296922
2020-06-02 23:51:33 +01:00
krocard
151ea531b1 Make constants more readable with _ separator
Add an `_` in long constants.
Eg: 10000 => 10_000.

I'm proposing this change because I have had multiple
missread due to confusing the number of 0 in a long number.

More specifically, added an underscore to all number matching:
`final.*\ [0-9]{2,}000;`

PiperOrigin-RevId: 313186920
2020-05-27 19:00:36 +01:00
tonihei
ee11d9d6fb Make manifest loads on timeline refresh optional in FakeMediaSource.
Every timeline refresh currently assumes that it corresponds to a manifest
refresh and issues the respective load events. However, there are other
timeline updates that don't have a manifest refresh (e.g. ad state updates)and thus shouldn't issue these events.

PiperOrigin-RevId: 313150489
2020-05-27 19:00:00 +01:00
ibaker
2397e7f67a Replace TestUtil.joinByteArrays() with Guava's Bytes.concat()
PiperOrigin-RevId: 312481058
2020-05-21 17:09:22 +01:00
ibaker
9c8cd4b575 Add DRM data to AnalyticsCollectorTest
This requires lots of new DRM plumbing in FakeMedia{Period,Source} and
FakeSampleStream.

Part of issue:#6765

PiperOrigin-RevId: 312072332
2020-05-18 16:14:36 +01:00
insun
c7f2df0fd9 Add Player#getTrackSelector()
PiperOrigin-RevId: 310242733
2020-05-14 22:17:51 +01:00
tonihei
2e81186a33 Add timeout to TestExoPlayer runUntil methods.
If the condition isn't fulfilled, they currently block until the
test runner times out the test. Our usual approach is to timeout
in the test itself so that the error message is clearly showing the
blocked condition.

Also clean-up some documentation.

PiperOrigin-RevId: 309930198
2020-05-05 18:38:41 +01:00
andrewlewis
c926acb36d Add missing @Player.State in action schedule
PiperOrigin-RevId: 309735092
2020-05-05 18:37:38 +01:00