This change fixes various issues:
- MobileHarness sometimes allocated devices with SDK < 16. As we have no tests running
on these SDKs, a new dimension filter for the mobile_test target ensures that only
devices with SDK >= 16 are selected. A similar filter for SDK version is also added
to the ABR playback tests to ensure no old devices are selected.
- DRM specific tests are skipped for Api < 18, but were not able to run because the
DashTestRunner class tried to link to the MediaDrm constructor. Moved the
constructor to a seperate Builder class to allow execution on Api levels 16 and 17.
- DashWidevineOfflineTest also tried to access code for Api >= 18 without checking
the current level.
- Action implementations which are waiting for events did not ensure that they have a
nextAction to wait for. This caused NullPointerExceptions when this next action was
scheduled.
- DefaultDrmSession always restored the offline keys when a new license was requested,
even if the keys were already restored. These repeated slow calls to restoreKeys
resulted in high numbers of dropped buffers.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171974859
Calling HandlerThread.quit() or .quitSafely() doesn't immediately terminate
the thread. It just instructs the Looper not to accept any new messages and
to terminate at the next opportunity. Added a HandlerThread.join() everywhere
where the intention is to close and release all resources and to stop all
threads.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171525241
Now this counter includes input buffers too, which are dropped as part of
skipping to keyframes for catch up.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171119930
This allows more deterministic action schedules, especially for real media
which may take an arbitrary amount of time to rebuffer after seeking.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171005231
If the current output buffer is very late and the playback position is in a
later group of pictures, drop all buffers to the keyframe preceding the
playback position.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170975259
Run next action immediately without using the handler when the requested
delay is zero. This ensures that no other code can run between these two
actions to improve deterministic test behaviour.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170456852
This change allows applications to provide custom AudioSinks, which could be
based on android.media.AudioTrack like AudioTrackAudioSink, or could be
completely custom.
The refactoring is mostly mechanical and shouldn't result in any functionality
changes.
Some android.media.AudioTrack-specific details have to appear in the AudioSink
interface so this change modifies the javadoc on the AudioTrack (now AudioSink)
to note that some methods will have no effect.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170311083
This allows simplified listener implementations as most listeners
will not listen to all possible notifications.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170177821
By default, if a codec is instantiated during an ongoing
playback, ExoPlayer will render the first frame that it
receives (so that there's "something other than black"
drawn to the surface). This frame is the key-frame before
the current playback position, and may be as much as 5
seconds behind the current position. ExoPlayer then drops
subsequent frames that are late until it's caught up to
the current position again.
For GTS tests that are counting dropped frames, this is
not desirable behavior, since it will cause spurious test
failures in cases where DummySurface is not supported.
This change overrides the default behavior so that the
player instead skips (rather than drops) frames until it's
caught up to the current playback position, and only then
renders the first frame.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170175944
This allows test runs to continue when the activity
is paused (but not stopped), which is in line with
what we do in the demo app's PlayerActivity.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168699521
This allows listeners to easily determine the source of the discontinuity.
Reasons can be period transitions, seeks, and internal reasons.
Listeners still using the deprecated ExoPlayer.EventListener interface were
updated to Player.EventListener.
GitHub: #3252
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168549612
In live streaming, if the playback position is very close to live edge,
the buffered duration will never reach minDurationForQualityIncreaseMs,
which prevents switching from ever happening. So we will provide the
durationToLiveEdgeUs to AdaptiveTrackSelection in live streaming case,
so it can handle this edge case.
GitHub: #3017
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168535969
The sleep used to simulate data load times is ignoring InterruptedExceptions.
(This is intended and in line with SystemClock.sleep()). However, when a
Loader cancels an ongoing load, it uses interrupts. To be able to catch these
and to immediately return from the reading data source, a handler callback
is used instead of the sleep() method which allows interuptable waiting.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168212652
When having a repeat() action and another subsequent action,
the next action should only be scheduled once (and not repeatedly).
Thus, the "next" pointer in the repeated action needs to be nulled
in the first iteration to prevent repeated scheduling of the next action.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168202212
Releasing the media period should also release the sample streams
to allow resources to be cleaned up.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168201377
This simulates reading from the buffer (which is what actual
renderers would do). Otherwise the buffer always gets expanded
and might cause memory issues.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167994899
In this case the playback state transitions to IDLE, which isn't
caught so far. (This code is equivalent to the one in ExoHostedTest.java)
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167980981
Remaining instrumentation tests either use android.os.Handler or rely on assets.
In the latter case, the tests are difficult to migrate due to differences
between the internal and external build systems, and configuration needed in
Android Studio. In addition, SimpleCacheSpanTest remains as an instrumentation
test because it fails due to a problem with string encoding on the internal
build (and two other tests in its package are kept with it because they depend
on it).
This test removes a dependency from testutils on Mockito, as a different
version of Mockito needs to be used for instrumentation tests vs Robolectric
tests, yet both sets of tests need to rely on testutils. Mockito setup is now
done directly in the tests that need it.
Move OggTestData to testutils so it can be used from both instrumentation and
Robolectric tests.
It may be possible to simplify assertions further using Truth but this is left
for possible later changes.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167831435
This allows to use a fake clock and an action schedule with timed delays
together.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167582860
The default implementation is just calling through to handler.postDelayed,
while the fake clock uses its internal time value to trigger the handler
calls at the correct time.
This is useful to apply a fake clock in situations where a handler is used to
post delayed messages.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167567914
In order to retrieve the data set, the track selection index was used, but
the data set is actually indexed by track group indices.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167566049
The bytesRemaining didn't always take into account any skipped bytes, which
meant that reaching the end of the file was not correctly detected in read().
Issue: #3216
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167016672
Both cases were not supported so far. Added tests which all failed in the
previous code version and adapted the concatenated media sources to cope with
empty timelines and empty concatenations.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166480344
findViewById is now defined using generics, which allows
the types to be inferred.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166355555
When hosted tests run into a timeout, the outer test method stops.
However, the hosted test itself may continue running and needs to be
forced-stopped to ensure it does not block any resources needed by
subsequent test methods.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166208204
This is mostly connecting the already stored shuffleMode with the timeline queries
for the playback order.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166199330
This just implements a reverse order which is different from the original order but
still deterministic for simplified testing.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166194311
This functionality is most likely needed by UI modules which currently need
to obtain the timeline, the current repeat and shuffle modes and are only then
able to query the next/previous window index using this information.
Adding these methods simplifies these cumbersome requests.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166181202
This allows to test the expected behaviour of timeline with different shuffle modes.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166181091
This parameter is used by methods such as getNextWindowIndex
and getPreviousWindowIndex to determine the playback order.
Additionally, there are method to query the first and last
window index given the shuffle mode.
None of the timeline implementations nor the ExoPlayer
implementation supports shuffling so far.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166170229
And implement a basic version of the methods in all implementations.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166041342
There will be non-ExoPlayer players that can output text
and metadata, so the outputs should be standalone. There
may also be ExoPlayer instances that use non-standard
text and metadata renderers, for which this change also
makes sense.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=165628420
- HlsDownloader.loadManifest (previously called getHlsPlaylist)
suppressed errors for the offline case, where-as the DashUtil
equivalent method did not. This change makes them consistent
and moves both other to use ParsingLoadable.
- Enable GZIP for manifest loads in both cases.
- Use Uri rather than String to represent Uris. Previously the
strings were parsed into Uris quite deep in the code, which
isn't ideal if the parsing fails; you'd probably prefer the
error to occur early at the top level.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=165181398
This implementation runs as fast as possible by triggering a simplified
playback loop continuously without waiting. The class only supports a basic
use case with a single-period timeline, no timeline update, no seeks or other
user-initiated actions.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=164120420
- Fix Ogg extractor to work without sniffing.
- Fix extractors to handle seek() before init().
- Add tests for both issues.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=163992343
This change clearly seperates the hosting of a test (HostActivity) from
the internals of hosting an ExoPlayer lifecycle (ExoHostedTest).
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=163967960
This was a bug as the data set should contain sample data for all available
tracks. Also added a unit test.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=163806579
The canStop method gets called every second in a seperate thread until the
test can be stopped. Replacing it with blockUntilEnded forwards the
responsibility to stop to the test itself which has better control over the
stop condition.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=163343824
Currently the ExoPlayerWrapper is used to run tests using an ExoPlayer
implementation. Some properties of the test are set in the constructor, some
are set by overloading the class, others are hard-coded in the
ExoPlayerWrapper class, and a mechanism similar to the existing ActionSchedule
is missing.
This change does the following:
1. Renames ExoPlayerWrapper to ExoPlayerTestRunner as it better reflects
its purpose.
2. Adds an internal Builder to easily set-up the test in a coherent way. This
allows to only set necessary test components while using defaults for the rest.
3. Integrate ActionSchedule.
4. Apply the new structure to the existing tests currently using ExoPlayerWrapper.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=163186578
The new actions are: prepare source, set repeat mode, wait for timeline
change, wait for position discontinuity, execute Runnable.
Moreover, this change removes the restriction of using a SimpleExoPlayer to
allow ActionSchedule to be used in other scenarios.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162918554
This class extends the existing FakeMediaSource by creating a
FakeAdaptiveMediaPeriod instead of a FakeMediaPeriod.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162918487
This class extends the existing FakeMediaPeriod by using a ChunkSampleStream
with chunks from a FakeChunkSource instead of a FakeSampleStream.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162916656