519 Commits

Author SHA1 Message Date
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
ibaker
b0a59a6b62 In-line one overload of assertOutput into assertAllBehaviours
Currently the assertOutput() overloads do quite different things.

Also stop returning FakeExtractorOutput from assertOutput (it's not
used).

PiperOrigin-RevId: 309030386
2020-05-01 19:47:48 +01:00
olly
a90f30a6cd TestDownloadManagerListener: Fix blockUntilIdle
PiperOrigin-RevId: 308985567
2020-05-01 19:46:39 +01:00
ibaker
922b8a2c15 Add option to FakeTrackOutput to de-duplicate repeated formats
Expose this through ExtractorAsserts via a new AssertionConfig object

PiperOrigin-RevId: 308980701
2020-05-01 19:46:30 +01:00
olly
8d450a9f9d Fix assertThat actual/expected order
PiperOrigin-RevId: 308844678
2020-05-01 19:45:38 +01:00
olly
2d494861ec Cleanup and document TestDownloadManagerListener
PiperOrigin-RevId: 308843488
2020-05-01 19:45:29 +01:00
olly
37d9e2f485 DownloadManagerTest: Improve thread interactions
- Remove assertReleased and replace it with a proper condition variable
  that's opened when Downloader.download or Download.remove finish. As
  far as I can tell assertReleased was basically implementing "sleep for
  10 seconds after the Downloader starts". Note fixing this properly
  also makes the tests run much faster!
- Use ConditionVariable instead of CountDownLatch(1).
- Use AtomicInteger instead of volatile int because it's clearer and
  allows removal of explanatory comments.

PiperOrigin-RevId: 308819204
2020-05-01 19:44:27 +01:00
olly
1c34029e87 ConditionVariable: Fix block(long) to correctly handle large timeouts
PiperOrigin-RevId: 308815613
2020-05-01 19:44:10 +01:00
olly
be07b3cad5 ConditionVariable: Improve documentation and allow clock injection
- Improve documentation explaining the benefits of ExoPlayer's ConditionVariable
  over the one that the platform provides
- Allow Clock injection
- Create TestUtil method for obtaining a ConditionVariable whose block(long)
  method times out correctly when used in a Robolectric test
- Add basic unit tests for ConditionVariable

PiperOrigin-RevId: 308812698
2020-05-01 19:44:01 +01:00
aquilescanta
b5112492be Add loadTaskId to LoadEventInfo
To be used by the LoadErrorHandlingPolicy.

PiperOrigin-RevId: 308657905
2020-05-01 19:43:34 +01:00
ibaker
9dac400734 Rename ExtractorAsserts "test everything" methods
This makes the distinction more clear between the methods that test
a specific behaviour (and are meant to be used with parameterized
tests) and those that test everything in one go.

Also add a TODO to FlacExtractorTest to migrate it when we can

PiperOrigin-RevId: 308228421
2020-04-27 10:41:49 +01:00
ibaker
0e6b318138 Remove ExtractorAsserts overloads that take a Context
Also mark the two assertOutput methods private, to make the API surface
smaller.

PiperOrigin-RevId: 308228186
2020-04-27 10:41:49 +01:00
aquilescanta
25f17acd21 Move LoadEventInfo creation to the caller
LoadEventInfo needs to also be sent to the LoadErrorHandlingPolicy.

PiperOrigin-RevId: 308066998
2020-04-27 10:41:33 +01:00