2126 Commits

Author SHA1 Message Date
olly
af8f67c068 Don't print warning when skipping RIFF and FMT chunks
They're not unexpected!

PiperOrigin-RevId: 260907687
2019-08-01 20:35:25 +01:00
tonihei
6f2e24915d Add @NonNullApi and annotate two packages with it.
This new annotation declares everything as non-null by default and can be
used as a package annotation in package-info.java.

In this change the core lib offline package and the mediasession extension is
annotated that way as initial example usage.

PiperOrigin-RevId: 260894548
2019-08-01 20:35:06 +01:00
olly
78350cd17d Update javadoc for TrackOutput#sampleData to make it more clear that implementors aren't expected to rewind with setPosition()
PiperOrigin-RevId: 260718614
2019-08-01 20:34:47 +01:00
tonihei
ce2e2797cb Improve DefaultMediaClock behaviour.
DefaultMediaClock has currently two non-ideal behaviours:
1. One part of checking if it should use the renderer clock is checking whether
   the associated renderer finished reading its stream. This only makes sense
   if the renderer isn't already reading ahead into the next period. This can
   be solved by forwarding if we are reading ahead to the sync command.
2. When switching from stand-alone to renderer clock we assume they are
   exactly at the same position. This is true in theory, but in practise there
   may be small differences due to the different natures of these clocks. To
   prevent jumping backwards in time, we can temporarily stop the stand-alone
   clock and only switch once the renderer clock reached the same position.

PiperOrigin-RevId: 260690468
2019-08-01 20:34:28 +01:00
tonihei
39d5867c97 Make blocking fixed track bandwidth the default and remove experimental flag.
PiperOrigin-RevId: 260682878
2019-08-01 20:34:08 +01:00
aquilescanta
40926618ad Return the removed media source from ConcatenatingMediaSource.removeMediaSource
PiperOrigin-RevId: 260681773
2019-08-01 20:33:48 +01:00
andrewlewis
3051e5e9ad Ensure the SilenceMediaSource position is in range
Issue: #6229
PiperOrigin-RevId: 260500986
2019-07-29 21:28:06 +01:00
olly
d77d661e52 Default viewport constraints to match primary display
PiperOrigin-RevId: 260479923
2019-07-29 21:27:46 +01:00
tonihei
7703676c87 Swap reading and playing media period updates.
Both periods are rarely updated in the same iteration. If they are, advancing
the reading period first seems more logical and also more efficient as it may
avoid one extra doSomeWork iteration.

PiperOrigin-RevId: 260463735
2019-07-29 21:27:25 +01:00
tonihei
846e0666df Restructure updatePeriods code for better readability.
Moved update of reading and playing periods in their own respective method.
This is a no-op change.

PiperOrigin-RevId: 260463668
2019-07-29 21:27:06 +01:00
olly
09835c454b Bump version to 2.10.4
PiperOrigin-RevId: 260164426
2019-07-27 22:54:38 +01:00
andrewlewis
6f7b765a1c Fix handling of channel count changes with speed adjustment
When using speed adjustment it was possible for playback to get stuck at a
period transition when the channel count changed: SonicAudioProcessor would be
drained at the point of the period transition in preparation for creating a new
AudioTrack with the new channel count, but during draining the incorrect (new)
channel count was used to calculate the output buffer size for pending data from
Sonic. This meant that, for example, if the channel count changed from stereo to
mono we could have an output buffer size that stored an non-integer number of
audio frames, and in turn this would cause writing to the AudioTrack to get
stuck as the AudioTrack would prevent writing a partial audio frame.

Use Sonic's current channel count when draining output to fix the issue.

PiperOrigin-RevId: 260156541
2019-07-27 22:54:19 +01:00
olly
9c41bcfe24 Add A10-70L to output surface workaround
Issue: #6222
PiperOrigin-RevId: 260146226
2019-07-26 16:34:39 +01:00
sofijajvc
1b9e2497ff Add comment about AV1 levels
PiperOrigin-RevId: 259918196
2019-07-26 16:34:01 +01:00
tonihei
074307dd4c Improve knowledge of last playing period in AnalyticsCollector.
We keep track of the last publicly known playing period to report it as part
of events happening after the period has been released.

