118 Commits

Author SHA1 Message Date
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
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
olly
3c49044fb4 Updates for ExoPlayer modularization
- Update relevant documentation
- Use individual modules for the demo app. Given it's
  preferable to use them over the full library, and that
  many people probably use the demo app as a starting
  point, we should set the right example even though we
  currently need to include all of them.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=153454898
2017-04-18 19:43:41 +01:00
olly
8be85d4d2f Consolidate version codes in root gradle file
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=153453768
2017-04-18 19:42:27 +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
204537ed40 Pre-modularization cleanup
- Use a variable for the (default) minSdkVersion. There will
  be more modules that need it, and it'll be easier to manage
  if it's in one place.

Issue: #2139

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=150050663
2017-03-15 15:44:46 +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
olly
51f96374d4 Make headers consisting across build.gradle files
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=144826116
2017-01-18 18:19:03 +00:00
olly
1eede5d5bb Fix gradle/proguard setup
- Add proguard rules for libraries/extensions into .aar files
- Add proguard rules to retain CEA608/708 decoder constructors
- Remove lots of default config from gradle files
- Remove disabling of abort on lint error
- Enable optimizations on release builds of demo app

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=144350233
2017-01-13 17:27:25 +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
olly
a779eabdc5 Update SDK / Tools.
- Centralise compileSdkVersion, targetSdkVersion and
  buildToolsVersion in a single place for gradle.
- Bump compileSdkVersion and targetSdkVersion to 24.
- Bump com.android.tools.build version to re-enable
  instant start.
- Bump targetSdkVersion in manifests (needed for
  internal builds).
- Use standard expandable_list_item from Android in
  the demo app, since ours doesn't look right when
  targeting API level 24. We were also setting the
  theme on the wrong element in the manifest, so I'm
  removing that line.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=131929216
2016-09-02 16:12:55 +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