606 Commits

Author SHA1 Message Date
olly
13a7037c82 Fix playback of FLV live streams with no audio track
Issue: #3188

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177811487
2017-12-12 21:48:01 +00:00
olly
a8298b4c56 Tentative fix for roll-up row count
Issue: #3513

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177804505
2017-12-12 21:46:33 +00:00
Oliver Woodman
10b24be6f0 Fix build 2017-12-12 21:46:02 +00:00
andrewlewis
e759462af8 Update internal usages of deprecated AdaptiveMediaSourceEventListener
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177786580
2017-12-12 21:40:21 +00:00
andrewlewis
393a762563 Use AdaptiveMediaSourceEventListener for ExtractorMediaSource
This is a step towards harmonizing the MediaSource Builders and (potentially)
providing MediaSource factories.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177783157
2017-12-12 21:33:59 +00:00
olly
b61d09c416 Fix mp3 extractor test
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177458840
2017-12-12 21:33:40 +00:00
olly
0ea8c8bfa0 Fix VBRI and XING seekers
- Remove skipping of the VBRI/XING frame before calculating position
  offsets. This was incorrect. Instead, a constraint is used to ensure
  we don't return positions within these frames, the difference being
  that the constraint adjusts only positions that would fall within
  the frames, where-as the previous approach shifted positions through
  the whole stream.
- Excluded last entry in the VBRI table because it has an invalid
  position (the length of the stream).
- Give variables in XingSeeker descriptive names.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177451295
2017-12-12 21:33:34 +00:00
andrewlewis
022b85a625 Move resetting audio processors to initialize()
The set of active audio processors was only updated on reconfiguration and when
draining playback parameters completed. Draining playback parameters are cleared
in reset(), so if parameters were set while paused then the sink was quickly
reset, without draining completing, the set of active audio processors wouldn't
be updated. This means that a switch to or from speed or pitch = 1 would not be
handled correctly if made while paused and followed by a seek.

