2065 Commits

Author SHA1 Message Date
andrewlewis
a849f43e6d Work around broken raw audio decoder on Oppo R9
Issue: #5782
PiperOrigin-RevId: 247934223
2019-05-15 18:12:16 +01:00
tonihei
90fc659b75 Fix Javadoc links.
PiperOrigin-RevId: 247630389
2019-05-15 18:10:44 +01:00
tonihei
23fa53bf0b Add setCodecOperatingRate workaround for 48KHz audio on ZTE Axon7 mini.
Issue:#5821
PiperOrigin-RevId: 247621164
2019-05-15 18:10:26 +01:00
aquilescanta
3b60584813 Add a release callback to DefaultDrmSession
In preparation for reference counting in DrmSession

PiperOrigin-RevId: 247428114
2019-05-15 18:09:30 +01:00
andrewlewis
0a6f81a2cc Update player accessed on wrong thread URL
PiperOrigin-RevId: 247418601
2019-05-15 18:09:12 +01:00
tonihei
3a3a941abd Ensure messages get deleted if they throw an exception.
If a PlayerMessage throws an exception, it is currently not deleted from the
list of pending messages. This may be problematic as the list of pending
messages is kept when the player is retried without reset and the message is
sent again in such a case.

PiperOrigin-RevId: 247414494
2019-05-15 18:08:53 +01:00
andrewlewis
887116cd2d Increase gapless trim sample count
PiperOrigin-RevId: 247348352
2019-05-15 18:08:30 +01:00
tonihei
b3ae1d3fed Add option to clear all downloads.
Adding an explicit option to clear all downloads prevents repeated database
access in a loop when trying to delete all downloads.

However, we still create an arbitrary number of parallel Task threads for this
and seperate callbacks for each download.

PiperOrigin-RevId: 247234181
2019-05-15 18:08:08 +01:00
tonihei
7d5558881d Fix two ad insertion related bugs in DefaultPlaybackSessionManager.
1. A content session after an ad has been played was not re-marked as active,
   leading to new ad session being marked as active too early.
2. Switching from content to post-roll ended the content session because
   the return value of getAdGroupTimeUs of C.TIME_END_OF_SOURCE was not
   handled. Using the nextAdGroupIndex instead.

PiperOrigin-RevId: 246977327
2019-05-15 18:07:49 +01:00
olly
1ef49ed205 Fix broken Javadoc
PiperOrigin-RevId: 246728418
2019-05-05 18:18:34 +01:00
olly
b53ac32b8c Prevent CachedContentIndex.idToKey from growing without bound
PiperOrigin-RevId: 246727723
2019-05-05 18:18:15 +01:00
olly
1292a35ec6 Add a couple of assertions to DownloadManager set methods
PiperOrigin-RevId: 246491511
2019-05-03 19:35:13 +01:00
olly
76184deb21 Minor download documentation tweaks
PiperOrigin-RevId: 246333281
2019-05-03 19:34:53 +01:00
tonihei
5992699d91 Post-submit fixes for eed5d957d8.
One wrong return value, a useless assignment, unusual visibility of private
class fields and some nullability issues.

PiperOrigin-RevId: 246282995
2019-05-02 13:05:52 +01:00
olly
de7c62a915 Remove unnecessary logging
As justification for why we should not have this type of logging,
it would scale up to about 13K LOC, 1800 Strings, and 36K (after
pro-guarding - in the case of the demo app) if we did it through
the whole code base*. It makes the code messier to read, and in
most cases doesn't add significant value.

Note: I left the Scheduler logging because it logs interactions
with some awkward library components outside of ExoPlayer, so is
perhaps a bit more justified.

* This is a bit unfair since realistically we wouldn't ever add
  lots of logging into trivial classes. But I think it is fair
  to say that the deltas would be non-negligible.

PiperOrigin-RevId: 246181421
2019-05-02 13:05:32 +01:00
olly
ea0efa7464 Periodically persist progress to index whilst downloading
PiperOrigin-RevId: 246173972
2019-05-02 13:05:13 +01:00
olly
eed5d957d8 Rework DownloadManager to fix remaining TODOs
- Removed DownloadInternal and its sometimes-out-of-sync
  duplicate state