In cases where a period briefly becomes the playing one and is released
immediately afterwards, we currently don't save it as the "last known playing
one". Improve that by saving an explicit reference.

Issue:#5407
PiperOrigin-RevId: 259737218
2019-07-26 16:33:41 +01:00
tonihei
59331c3c88 Report mediaPeriodCreated/Released in MaskingMediaSource.
Creating a period in MaskingMediaSource may result in delayed event reporting
depending on when the actual period gets created. To avoid event reporting
inaccuracies, report the mediaPeriodCreated and mediaPeriodReleased events
directly.

Issue:#5407
PiperOrigin-RevId: 259737170
2019-07-26 16:33:22 +01:00
tonihei
a0ca79abcc Fix doc for preferred audio and text language.
Both tags allow any BCP47 compliant code, not just the ISO 639-2/T ones.

PiperOrigin-RevId: 259714587
2019-07-24 12:34:11 +01:00
tonihei
e84d88e90f Simplify and improve text selection logic.
This changes the logic in the following ways:
 - If no preferred language is matched, prefer better scores for the selected
   audio language.
 - If a preferred language is matched, always prefer the better match
   irrespective of default or forced flags.
 - If a preferred language score and the isForced flag is the same, prefer
   tracks with a better selected audio language match.

PiperOrigin-RevId: 259707430
2019-07-24 12:33:55 +01:00
Toni
feb807897f Merge pull request #6178 from xirac:feature/text-track-score
PiperOrigin-RevId: 259707359
2019-07-24 12:33:39 +01:00
andrewlewis
7d2bfdfc62 Add AudioFocusGain IntDef in AudioFocusManager
PiperOrigin-RevId: 259687632
2019-07-24 12:33:19 +01:00
tonihei
39574b5a61 Make one of the ExoPlayerTest tests more sensible.
Some variables were defined although they are the default and other things
were set-up in a non-sensible way, e.g. asserting that audio is selected
although no audio renderer is available, or using unset duration for
everything.

PiperOrigin-RevId: 259532782
2019-07-23 23:17:31 +01:00
aquilescanta
3c3777d4de Fix release of DecryptableSampleQueueReaders in ProgressiveMediaPeriod
PiperOrigin-RevId: 259523450
2019-07-23 23:16:52 +01:00
andrewlewis
e6bafec418 Deduplicate ID3 header constants
PiperOrigin-RevId: 259479785
2019-07-23 23:16:13 +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
Yannick RUI
8b554dc30a Improve code readability and fix an issue with text tracks that should not be selected 2019-07-19 08:38:47 +02:00
Oliver Woodman
0e7f015020 Merge pull request #6042 from Timbals:dev-v2
PiperOrigin-RevId: 258812820
2019-07-18 19:40:36 +01:00
olly
421f6e0303 Add AV1 HDR profile recognition
Recognize AV1ProfileMain10HDR when getting codec profile and level.

PiperOrigin-RevId: 258799457
2019-07-18 19:40:13 +01:00
tonihei
08624113d4 Correctly mask playback info changes in ExoPlayerImpl.
PlaybackInfo changes are one of the last ones not masked and reported in the same
way as all other changes.

The main change to support this is to also mask the parameters set in
DefaultAudioSink.

PiperOrigin-RevId: 258787744
2019-07-18 19:39:53 +01:00
tonihei
aeb2fefe48 Further language normalization tweaks for API < 21.
1. Using the Locale on API<21 doesn't make any sense because it's a no-op
   anyway. Slightly restructured the code to avoid that.
2. API<21 often reports languages with non-standard underscores instead of
   dashes. Normalize that too.
3. Some invalid language tags on API>21 get normalized to "und". Use original
   tag in such a case.

Issue:#6153
PiperOrigin-RevId: 258773463
2019-07-18 19:39:33 +01:00
andrewlewis
e4f849076c Remove unused extractor constructors
PiperOrigin-RevId: 258754710
2019-07-18 14:16:49 +01:00
olly
c67f18764f Move Format equality check back to write side of sample queue
PiperOrigin-RevId: 258752996
2019-07-18 14:16:29 +01:00
olly
e25340be3d Pass format instead of codec string when getting profile and level
AV1 profile recognition requires additional info contained in format.

