657 Commits

Author SHA1 Message Date
olly
3ec0ccabbc Check for null entries in ConcatenatingMediaSource
We do this in the dynamic case, and I think we've seen
a few GitHub issues where developers do this and don't
understand what they've done wrong (because the failure
comes later).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=163688557
2017-07-31 21:15:42 +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
aquilescanta
bb04456324 Fix IndexOutOfBounds when reading a multiple of 8 number of bits
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=163455269
2017-07-31 21:07:40 +01:00
eguven
c3d7ccc3cb Replace iterable foreach loops with indexed for loops
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=163343347
2017-07-31 21:04:55 +01:00
aquilescanta
84d19c464b Add support for AAC-LATM in transport streams
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=163337073
2017-07-31 20:59:45 +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
eguven
cdb71a80aa Remove empty line after copyright text
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=163186057
2017-07-31 20:52:49 +01:00
eguven
2dc1870dd4 Simple Java style fix
Put space between ] and {.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=163116816
2017-07-31 20:51:29 +01:00
Michael Goffioul
908362bdf3 Fix H262 segmentation.
Prepend sequence headers to the next frame, instead of appending them to
the previous frame. Tested decoders like FFMPEG and Google's
Android/MPEG2 expects to read the sequence headers before the first
frame they apply to. When sequence headers are appended to the previous
frame, these are ignored and this leads to incorrect decoding.
2017-07-27 15:44:28 -04:00
olly
13732fe618 Release notes + version bump for 2.5.0-beta1
There's no way to represent a beta in our integer versioning
scheme. I propose we just set it the same for all betas + the
stable release. The versioning for the demo app isn't that
important, so I've just put it directly to 2.5.0 as well.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162749130
2017-07-21 17:39:12 +01:00
olly
3eb85446a2 Fully document DefaultTrackSelector
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162740498
2017-07-21 16:12:41 +01:00
olly
9bb8b240d2 Improve Player/ExoPlayer Javadoc
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162740451
2017-07-21 16:11:29 +01:00
olly
89181cf4bc Fully document MappingTrackSelector
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162721489
2017-07-21 11:24:29 +01:00
andrewlewis
07de4d1b2c Handle ad skipping and content resume
SKIPPED can't be handled as CONTENT_RESUME_REQUESTED because after skipping an
ad there may be further ads to play in its ad group.

Remove workaround for handling unexpected playAd without stopAd, as the player
can instead recover when IMA sends CONTENT_RESUME_REQUESTED. This in turn fixes
handling of the case where playAd is called twice but IMA expects only the
first ad to play, when skipping a particular ad. (Add an ad tag where this
occurs to internal samples.)

Check whether a currently playing ad has been marked as played in
ExoPlayerImplInternal, and handle this case as a seek. This ensures that any
loaded ad periods are discarded in the case of CONTENT_RESUME_REQUESTED.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162610621
2017-07-21 11:23:10 +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
olly
33f5bd6aed Start better documenting track selection
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162601990
2017-07-21 11:17:21 +01:00
olly
19087a7fa0 Fix broken Javadoc
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162601961
2017-07-21 11:16:01 +01:00
olly
54e869cbbd Update Timeline Javadoc to include brief mention of ad groups
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162601778
2017-07-21 11:14:38 +01:00
olly
eb38601626 Update release notes + bump version number
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162514848
2017-07-19 19:57:48 +01:00
olly
108f4f14f3 Suppress no-op timeline changes in ExtractorMediaSource
When an ExtractorMediaSource is used in a concatenation, and
probably when using repeat modes, it needs to produce multiple
ExtractorMediaPeriods during usage. Currently we fire a
source info refresh every time a new ExtractorMediaPeriod
instance prepares, which triggers ExoPlayer.EventListener's
onTimelineChanged method. In nearly all cases the timeline is
unchanged after the first ExtractorMediaPeriod is prepared.
This change suppresses these no-op changes.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162484234
2017-07-19 19:49:31 +01:00
andrewlewis
9716b03f8f Fix isLastPeriod to take into account the played ad count
A content period just before a postroll ad group with all ads played
was not being marked as the last media period in the timeline period.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162471919
2017-07-19 14:19:42 +01:00
aquilescanta
4f5ac9e04f Extract Player interface from ExoPlayer
This is the first step towards facilitating Cast integration to ExoPlayer.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162366198
2017-07-19 14:15:45 +01:00
olly
078c57413b Correctly reset the upstream format from SampleQueues in HLS
When resetting a SampleQueue, by default the upstream format
is not cleared. This is necessary for progressive playbacks,
since (a) the formats never change, and (b) the extractors
only output them once. So when a seek occurs, it's necessary
to clear all sample data from the queue, but retain the current
upstream format.

Uniquely for HLS, the media in a SampleQueue that we may read
from can be in a format not supported by the consuming renderers.
We clear all the sample data from the queue in this case, but
not the upstream format. Since we have an optimization that
allows the upstream format to be read in advance of another
sample being written into the queue, this can result in an
unsupported format being read by a consuming renderer. This
change ensures the upstream format is correctly cleared in the
problematic case.

Issue: #3079

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162360267
2017-07-19 14:13:09 +01:00
tonihei
fb2dbf2c77 Use Clock in DefaultBandwidthMeter instead of SystemClock.
The default behaviour stays the same as Clock.DEFAULT == SystemClock. And it
enables bandwidth measurements in tests with simulated clocks.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162350852
2017-07-19 14:10:29 +01:00
tonihei
3ff9695a73 Move getBufferedPositionUs into SequenceableLoader.
All implementations of SequenceableLoader already implement this method.
Moreover, all composite media periods contained an exact copy of an
implementation that now moved to CompositeSequencableLoader.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162349083
2017-07-19 14:08:59 +01:00
olly
e26b8824dd Add Downloader for progressive content
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162348129
2017-07-19 14:07:38 +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
andrewlewis
c28a2a4100 Fix content position for postroll ads
The position returned by getContentPosition() could be C.TIME_END_OF_SOURCE.
Fix the content position stored in MediaPeriodInfos for postroll ads to be the
duration of the containing period.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162322339
2017-07-19 13:59:38 +01:00
bachinger
5be79d4f42 Media session extension to connect ExoPlayer with the MediaSession of the
framework.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162245883
2017-07-17 23:22:41 +01:00
olly
387720d182 Allow module registrations + log player release
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162223981
2017-07-17 23:21:34 +01:00
olly
da79dec6c1 Make it a bit easier to sideload a subtitle
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162221516
2017-07-17 23:20:20 +01:00
olly
009369bf94 Reduce calls from TsExtractor to ExtractorInput.read
We currently read at most 5 packets at a time from the
extractor input. Whether this is inefficient depends on
how efficiently the underlying DataSource handles lots
of small reads. It seems likely, however, that DataSource
implementations will in general more efficiently handle
fewer larger reads, and in the case of this extractor
it's trivial to do this.

Notes:
- The change appears to make little difference in my
  testing with DefaultHttpDataSource, although analysis
  in #3040 suggests that it does help.
- This change shouldn't have any negative implications
  (i.e. at worst it should be neutral wrt performance). In
  particular it should not make buffering any more likely,
  because the underlying DataSource should return fewer
  bytes than are being requested in the case that it
  cannot fully satisfy the requested amount.

Issue: #3040

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162206761
2017-07-17 23:13:48 +01:00
andrewlewis
706d4e51fe Don't offset the first period holder by the start position
If seek is called for a non-seekable period, when the period is prepared the
start position will be updated from the seek position to zero. Because the
start position is part of the renderer offset for the first loaded period
holder, after the update the renderer offset start position and the new start
position would no longer cancel out, leading to the player position being
negative.

The first period holder's renderer offset is the fixed base offset (60 seconds)
plus its start position, but the start position is always subtracted. Avoid
subtracting the start position for the first period holder so that when it
changes there is no need to update the renderer offset.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162188133
2017-07-17 23:10:06 +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
olly
bf5495f2f5 Optimize in-buffer seeking for HLS
Also move to using an array to hold the SampleQueues,
as we've moved to doing in ExtractorMediaPeriod.

Issue: #551

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=161972990
2017-07-15 17:33:33 +01:00
olly
a2ffcec200 Fix NPE setting drm scheme type
drmInitData can be null in DASH if all of the init data is
specified at the manifest level instead. I took a look at
injecting the manifest format into the extractors, so that
we can actually copy the scheme type into it, but that's
at least non-trivial enough to delay for a subsequent CL.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=161956246
2017-07-15 17:32:28 +01:00
olly
8378c3dc1f Simplify + optimize VorbisBitArray
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=161796758
2017-07-15 17:26:55 +01:00
eguven
90398c5811 Check if thread is interrupted before opening connection
On an old version of okhttp, opening connection clears the thread interrupt flag silently. This is a workaround
to reduce the effect of the bug.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=161784435
2017-07-15 17:24:09 +01:00
andrewlewis
70c5bf7052 Support resuming ads
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=161778560
2017-07-15 17:22:52 +01:00
andrewlewis
6c74a31556 Support resuming content after ads
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=161775394
2017-07-15 17:21:32 +01:00
olly
0da2299c49 Fix FlacStreamInfo to not call readBits with a >32 value
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=161677399
2017-07-12 18:29:31 +01:00
olly
5885f34d12 Optimize ParsableNalUnitBitArray
Apply the same learnings as in ParsableBitArray.

Issue: #3040

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=161674119
2017-07-12 18:28:20 +01:00
olly
01c0ccbdbd Optimize ParsableBitArray
ParsableBitArray.readBit in particular was doing an excessive
amount of work. The new implementation is ~20% faster on desktop.

Issue: #3040

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=161666420
2017-07-12 18:27:08 +01:00
olly
2b1614cc7b Don't use ParsableBitArray to parse TS packet headers
Really low hanging fruit optimization for TS extraction.

ParsableBitArray is quite expensive. In particular readBits
contains at least 2 if blocks and a for loop, and was being
called 5 times per 188 byte packet (4 times via readBit). A
separate change will follow that optimizes readBit, but for
this particular case there's no real value to using a
ParsableBitArray anyway; use of ParsableBitArray IMO only
really becomes useful when you need to parse a bitstream more
than 4 bytes long, or where parsing the bitstream requires
some control flow (if/for) to parse.

There are probably other places where we're using
ParsableBitArray over-zealously. I'll roll that into a
tracking bug for looking in more detail at all extractors.

Issue: #3040

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=161650940
2017-07-12 18:24:23 +01:00
aquilescanta
f72833476e Add DRM support to RendererCapabilities
This CL also makes DefaultTrackSelector take it into account when RendererCapabilities
sets it to unsupported.

A following CL could add a DefaultTrackSelector parameter to force DRM "known support" for specific track types.

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

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=161556467
2017-07-12 18:22:04 +01:00
olly
3c5688de73 Optimize in-queue seeking when non-AV tracks are present
Let's do it this way for now. Note there's an implicit
assumption in here that non-AV tracks consist of only
key-frames, but I think we'll not encounter any issues
in the real world as a result, we already make this
assumption in ChunkSampleStream, and actually tagging
every queue with this information explicitly is a very
painful amount of plumbing.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=161545383
2017-07-12 18:20:54 +01:00
olly
0052a70f60 Correctly propagate format identifier for CEA-608 in HLS
Issue: #3033

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=161512537
2017-07-12 18:13:12 +01:00
andrewlewis
ef56c9fe39 Move ad playback state into ImaAdsLoader
Once background and resuming is supported, the ads loader will be kept when the
player is destroyed and recreated. Move the state relating to the structure of
ads and what ads have been loaded/played out of the media source and into the
loader so the information is not lost when the source is released, in
preparation for supporting background and resuming.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=161503571
2017-07-12 18:11:39 +01:00
tonihei
45f94eab62 Allow moving media source within DynamicConcatenatingMediaSource.
This option allows to move the currently playing media source to another position
and also to move other media source without creating a new MediaSource object.

Issue:#1706

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=161402022
2017-07-12 18:09:08 +01:00