- Fixed downloads being in STOPPED rather than QUEUED state
  when the manager is paused
- Fixed setMaxParallelDownloads to start/stop downloads if
  necessary when the value changes
- Fixed isWaitingForRequirements

PiperOrigin-RevId: 246164845
2019-05-02 13:04:54 +01:00
Oliver Woodman
faecef0bef Merge pull request #5807 from zsmatyas:dev-v2
PiperOrigin-RevId: 246132620
2019-05-02 13:04:34 +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
tonihei
c480818249 Fix some random AndroidStudio warnings.
PiperOrigin-RevId: 245956915
2019-04-30 22:08:07 +01:00
tonihei
0bb32a8f09 Add IntDef for Player states.
PiperOrigin-RevId: 245925254
2019-04-30 22:07:47 +01:00
olly
802ebc8db1 DownloadManager improvements
- Do requirements TODO
- Add useful helper method to retrieve not met requirements
- Fix WritableDownloadIndex Javadoc

PiperOrigin-RevId: 245922903
2019-04-30 22:07:09 +01:00
olly
51914f8f82 Rename DownloadThread to Task
This resolves some naming confusion that previously existed
as a result of DownloadThread also being used for removals.
Some related variables (e.g. activeDownloadCount) would refer
to both download and removal tasks, whilst others
(e.g. maxParallelDownloads) would refer only to downloads.
This change renames those that refer to both to use "task"
terminology.

This change also includes minor test edits.

PiperOrigin-RevId: 245913671
2019-04-30 22:06:49 +01:00
tonihei
1fb128df36 Move playback session manager to core library.
This allows to use the session management capabilities for other analytics
purposes.

PiperOrigin-RevId: 245710588
2019-04-30 22:06:11 +01:00
Zsolt Matyas
3e14ce1094 Code changes suggested by tonihei 2019-04-29 12:56:25 -07:00
Zsolt Matyas
2f356badd2 Handling XDS and TEXT modes
[Problem]
There are 3 services / modes transported on line 21:
- Captioning
- TEXT (generally not program related)
- XDS (eXtended Data Services)

Bytes belonging to the unsupported modes are interleaved with the
bytes of the captioning mode.
See Chapter 7, Chapter 8.5 and Chapter 8.6 of the CEA608 Standard for
more details.

[Solution]
Drop all bytes belonging to unsupported modes.

[Test]
- All streams containing only captioning services should not be influenced
- Test all 4 CEA 608 channels with live over-the-air content and
using all available TEXT and XDS streams.
2019-04-26 14:56:34 -07:00
andrewlewis
1bc279795b Log warnings when extension libraries can't be used
Issue: #5788
PiperOrigin-RevId: 245440858
2019-04-26 18:35:15 +01:00
olly
2b0b6e1b2e Move DownloadManager internal logic into isolated inner class
There are no logic changes here. It's just moving code around and removing
the "internal" part of names where no longer required.

PiperOrigin-RevId: 245407238
2019-04-26 18:34:37 +01:00
olly
f37b28f12e Post maxParallelDownload and minRetryCount changes
PiperOrigin-RevId: 245405316
2019-04-26 18:34:18 +01:00
olly
643e187d99 Add missing getters and clarify STATE_QUEUED documentation
PiperOrigin-RevId: 245401274
2019-04-26 18:33:59 +01:00
eguven
01ad1c1a84 Add simpler DownloadManager constructor
PiperOrigin-RevId: 245397736
2019-04-26 18:33:39 +01:00
eguven
3382c74488 Allow content id to be set in DownloadHelper.getDownloadRequest
PiperOrigin-RevId: 245388082
2019-04-26 18:33:21 +01:00
eguven
708cad6b28 Add DownloadHelper.createMediaSource utility method
PiperOrigin-RevId: 245243488
2019-04-26 18:33:02 +01:00
andrewlewis
009d629650 Check codec profiles/levels for VP9
Also add some unit tests for codecs strings parsing.