PiperOrigin-RevId: 258746315
2019-07-18 14:16:09 +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
80d5dabd52 Fix DataSchemeDataSource re-opening and range requests
Issue:#6192
PiperOrigin-RevId: 258592902
2019-07-18 14:15:31 +01:00
andrewlewis
bee35ed9d7 Fix DeprecationMismatch errors
PiperOrigin-RevId: 258590215
2019-07-18 14:15:12 +01:00
tonihei
049f3cf5cd Keep default start position (TIME_UNSET) as content position for preroll ads.
If we use the default start position, we currently resolve it immediately
even if we need to play an ad first, and later try to project forward again
if we believe that the default start position should be used.

This causes problems if a specific start position is set and the later
projection after the preroll ad shouldn't take place.

The problem is solved by keeping the content position as TIME_UNSET (= default
position) if an ad needs to be played first. The content after the ad can
then be resolved to its current default position if needed.

PiperOrigin-RevId: 258583948
2019-07-18 14:14:52 +01:00
olly
1a479387f2 Fix the equals check
PiperOrigin-RevId: 258574110
2019-07-18 14:14:33 +01:00
olly
a3ded59f28 Check codec profile/level for AV1
Add appropriate unit tests.

PiperOrigin-RevId: 258552404
2019-07-18 14:14:14 +01:00
olly
5e4f52541d Extend RK video_decoder workaround to newer API levels
Issue: #6184
PiperOrigin-RevId: 258527533
2019-07-18 14:13:55 +01:00
tonihei
01376443b3 Add MediaSource.enable/disable.
These methods helps to indicate that a media source isn't used to create new
periods in the immediate term and thus limited resources can be released.

PiperOrigin-RevId: 258373069
2019-07-18 14:13:36 +01:00
olly
7760eca238 Deep compare formats in SampleMetadataQueue instead of shallow compare
PiperOrigin-RevId: 258285645
2019-07-18 14:12:55 +01:00
tonihei
2b5c42e027 Fix some inline parameter name comments.
The name of this parameter recently changed in 3fe0b1a6fe and I forgot
to change these inline comment usages.

PiperOrigin-RevId: 258160659
2019-07-18 14:12:11 +01:00
Yannick RUI
1909987dc8 Change all the conditions and scores that are currently in the constructor of TextTrackScore to comparisons in TextTrackScore.compareTo 2019-07-15 16:05:01 +02:00
Yannick RUI
af98883a7b Reintroducing existing logic as requested here https://github.com/google/ExoPlayer/pull/6178#pullrequestreview-261298162 2019-07-15 11:35:32 +02:00
tonihei
bbcd1126b2 Remove DownloadService from nullness blacklist.
PiperOrigin-RevId: 258038961
2019-07-14 16:25:37 +01:00
tonihei
3fe0b1a6fe Rename SourceInfoRefreshListener to MediaSourceCaller.
This better reflects its usage as a caller identifier and not just a listener.

PiperOrigin-RevId: 257827188
2019-07-14 16:25:18 +01:00
aquilescanta
510f1883b0 Plumb DrmSessionManager into ProgressiveMediaSource
PiperOrigin-RevId: 257777513
2019-07-14 16:24:59 +01:00
tonihei
df81bd6a68 Make ExtractorMediaSource a CompositeMediaSource instead of just wrapping.
It's easy to forget to forward methods when using basic wrapping. For example,
ExtractorMediaSource.addEventListener is currently a no-op because it's not
forwarded.

PiperOrigin-RevId: 257757556
2019-07-14 16:24:39 +01:00
tonihei
ccc82cdb4a Remove some remaining references to manifests.
PiperOrigin-RevId: 257757496
2019-07-14 16:24:21 +01:00
Oliver Woodman
56a922c121 Merge pull request #6151 from ittiam-systems:bug-5527
PiperOrigin-RevId: 257668797
2019-07-14 16:24:02 +01:00