Move resetting active audio processors from configure (where if the active audio
processors were reset we'd always initialize a new AudioTrack) to initialize().

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177442098
2017-12-12 21:33:18 +00:00
olly
8fbc2a5c9b Snap to frame boundary in ConstantBitrateSeeker
- This change snaps the seek position for constant bitrate MP3s
  to the nearest frame boundary, avoiding the need to skip one
  byte at a time to re-synchronize (this may still happen if the
  MP3 does not really have fixed size frames).
- Tweaked both ConstantBitrateSeeker and WavHeader to ensure the
  returned positions are valid.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177441798
2017-12-12 21:32:40 +00:00
andrewlewis
315a6c3558 Update getPosition(0) positions for FragmentedMp4Extractor
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177424314
2017-12-12 21:31:17 +00:00
andrewlewis
9526e8586a Use a MediaSource factory internally in AdsMediaSource
Support ad MediaSources that aren't prepared immediately by using
DeferredMediaPeriod, moved up from DynamicConcatenatingMediaSource.

In a later change the new interfaces will be made public so that apps
can provide their own MediaSource factories.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177424172
2017-12-12 21:31:02 +00:00
mdoucleff
f0f726dfa9 Add manifestless captions support. This code fits into the pre-existing
captions fetcher architecture.

1.  ManifestlessCaptionsMetadata

Other captions fetchers must first fetch a manifest (HLS or manifest) to
discover captions tracks.  This process does not exist for manifestless.  All
we need to do is scan the FormatStream's for the right itag, so this is an
all-static class.

2.  ManifestlessSubtitleWindowProvider

Once a captions track is selected, a subtitles provider is instantiated.  This
is the main interface used by the player to retrieve captions according to
playback position.  This class stores fetched captions in a tree index by time
for efficient lookups.  Background captions fetches are used to populate
the tree.

3.  ManifestlessCaptionsFetch

Captions are fetched one segment at a time.  One instance of this object
is required per fetch.  It performs a blocking fetch on call(), and is
intended to be submitted to a background-thread executor.

4.  ManifestlessCaptionsFetch.CaptionSegment

This is the result of the caption fetch.  These values are used to populate
the captions tree.

Manifestlessness

The initial request is always a headm request.  There is a separate tree
of every segment indexed by start time.  This tree is used to improve
manifestless sequence number calculation.  Once we have data for the current
timestamp, we walk forward through the tree to find the next unfetched
sequence number, and fetch that.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177385094
2017-12-12 21:28:45 +00:00
olly
800cfeea3d Optimize seeking for unseekable SeekMaps
- Avoid re-downloading data prior to the first mdat box when
  seeking back to the start of an unseekable FMP4.
- Avoid re-downloading data prior to the first frame for
  constant bitrate MP3.
- Update SeekMap.getPosition documentation to allow a non-zero
  position for the unseekable case. Note that XingSeeker was
  already returning a non-zero position if unseekable.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177317256
2017-12-12 21:28:28 +00:00
olly
91b324f6b9 Fix weird XingSeeker indexing
There are still things broken about the seeker, but this
cleans up some of the weird bits.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177315136
2017-12-12 21:28:22 +00:00
tonihei
63dbf56b6c Allow multiple video and audio debug listeners in SimpleExoPlayer.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177184331
2017-12-12 21:28:05 +00:00
andrewlewis
c12349e2c9 Allow setting supported formats on AdsLoaders
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177175377
2017-12-12 21:27:53 +00:00
olly
9eed1150e0 Clean up some extrator SeekMap implementations
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177173618
2017-12-12 21:27:31 +00:00
aquilescanta
a8d4ad94f4 Fix DefaultTrackSelector#Parameter withSelectUndeterminedTextLanguage
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177170994
2017-12-12 21:27:24 +00:00
olly
0e0300b802 Extractor cleanup
- Align class summary Javadoc
- Fix ErrorProne + Style warnings

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177165593
2017-12-12 21:26:36 +00:00
olly
7a03198028 Add some clarifications to MediaSource documentation
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177141094
2017-12-12 21:26:07 +00:00
tonihei
1861aea2b3 Add throws IllegalSeekPositionException doc to seekTo(windowIndex, positionMs).
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177011497
2017-12-12 21:24:39 +00:00
aquilescanta
c1c892f5ec Support undefined text track language when preferred is not available
Also slightly improve language normalization/documentation.

For this CL, it is assumed that null and "und" languages are different
entities. Once we fully tackle language tag normalization, we can decide
whether to normalize the "undefined" language.

Issue:#2867
Issue:#2980

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177008509
2017-12-12 21:23:25 +00:00
andrewlewis
6c1f562230 Switch from currentTimeMillis to elapsedRealtime
currentTimeMillis is not guaranteed to be monotonic and elapsedRealtime is
recommend for interval timing.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176853118
2017-12-12 21:21:05 +00:00
olly
fa5cc5be51 Bump target API level to 27
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176366693
2017-12-12 20:49:32 +00:00
olly
5c0e1f3e8a Use MediaSourceTestRunner in additional source tests
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176366471
2017-12-12 20:49:14 +00:00
andrewlewis
c3b92f8456 Add support for Dolby Atmos
Issue: #2465

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176341309
2017-12-12 20:47:48 +00:00
tonihei
82ce68009c Move MockitoUtils to testutils and use it for all Mockito set-ups.
In particular this allows to have the workaround for
https://code.google.com/p/dexmaker/issues/detail?id=2 in one place only.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176340526
2017-12-12 20:47:13 +00:00
hoangtc
09f3055bad Add Builder to SingleSampleMediaSource.
Add Builder pattern to SingleSampleMediaSource and mark existing constructors as
deprecated.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176332964
2017-12-12 20:46:14 +00:00
olly
1b7c950d1e Add MediaSourceTestRunner for MediaSource tests.
- MediaSourceTestRunner aims to encapsulate some of the logic
  currently used in DynamicConcatenatingMediaSourceTest, so it
  can be re-used for testing other MediaSource implementations.
- The change also fixes DynamicConcatenatingMediaSourceTest to
  execute calls on the correct threads, and to release handler
  threads at the end of each test.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176117535
2017-12-12 20:45:07 +00:00
olly
14299e0643 Simplify LoopingMediaSourceTest setup
This test seems to obtain a timeline from a prepared
FakeMediaSource, but that's identical to the timeline
passed into that source to start with :).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176117133
2017-12-12 20:44:59 +00:00
tonihei
bb4be4314a Add simplified FakeTimeline constructor.
This is helpful for tests which don't care about detailled timeline set-ups
besides the number of windows.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176097369
2017-12-12 20:44:38 +00:00
hoangtc
1f70d3cdd7 Add Builder to ExtractorMediaSource.
Add Builder pattern to ExtractorMediaSource and mark existing constructors as
deprecated.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176088810
2017-12-12 20:44:19 +00:00
olly
f5a3a27726 Deduplicate ExtractorMediaPeriod discontinuity reporting
This change makes sure progress is being made before reporting
a discontinuity. Else in cases like having no network and
playing a live stream, we allow the discontinuity to be read
each time an internal retry occurs, meaning it gets read
repeatedly. This does no harm, but is noisy and unnecessary.