PiperOrigin-RevId: 245210490
2019-04-26 18:31:45 +01:00
eguven
0ff47a8c0d Add DownloadService SET_REQUIREMENTS action
PiperOrigin-RevId: 245014381
2019-04-26 18:31:26 +01:00
olly
d60b6d64ab Migrate from containsAllOf to containsAtLeast.
The two behave identically, and containsAllOf is being removed.

More information:
  go/containsall-lsc

Tested:
    TAP --sample for global presubmit queue
    http://test/OCL:244737393:BASE:244782138:1555991083653:3080d7c7
PiperOrigin-RevId: 244886736
2019-04-26 18:31:06 +01:00
olly
ba94f9dc01 Migrate from isNotSameAs to isNotSameInstanceAs.
The two behave identically, and isNotSameAs is being removed.

More information:
  go/issameas-lsc

Tested:
    TAP --sample for global presubmit queue
    http://test/OCL:244736857:BASE:244751659:1555988098671:1e0f72c5
PiperOrigin-RevId: 244886651
2019-04-26 18:30:46 +01:00
eguven
03313fb5e2 Add option to add entries in an ActionFile to DownloadIndex as completed
PiperOrigin-RevId: 244864742
2019-04-26 18:30:27 +01:00
tonihei
06586b75b0 Fix bug which logs errors twice if stack traces are disabled.
Disabling stack trackes currently logs messages twice, once with and once
without stack trace.

PiperOrigin-RevId: 244853127
2019-04-26 18:30:08 +01:00
tonihei
4507c6870d Move away from AndroidX bundled Truth to be closer to head revision.
The AndroidX bundled version (0.42) lags behind the most up-to-date public
release (0.44) making it more difficult to stay close to the actual head
revision which is used internally.

PiperOrigin-RevId: 244848568
2019-04-26 18:29:49 +01:00
tonihei
3acd8a6048 Remove unused PlaybackInfo.resetToNewPosition
PiperOrigin-RevId: 244838165
2019-04-26 18:29:30 +01:00
tonihei
9441f72445 Always update loading period in handleSourceInfoRefreshed.
This ensures we keep the loading period in sync with the the playing period in
PlybackInfo, when the latter changes to something new.

PiperOrigin-RevId: 244838123
2019-04-26 18:29:11 +01:00
tonihei
9725132e3c Update default min duration for playbacks with video to match max duration.
Experiments show this is beneficial for rebuffers with only minor impact
on battery usage.

Configurations which explicitly set a minimum buffer duration are unaffected.

Issue:#2083
PiperOrigin-RevId: 244823642
2019-04-26 18:28:32 +01:00
andrewlewis
b01075f325 Play out remaining data on reconfiguration
Before this change we'd release the audio track and create a new one as soon
as audio processors had drained when reconfiguring.

Fix this behavior by stop()ing the AudioTrack to play out all written data.

Issue: #2446
PiperOrigin-RevId: 244812402
2019-04-26 18:27:53 +01:00
olly
748a29e8f5 Further improve DownloadService action names & methods
- We had buildAddRequest and sendNewDownload. Converged to
  buildAddDownload and sendAddDownload.
- Also fixed a few more inconsistencies, and brought the
  action constants into line as well.

PiperOrigin-RevId: 244274041
2019-04-18 23:45:49 +01:00
olly
bab7b9e9a1 Fix lint warnings for 2.10
PiperOrigin-RevId: 244268855
2019-04-18 23:24:49 +01:00
olly
864b59080a Clean up database tables for launch
PiperOrigin-RevId: 244267255
2019-04-18 23:24:30 +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
olly
0ccda60ab4 Support multiple DefaultDownloadIndex instances
PiperOrigin-RevId: 244226680
2019-04-18 23:23:52 +01:00
olly
e9413b0d41 Simplify DownloadManager constructors
PiperOrigin-RevId: 244223870
2019-04-18 23:23:33 +01:00