291 Commits

Author SHA1 Message Date
olly
6907ffb285 Remove unnecessary view casts
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
2017-08-29 22:57:17 +01:00
tonihei
aa712114c6 Force stop hosted test after timeout.
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
2017-08-29 22:52:10 +01:00
tonihei
eeebb3968b Implement shuffle mode logic in ExoPlayerImplInternal.
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
2017-08-29 22:50:49 +01:00
tonihei
b27c25e880 Add fake shuffle order.
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
2017-08-29 22:44:13 +01:00
tonihei
bd81181892 Add shortcut methods to query next or previous window index.
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
2017-08-29 22:40:13 +01:00
tonihei
2c8d5f846e Pass shuffle mode to timeline assertion helper methods.
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
2017-08-29 22:38:50 +01:00
tonihei
10f1bd7396 Add shuffle mode parameter to Timeline interface methods.
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
2017-08-29 22:37:27 +01:00
tonihei
b9a6a40539 Add listener callback for shuffle mode changes.
The listener implementations do not do anything yet.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166056933
2017-08-22 16:23:27 +01:00
tonihei
c1d7e5bf9d Add set/getShuffleModeEnabled to Player interface.
And implement a basic version of the methods in all implementations.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166041342
2017-08-22 16:19:25 +01:00
olly
2470b39d95 Split metadata and text outputs from their renderer classes
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
2017-08-17 23:05:44 +01:00
olly
cf6534ea5b SegmentDownloader loadManifest cleanup.
- 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
2017-08-17 22:32:57 +01:00
olly
40f34956a8 Bump minimum and target API levels + support lib version
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=164863447
2017-08-11 15:01:43 +01:00
tonihei
ccd05cbd04 Add fake simple exo player.
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
2017-08-04 12:29:40 +01:00
olly
412138b2ea Some extractor fixes
- 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
2017-08-02 17:44:41 +01:00
tonihei
22ea9ed687 Clean-up ExoHostedTest/HostActivity.
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
2017-08-02 17:42:11 +01:00
tonihei
1151104e2f Use TrackGroup instead of TrackSelection in FakeAdaptiveDataSet.
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
2017-08-01 16:23:39 +01:00
olly
c2d7e05429 Propagate skipped input buffers through to CodecCounters
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=163683081
2017-07-31 21:14:23 +01:00
tonihei
5bd5af8c60 Replace canStop with blockUntilEnded in HostedActiviy.
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
2017-07-31 21:06:11 +01:00
tonihei
ad5ca0812d Add unit test for FakeDataSource.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=163341994
2017-07-31 21:03:36 +01:00
tonihei
b631755b63 Clean up test runner for ExoPlayer tests.
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
2017-07-31 20:54:18 +01:00
tonihei
3991a6198b Extend ActionSchedule with new actions.
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
2017-07-31 20:46:35 +01:00
tonihei
0411add91e Add fake adaptive media source.
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
2017-07-31 20:45:08 +01:00
tonihei
1bc01c09ee Add fake adaptive media period.
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
2017-07-31 20:43:51 +01:00
andrewlewis
554a399407 Switch to non-deprecated player constants
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162605429
2017-07-21 11:20:07 +01:00
tonihei
b950a5e874 Add fake chunk source.
This chunk source retuns SimpleSampleMediaChunks based on the data definition
of a FakeAdaptiveDataSet.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162351688
2017-07-19 14:11:51 +01:00
tonihei
0717c3502f Extend Clock interface with sleep method and add FakeClock.
The FakeClock allows to simulate timing behaviour including sleep time
for test cases.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162345258
2017-07-19 14:06:18 +01:00
tonihei
958f12e2cc Make isReady of FakeRenderer more realistic.
Currently the renderer is only ready when the input stream has more data to
read. Actual renderers, however, are also ready as long as their output buffer
contains some audio/video samples to play, roughly corresponding to the fact
that the playback time hasn't reached the timestamp of the last buffered
sample. Added a isready flag to FakeRenderer to simulate this behaviour.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162343074
2017-07-19 14:04:58 +01:00
tonihei
1d046d5da8 Fix chunk count bug in FakeAdaptiveDataSet.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162331762
2017-07-19 14:02:24 +01:00
tonihei
f77e96bca8 Allow to extend FakeDataSource.
Extensions can perform additional actions whenever data is read (e.g. sleeping
to simulate bandwidth restrictions).

Additionally, the factory class can also be overwritten and allows to set the
FakeDataSet later in case it is not available right away.

