603 Commits

Author SHA1 Message Date
tonihei
dd4f9bcaae Add Timeline.Window.isLive
This flag is currently merged into Window.isDynamic, which isn't always true
because
1. A window can be dynamic for other reasons (e.g. when the duration is still
missing).
2. A live stream can be become non-dynamic when it ends.

Issue:#2668
Issue:#5973
PiperOrigin-RevId: 271999378
2019-10-02 21:28:43 +01:00
ibaker
f0723a27b7 Move HLS mapped track picking into a separate method
This helps reduce the amount of nesting in HlsSampleStreamWrapper.track()

PiperOrigin-RevId: 271983779
2019-10-02 21:28:20 +01:00
ibaker
f0b9889ef6 Remove duplicated tracksEnded check in HlsSampleStreamWrapper
PiperOrigin-RevId: 271364512
2019-10-02 21:27:12 +01:00
ibaker
b57c356fbf Reshuffle {audio,video}SampleQueue{Index,MappingDone} into fields mapped by type
PiperOrigin-RevId: 271364200
2019-10-02 21:27:04 +01:00
aquilescanta
18b9304f25 Call prepare and release from MediaSources
Issue:#4721
PiperOrigin-RevId: 270342454
2019-09-22 00:16:07 +01:00
olly
0a854d6b84 Rollback of dd7223df10
*** Original commit ***

Refactor HlsSampleStreamWrapper#track() to clarify the return paths

I found the original implementation quite hard to follow, and I believe this is functionally identical.

***

PiperOrigin-RevId: 270263186
2019-09-20 17:21:01 +01:00
aquilescanta
e5f9a858d3 When the HLS container format is not packed audio, reset timestmap offset
Issue:#6444
PiperOrigin-RevId: 270252126
2019-09-20 17:21:01 +01:00
ibaker
6cd530520d Refactor HlsSampleStreamWrapper#track() to clarify the return paths
I found the original implementation quite hard to follow, and I believe this is functionally identical.

PiperOrigin-RevId: 270237641
2019-09-20 17:21:01 +01:00
aquilescanta
9863cd33fa Avoid retrying fatal errors
Also clear fatal errors on seek operations

PiperOrigin-RevId: 269780886
2019-09-18 23:23:21 +01:00
aquilescanta
0aba89b60e Make live HLS default start position at least 2*target duration from live edge
Issue:#6360
PiperOrigin-RevId: 267615050
2019-09-10 10:27:38 +01:00
olly
2d0b10a73a Use constant to define androidx annotation version
PiperOrigin-RevId: 266801762
2019-09-05 10:45:08 +01:00
olly
a02237de20 Fix imports
PiperOrigin-RevId: 266676413
2019-09-01 22:03:52 +01:00
tonihei
6a1331f125 Gracefully handle chunkful preparation without chunks.
This situation happens if the first chunk to load is already behind the end
of the stream. In this case, the preparation never completes because
HlsSampleStreamWrapper gets stuck in a prepared=false and loadingFinished=true
state.

Gracefully handle this situation by attempting to load the last chunk if still
unprepared to ensure that track information is obtained as far as possible.
Otherwise, it wouldn't be possible to play anything even when seeking back.

Issue:#6314
PiperOrigin-RevId: 264599465
2019-08-23 17:02:10 +01:00
aquilescanta
f3a1b099e6 Fix propagation of HlsMetadataEntry's in HLS chunkless preparation
PiperOrigin-RevId: 263356275
2019-08-15 14:41:52 +01:00
aquilescanta
a572fb3f22 Add a metadata argument to Format factory methods used in HLS
Required for propagation of HlsMetadataEntry's in chunkless preparation.

PiperOrigin-RevId: 263324345
2019-08-15 14:41:51 +01:00
tonihei
389eca6e07 Merge robolectric_testutils into testutils.
We no longer need two modules as AndroidX-Test takes care of the system
abstraction and we no longer have Robolectric Handler/Looper workarounds.

PiperOrigin-RevId: 262363201
2019-08-09 18:36:32 +01:00
tonihei
58d4fd93dd Fix HLS module API nullability issues and add package-level non-null-by-default
PiperOrigin-RevId: 262124441
2019-08-09 18:34:18 +01:00
tonihei
17a9030e1d Update stale TrackSelections in chunk sources when keeping the streams.
If we keep streams in chunk sources after selecting new tracks, we also keep
a reference to a stale disabled TrackSelection object. Fix this by updating
the TrackSelection object when keeping the stream. The static part of the
selection (i.e. the subset of selected tracks) stays the same in all cases.

