This replaces the deprecated usages of RobolectricTestRunner and
RuntimeEnvironent and fully migrates the tests to androidx.
PiperOrigin-RevId: 238011667
Without this change, any prepare() operation that requires posting to
the DummyMainThread's handler cannot complete preparation.
PiperOrigin-RevId: 233050367
Imported from GitHub PR https://github.com/google/ExoPlayer/pull/5462
Pull request for the following issue: #5421
Merge d9d88b079c4ca0533a836b2715a65b924babbb89 into a73819162751116acd3863cf5473b0ff78fac805
PiperOrigin-RevId: 232335113
The combination of pre-16 API levels accounting for ~0.5% of the device
population, and that the most important components in ExoPlayer (e.g.
the MediaCodec renderers) have always required API level 16, mean it's
very unlikely this will negatively impact on anyone.
PiperOrigin-RevId: 230701808
That's the same position set in MediaPeriod.prepare (where it may be removed
in the future).
Having the position at an earlier point is necessary to fix an
issue with lazy preparation in ConcatenatingMediaSource where the prepare
position was assumed to be known but MediaPeriod.prepare hasn't been called
yet.
Issue:#5350
PiperOrigin-RevId: 229756637
They are not longer needed anywhere, are error-prone (because of threading
requirements), and complicate testing and using MediaSources without a player.
PiperOrigin-RevId: 227871157
We currently fail the entire playback tests if we exceed a start timeout
or the test gets stopped forcefully. This is problematic as the start timeout
may happen from time to time for the ABR tests and we'd still like to have the
remaining playbacks.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=222406639
Some test specific things, like adding an extra listener or adding decoder
counters are currently handled by ExoHostedTest. They can be moved to the
classes actually using them to clean up ExoHostedTest.
This also adds more flexibility to further generic clean-up in onTestFinished.
Also, reorder player setup to what ExoPlayerTestRunner is doing.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=219446276
1. Remove option to pass null context to Util.getNetworkType. IMO it's
clearer for the caller to just not call the method in this case.
2. Stop using deprecated DefaultBandwidthMeter.Builder constructor in
all but one place.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=217147091
For decoder reuse, we want disable() to flush the decoder. However,
if the flush needs to release the decoder for some reason, it seems
non-ideal to immediately re-initialize it. Re-initialization can
also throw ExoPlaybackException, which we don't want for disabling.
This change allows a variant of flush that wont re-initialize the
decoder if it has to be released, which will be used from disable().
Issue: #2826
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=216834862
If we prepare a deferred media period before the actual timeline is available,
we either prepare with position zero (= the default) or with a non-zero
initial seek position.
So far, the zero (default) position got replaced by the actual default position
(including any potential non-zero window offset) when the timeline became known.
However, a non-zero initial seek position was not corrected by the non-zero
window offset. This is fixed by this change.
Related to that, we always assumed that the deferred media period will the
first period in the actual timeline. This is not true if we prepare with an
offset (either because of an initial seek position or because of a default
window position). So, we also determine the actual first period when the
timeline becomes known.
Issue:#4873
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=215213030
Currently there is no way to disable (or reduce) the logcat output generated
by ExoPlayer.
Issue:#4665
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=213421072
Not having this annotation may cause Kotlin implementations to fail.
Issue:#4802
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=212980643
- This makes it so that onDownstreamFormatChanged will occur before the corresponding
renderer event. This was not previously the case, since the renderer would typically
read the format (and report its event), then a sample (causing the
onDownstreamFormatChanged event).
- The remaining ones to update are ChunkSampleStream (DASH + HLS), which will be done
in a way that fixes#4533, and HLS.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=212434874
The default character set is always UTF-8 anyway on Android, but
we don't want our code to behave any differently where it's not
(e.g. robolectric test runs could potentially run in an environment
where UTF-8 isn't the default?).
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=211953885
This provides the list of currently buffered media chunks and iterators over
the potential next chunks to the track selection. Having these two parameters
enables more advanced decision logic based on this data.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=210551812
- Add @Deprecated on overrides of deprecated method.
- Suppress deprecation warnings where appropriate.
- Use non-deprecated alternatives where appropriate.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=210092434
The response headers of the last load are available from the loading source
when creating media source events and can be easily forwarded.
Issue:#4361
Issue:#4615
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=209900693
Some tests were flaky because of the PlayUntilPosition action which called
player.setPlayWhenReady from the wrong thread. Also fixed some other misc
flakiness.
ExoPlayerTest seems to be non-flaky now (tested with 10000 runs).
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=209743076
The MediaPeriodId with index is only properly defined together with a
timeline containing the index. Changing it to the period uid allows to use
the MediaPeriodId independent of the corresponding timeline.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=209430257
This CL adds support for seeking witin TS streams by using binary search. For
any seek timestamp, it tries to find the location in the stream where PCR
timestamp is close to the target timestamp, and return this position as the
seek position.
Github: #966.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=207529906
- Use ConstantBitrateSeeker to implement seeking for ADTS format. Since most
ADTS streams are VBR, we use the average bitrate of the first 1000 frames as
the average bit rate.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=207509651
This is needed for implementing (optional) support for audio focus handling in a
later change.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=206899837
All known instances use DataSource as generic type and thus code can be simplified
by removing the generic type altogether.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=205798542
This removes the need to populate the entire period for the common usage of
getting the uid from the period.
Also add default implementation to get period by uid.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=205638265
This bandwidth meter is then forwarded to the track selection and as a transfer
listener to media and data sources.
When no bandwidth meter is specified in the ExoPlayerFactory methods, a static
singleton instance will be used.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=204881497
There are only two types at the moment and we can therefore use a boolean.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=203937357