713 Commits

Author SHA1 Message Date
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
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
eguven
ed060a8f33 Add FakeDataSource.setTestData() to simplify adding random test data
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=159676653
2017-06-22 20:14:53 +01:00
eguven
1c8f14b5fd Add support to run actions into FakeDataSource
An actions is triggered when the reading reaches action's position. This can be
used to make sure the code is in a certain state while testing.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=159545923
2017-06-22 20:07:26 +01:00
tonihei
de4ff4c5ec Extend HostActivity for reuse and silent timeout.
Added option to fail on timeout. Also reset internals in all cases
such that the activity can be used more than once.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=159419176
2017-06-22 19:59:48 +01:00
tonihei
cdad6a4ef1 Move playback test utils to testutils.
This allows other tests to reuse the util classes without having to link to playbacktests.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=158214560
2017-06-12 10:18:50 +01:00
aquilescanta
1f43fb1998 Introduce CryptoData parameter object
This will allow supporting more encryption schemes. Including some
that require more encryption data, like the encryption pattern.

Issue:#1661
Issue:#1989
Issue:#2089

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=155481889
2017-05-11 05:53:20 +01:00
eguven
1888bd291b Make FakeDataSource FakeDataSet and FakeData structures accessible publicly for comparision in tests
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=151331819
2017-03-31 19:01:07 +01:00
eguven
065d3dc523 Make FakeDataSource able to serve multiple fake files
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=150748155
2017-03-22 19:06:45 +00:00
eguven
f092c4446f Move TestUtil.createTempFolder and TestUtil.recursiveDelete to Util class
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=150190520
2017-03-15 15:55:39 +00:00
olly
d3f4da749c Propagate track type through ExtractorOutput.track
This allows binding by track type in ChunkExtractorWrapper, which
allows the EMSG and 608 tracks to be enabled on FragmentedMp4Extractor
in DefaultDashChunkSource. ChunkExtractorWrapper currently binds these
to DummyTrackOutputs.

Note: I wanted to pass the mimeType instead, since it's a more specific,
but unfortunately there's at least one place where it's not known at the
point of invoking track() (FlvExtractor).

Issue #2176

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=146471082
2017-02-15 16:49:47 +00:00
cblay
37317520f4 Improving handling of atoms with size less than header in FragmentedMp4Extractor.
These currently lead to cryptic ArrayIndexOutOfBoundsExceptions being thrown from System.arraycopy() so my proposal is to throw a more useful ParserException instead.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=142087132
2016-12-16 16:21:16 +00:00
andrewlewis
f45751872d Move track sample index updates out of getPosition(long).
This requires knowing the seek time in Extractor.seek, so that it's possible to
pick the latest synchronization sample at/before the seek time for each track
(rather than the earliest synchronization sample after the seek position).

Also remove the STATE_AFTER_SEEK state which should no longer be needed.

Issue: #2167

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=141432598
2016-12-12 16:15:38 +00:00
eguven
ff77d1e72c Add index file to hold header information for cached content.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138373878
2016-11-10 21:14:29 +00:00
aquilescanta
e685edc179 Make interface implementation consistent among ExtractorOutputs
The method track(int id) currently has different behaviours across
implementations. This CL maps ids to track outputs, which means
that successive calls with the same id will return the same
TrackOutput instance. Also fixes TsExtractor inconsistent behavior
after a seek.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=136026721
2016-10-14 10:42:43 +01:00
andrewlewis
1546da899b Use @IntDef where possible.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=133932812
2016-09-28 11:25:02 +01:00
andrewlewis
6a099f1c57 Clean up MP3 synchronization and fix handling < 4 frames.
Also add a test MP3 stream with one frame.

Make FakeExtractorInput's end of input detection to apply also for peekFully, and
make its skip and read methods read at least one byte.

Issue: #1732

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=133241641
2016-09-16 18:52:42 +01:00
eguven
06a644eccd DataSourceException: Used to specify a DataSource error.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=132053698
2016-09-02 16:20:06 +01:00
eguven
bd7be1b5e7 Cache support unbounded requests.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=131696858
2016-08-31 15:26:02 +01:00
eguven
e003c5b6dc Javadoc for FakeExtractorOutput.assertOutput()
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130933435
2016-08-31 15:25:24 +01:00
olly
1579b68cf6 Sanitize constants
- Use a single constant for unset/unknown times across
  all time bases. Note also that this moves away from
  use of -1 for unset/unknown times in ms, which was a
  bad choice (it might conflict with real times, such
  as a time representing being just behind the start
  of a live window).
- Add a few other unset constants, and use them.
- Fix some hardcoding of -1 where existing constants
  should have been used.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130775594
2016-08-31 15:25:18 +01:00
eguven
bd37216902 CacheSpan and Util.un/escapeFileName tests.
Fixed CacheSpan regexp for line breaks characters in key.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=129631446
2016-08-10 20:06:06 +01:00
olly
e26f72d454 Update @return to Returns where appropriate
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=129201483
2016-08-08 11:16:33 +01:00
andrewlewis
8d122a101d Use new import ordering.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=128967776
2016-08-08 11:06:48 +01:00