Issue:#6256
PiperOrigin-RevId: 261696082
2019-08-05 20:27:24 +01:00
olly
fb0481c520 Bump annotations dependency + update release notes
PiperOrigin-RevId: 261353271
2019-08-02 19:04:56 +01:00
olly
d77d661e52 Default viewport constraints to match primary display
PiperOrigin-RevId: 260479923
2019-07-29 21:27:46 +01:00
aquilescanta
2a8cf2f5ef Plumb DrmSessionManager into HlsMediaSource
PiperOrigin-RevId: 259520431
2019-07-23 23:16:33 +01:00
aquilescanta
3a53543a9a Move HLS DrmInitData adjustment to the writing side
+ Emulates what's done for ID3 stripping.
+ Also avoid a copy if fields will not change because of the
  copy.

PiperOrigin-RevId: 259369101
2019-07-23 23:15:54 +01:00
tonihei
c779e84cbb Switch language normalization to 2-letter language codes.
2-letter codes (ISO 639-1) are the standard Android normalization and thus we
should prefer them to 3-letter codes (although both are technically allowed
according the BCP47).

This helps in two ways:
 1. It simplifies app interaction with our normalized language codes as the
    Locale class makes it easy to convert a 2-letter to a 3-letter code but
    not the other way round.
 2. It better normalizes codes on API<21 where we previously had issues with
    language+country codes (see tests).
 3. It allows us to normalize both ISO 639-2/T and ISO 639-2/B codes to the same
    language.

PiperOrigin-RevId: 258729728
2019-07-18 14:15:50 +01:00
aquilescanta
bbcd46e98a Change HlsSampleStreamWrapper.prepareWithMasterPlaylistInfo to take a TrackGroup[]
Non-functional change. Makes it easier to add the ExoMediaCrypto type information
to the formats.

PiperOrigin-RevId: 257598282
2019-07-14 16:23:00 +01:00
bachinger
49a2e5a5cb add manifest to Timeline.Window
- Remove manifest argument from callbacks of Player.EventListener and
  SourceInfoRefreshListener. Instead make it accessible through
  Player.getCurrentManifest() and Timeline.Window.manifest.
- Fix all MediaSource implementation to include the manifest in the
  Timeline instead of passing it to the SourceInfoRefreshListener.
- Refactor ExoPlayerTestRunner, FakeTimeline, FakeMediaSource to
  reflect these changes and make tests pass.

PiperOrigin-RevId: 257359662
2019-07-14 16:20:45 +01:00
tonihei
2a765f6b5a Visibility clean-up: Don't extend visibility of protected methods in overrides.
PiperOrigin-RevId: 255412493
2019-07-02 17:46:30 +01:00
olly
b47f37fbcd Add HlsTrackMetadataEntry.toString
It's printed out by EventLogger, and currently looks pretty ugly

PiperOrigin-RevId: 250772010
2019-06-03 19:15:23 +01:00
eguven
00b26a51df Modify DashDownloaderTest to test if content length is stored
PiperOrigin-RevId: 250655481
2019-05-30 15:26:32 +01:00
olly
94d668567c Migrate org.mockito.Matchers#any* to org.mockito.ArgumentMatchers
The former is deprecated and replaced by the latter in Mockito 2. However, there is a
functional difference: ArgumentMatchers will reject `null` and check the type
if the matcher specified a type (e.g. `any(Class)` or `anyInt()`). `any()` will
remain to accept anything.

PiperOrigin-RevId: 250458607
2019-05-30 15:25:28 +01:00
aquilescanta
04f3888550 Add allowOnlyClearBuffers to SampleQueue#read
Removes the need for duplicate calls to SampleQueue#read when
implementing DecryptionResources acquisition in the MediaSources.

PiperOrigin-RevId: 250298175
2019-05-30 15:25:28 +01:00
olly
3afdd7ac5a Put @Nullable annotation in the right place
PiperOrigin-RevId: 249828748
2019-05-30 15:10:55 +01:00
olly
11c0c6d266 Reset upstream format when empty track selection happens
PiperOrigin-RevId: 249819080
2019-05-30 15:10:40 +01:00
tonihei
33c677846a Use versioned manifest in all Robolectric tests.
We are currently defaulting to targetSdk=1 as no targetSdk is specified. Only
tests which explicitly ask for another SDK use another test SDK. With the
versioned manifest, all tests run using the targetSDK by default.