Moreover, this class now also uses a transfer listener similar to all real data sources.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162326000
2017-07-19 14:01:03 +01:00
tonihei
81048ee7af Add byte offset variable to fake data segments.
The value is automatically set at creation and allows simpler access to the
faked data position within the source.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162218095
2017-07-17 23:17:43 +01:00
tonihei
91341df7b0 Add fake adaptive data set.
This class defines the data of an adaptive media source. It currently has
chunks of equal length and size corresponding to the declared average bitrate
of the Formats.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162208008
2017-07-17 23:16:32 +01:00
tonihei
508db5fd0a Allow multiple Formats per TrackGroup in testutil fake classes.
This enables adaptive media test cases using TrackGroups with multiple
Formats.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162182005
2017-07-17 23:08:52 +01:00
tonihei
8399de4706 Move FakeDataSet to seperate class.
This allows to create extensions of FakeDataSet and also simplifies the
FakeDataSource class.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162180952
2017-07-17 23:07:38 +01:00
tonihei
0621651476 Add buffer length metric to ABR playback test.
This metric is measured once every second.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=161527345
2017-07-12 18:18:25 +01:00
tonihei
6f2f8e49b8 Add rebuffer test metrics to ABR playback tests.
This includes a metric logger class which logs events and generates metrics, and some changes to the Perfgate benchmark config to add the metrics. So far, only rebuffer counts, rebuffer time and startup time are measured, together with auxiliary values of total playback time used for testing and number of playback failures.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=161513672
2017-07-12 18:14:33 +01:00
eguven
37faead26e Rename some assert methods in CacheAsserts to better reflect what they do
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160873280
2017-07-05 15:02:39 +01:00
tonihei
05a77eef5d Move Extractor test assertion methods to ExtractorAsserts class.
This cleans up test the TestUtil class that in large parts consisted of
assertions for Extractor tests.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160829066
2017-07-05 15:02:39 +01:00
tonihei
960315c4d5 Move extractTimelineFromMediaSource to test util class.
This also ensures that TimelineAsserts only contains assert methods.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160827271
2017-07-05 15:02:39 +01:00
tonihei
a9efb4553d Merge TimelineAsserts.FakeTimeline into FakeTimeline.
They serve the same purpose. One was defined as single window, multi-period
timeline, while the other was a multi-window, single-period-each timeline.

The combined FakeTimeline uses TimelineWindowDefinitions which allow multi-
window, multi-period fake timelines.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160808844
2017-07-05 15:02:39 +01:00
tonihei
177a33bbee Merge TimelineAsserts.StubMediaSource into FakeMediaSource.
The StubMediaSource was a subset of the FakeMediaSource.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160638245
2017-06-30 16:52:12 +01:00
tonihei
9db0b8cce0 Move fake ExoPlayer component test classes to testutils.
Fake ExoPlayer componenets used within ExoPlayerTest.java can be useful for
other test classes and are therefore made available in testutils.
They can also be merged with other existing fake components.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160632908
2017-06-30 16:49:59 +01:00
tonihei
d54df32f25 Correct JavaDoc in TimelineAsserts.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160631095
2017-06-30 16:48:51 +01:00
tonihei
3b2cfa148c Move Timeline assertions to testutils.
Some parts of TimelineTest provided common assertions and helper classes for
other tests. As such, they better fit into testutils. In line with other
assertion methods, the TimelineVerifier class has been converted to a set of
static assertion methods.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160629797
2017-06-30 16:47:41 +01:00
eguven
50530147d0 Add a new test and extra checks to DashDownloadServiceTest
Modified old testRemoveAction to test removing content after it's fully downloaded.
Added a new testRemoveBeforeDownloadComplete which tests removing content before it's fully downloaded.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160507573
2017-06-30 16:33:03 +01:00
olly
4a59c7cf40 Make it easier to use ExoPlayer modules in other projects II
With this change, it becomes possible to depend on ExoPlayer
locally in settings.gradle by doing:

gradle.ext.exoplayerRoot = 'path/to/exoplayer/root'
apply from: new File(gradle.ext.exoplayerRoot, 'core_settings.gradle')

You can optionally add a prefix onto ExoPlayer's module names
by adding:

gradle.ext.exoplayerModulePrefix = 'prefix'

Issue: #2851
Issue: #2974

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160277967
2017-06-28 22:26:05 +01:00
olly
2a8eb5a2a1 Make it easier to use ExoPlayer modules in other projects
It's currently difficult to use ExoPlayer modules in other gradle
projects because they rely on constants and dependencies defined
in our own top level gradle file. This change moves the constants
into a separate file referenced directly from each module. It also
removes the need for the top level gradle file to declare a
dependency on com.novoda:bintray-release. This is now only needed
if "exoplayerPublishEnabled = true" is specified.

Issue: #2851
Issue: #2974

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160272072
2017-06-28 22:26:05 +01:00
eguven
444dbeb4c4 Fix NPE in FakeDataSource.close()
If open() fails because of the file isn't available then fakeData is null.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160249214
2017-06-28 22:26:05 +01:00
olly
b3c6f6fb31 Merge ContentDataSource fixes + tests from GitHub
https://github.com/google/ExoPlayer/pull/2963/files
8bb643976f

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160128047
2017-06-26 17:07:56 +01:00
Oliver Woodman
8bb643976f Fix ContentDataSource and enhance tests to validate read data 2017-06-23 17:20:51 +01:00
eguven
531eb15ff4 Move DashDownloadTestBase assert methods to CacheAsserts
CacheAsserts contains cache assertion methods for testing. It's easier to use in tests than DashDownloadTestBase which requires to be extended.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=159688808
2017-06-22 20:20:05 +01:00