We should also not allow skipping whilst there is a pending
reset or discontinuity notification, just like we don't allow
reads.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=175953064
2017-12-12 20:42:49 +00:00
andrewlewis
820a445944 Add support for float output for FfmpegAudioRenderer
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=175940553
2017-12-12 20:42:34 +00:00
andrewlewis
108900cf52 Add support for float output in DefaultAudioSink
Also switch from using MIME types to C.ENCODING_* encodings in DefaultAudioSink.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=175936872
2017-12-12 20:41:27 +00:00
andrewlewis
d49fc54968 Use ArrayDeque for playback parameters checkpoints
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=175837754
2017-12-12 20:40:01 +00:00
olly
4bb5cda5f1 Some test cleanup
The purpose of this change isn't to fix anything. It's just to
simplify things a little bit. There will be following CLs that
make some changes to get things onto correct threads.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=175800354
2017-12-12 20:39:16 +00:00
tonihei
76ba1890aa Add method to FakeMediaSource to trigger source info refresh.
This allows to remove the LazyMediaSource used within
DynamicConcatenatingMediaSourceTest and also allows to write test which
simulates dynamic timeline or manifest updates.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=175680371
2017-12-12 20:39:09 +00:00
tonihei
eea8cd169c Replaced the duplicated EMPTY track group array with the one already defined
in TrackGroupArray.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=175670266
2017-12-12 20:38:47 +00:00
aquilescanta
79a9155438 Add support for 608/708 captions in HLS+fMP4
This also allows exposing multiple CC channels to any fMP4 extractor client.

Issue:#1661

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=174458725
2017-12-12 20:36:11 +00:00
hoangtc
5bf4c249a2 Notify TrackSelection when it's enabled and disabled.
Add onEnable() and onDisable() call-backs to TrackSelection. This allows
TrackSelection to perform interesting operations (like subscribe to
NetworkStatus) and clean up after itself.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=175558485
2017-12-12 20:31:58 +00:00
Oliver Woodman
3562fe1c69 SampleStream fixes 2017-11-22 20:38:53 +00:00
Oliver Woodman
75b9062583 Send discontinuity at adjustments after shuffle/repeat mode changes. 2017-11-22 18:06:14 +00:00
Oliver Woodman
56c1c3f6a7 Revert "Make ExtractorMediaSource timeline dynamic until duration is set"
This reverts commit b688a562508e74721841aaaa770e9dc47bd378dd.
2017-11-22 17:59:36 +00:00
olly
74569bba45 Don't do work after track selection when in ended state
This causes the player to report that it's started loading
when in the ended state.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176371892
2017-11-21 13:57:46 +00:00
olly
fa3052d36b Report additional position discontinuities
- Properly report internal discontinuities
- Add DISCONTINUITY_REASON_SEEK_ADJUSTMENT to distinguish
  seek adjustments from other internal discontinuity events

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176367365
2017-11-21 13:57:16 +00:00
olly
b688a56250 Make ExtractorMediaSource timeline dynamic until duration is set
We (eventually - albeit possibly infinitely far in the future)
expect a timeline update with a window of known duration. This
also stops live radio stream playbacks transitioning to ended
state when their tracks are disabled.

As part of this fix, I found an issue where getPeriodPosition
could return null even when defaultPositionProjectionUs is 0,
which is not as documented.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176492024
2017-11-21 13:48:27 +00:00
Oliver Woodman
1439b4a3ef Mini cleanup 2017-11-21 13:46:18 +00:00
Ian Bird
494237548a Fix initializationData check for SSA subtitles 2017-11-21 13:46:12 +00:00
olly
e469269f3c Fix some lint issues.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176337058
2017-11-20 13:48:32 +00:00