PiperOrigin-RevId: 249060796
2019-05-21 13:51:43 +01:00
eguven
4ca670bed3 Use MediaSourceFactory interface to simplify DownloadHelper
PiperOrigin-RevId: 248367983
2019-05-15 20:13:59 +01:00
aquilescanta
cf389268b0 Add links to the developer guide in some READMEs
PiperOrigin-RevId: 248221982
2019-05-15 18:14:07 +01:00
tonihei
34dd4b1441 Fix NPE in HLS deriveAudioFormat.
Issue:#5868
PiperOrigin-RevId: 247613811
2019-05-15 18:10:07 +01:00
olly
f8cd770d84 Migrate from is(Not)SameAs to is(Not)SameInstanceAs.
They behave identically, and the old names are being removed.

Open-source note: The new methods are available in Truth as of version 0.44.

END_PUBLIC

More information:
  go/issameas-lsc

Tested:
    TAP --sample ran all affected tests and none failed
    http://test/OCL:246024032:BASE:246042619:1556672975894:513e7746
PiperOrigin-RevId: 246101315
2019-05-02 13:04:11 +01:00
aquilescanta
f64011ae04 Prevent index out of bounds exceptions in some live HLS scenarios
Can happen if the load position falls behind in every playlist and
when we try to load the next segment, the adaptive selection logic
decides to change variant.

Issue:#5816
PiperOrigin-RevId: 245923006
2019-04-30 22:07:28 +01:00
olly
82061e9afb Improve progress reporting logic
- Listener based reporting of progress allows the content length
  to be persisted into the download index (and notified via a
  download state change) as soon as it's available.
- Moved contentLength back into Download proper. It should only
  ever change once, so I'm not sure it belongs in the mutable part
  of Download.
- Made a DownloadProgress class, for naming sanity.

PiperOrigin-RevId: 244242487
2019-04-18 23:24:11 +01:00
eguven
f9f009645d Add missing DownloadService build*Intent and startWith* methods
PiperOrigin-RevId: 244196081
2019-04-18 23:22:35 +01:00
aquilescanta
f6de1aa242 Add test for HlsTrackMetadataEntry population in the HlsPlaylistParser
PiperOrigin-RevId: 244168713
2019-04-18 15:17:33 +01:00
olly
af5131e393 Rename Shadow*Looper classes (PR#4868)
ShadowLooper -> ShadowLegacyLooper
ShadowRealisticLooper -> ShadowPausedLooper
ShadowBaseLooper -> ShadowLooper

And all public methods from ShadowLegacyLooper get pushed up to ShadowLooper

Pull Request: https://github.com/robolectric/robolectric/pull/4868

Copybara: OK

Also adjust Google3 tests  using custom looper shadows where necessary.
Convert exoplayer to paused looper to eliminate reliance on custom shadows

PiperOrigin-RevId: 243839311
2019-04-18 15:13:07 +01:00
eguven
5856e75781 Rename DownloadAction to DownloadRequest
PiperOrigin-RevId: 243806888
2019-04-16 16:41:29 +01:00
eguven
c2c7c43a36 Remove redundant proguard files
PiperOrigin-RevId: 243781000
2019-04-16 15:28:39 +01:00
aquilescanta
9ddd39c1c0 Add the HlsMetadataEntry from the Master playlist to the Hls tracks
PiperOrigin-RevId: 243624081
2019-04-16 15:26:44 +01:00
tonihei
1ee51518ae Use new exoplayer.dev domain everywhere.
The old domain automatically forwards to the new one. For consistency, change
all doc and code references regardless.

Also adds GitHub CNAME config file which configures our page for the custom
domain.

PiperOrigin-RevId: 243592110
2019-04-16 15:25:27 +01:00
aquilescanta
1bf1790edc Extract factory method for FragmentedMp4Extractor in DefaultHlsExtractorFactory
PiperOrigin-RevId: 243582468
2019-04-16 15:24:48 +01:00
aquilescanta
97acc681d1 Add HlsMetadataEntries to HlsMasterPlaylist's variants and renditions
PiperOrigin-RevId: 243304549
2019-04-13 01:43:21 +01:00
aquilescanta
936bc244b6 Add an HLS metadata entry sublcass to populate HLS track formats
Include information to facilitate adaptive track selection in HLS.

PiperOrigin-RevId: 243238232
2019-04-13 01:41:23 +01:00
olly
d3b63a97ad Remove DownloadAction serialization
Implement Parcelable instead, which is a more intented way of
passing structured data via Intents.

PiperOrigin-RevId: 242646441
2019-04-13 01:36:46 +01:00