2149 Commits

Author SHA1 Message Date
olly
f179feb292 Constraint seek targetGranule within bounds + simplify tests
PiperOrigin-RevId: 261328701
2019-08-02 17:16:45 +01:00
olly
173eadc70e Move DefaultOggSeeker tests into a single class
PiperOrigin-RevId: 261320318
2019-08-02 17:16:07 +01:00
olly
91c62ea26f Fix DefaultOggSeeker seeking
- When in STATE_SEEK with targetGranule==0, seeking would exit
  without checking that the input was positioned at the correct
  place.
- Seeking could fail due to trying to read beyond the end of the
  stream.
- Seeking was not robust against IO errors during the skip phase
  that occurs after the binary search has sufficiently converged.

PiperOrigin-RevId: 261317035
2019-08-02 17:15:28 +01:00
tonihei
851218aca9 Fix AnalyticsCollectorTest flakiness.
Two tests have very low propability flakiness (1:1000) due to not waiting for
a seek in one case and the chance of already being ended in another case.

Fix these and also adjust wrong comments about state changes.

PiperOrigin-RevId: 261309976
2019-08-02 17:14:48 +01:00
sofijajvc
4482db40e1 Move output modes to constants file
PiperOrigin-RevId: 261295173
2019-08-02 17:14:29 +01:00
sofijajvc
39317048e9 Add video decoder exception class
This will be used in common video renderer and decoder classes.

PiperOrigin-RevId: 261287124
2019-08-02 17:14:09 +01:00
tonihei
0887ab059c Remove nullablity of track groups and selections in MediaPeriodHolder.
These values can easily default to the empty track group and the empty
selection. As a result we can remove restrictions about not calling
holder.getTrackGroups before the period finished preparation.

PiperOrigin-RevId: 261280927
2019-08-02 17:13:50 +01:00
andrewlewis
5eab519925 Revert to using header bitrate for CBR MP3s
A previous change switched to calculation of the bitrate based on the
first MPEG audio header in the stream. This had the effect of fixing
seeking to be consistent with playing from the start for streams where
every frame has the same padding value, but broke streams where the
encoder (correctly) modifies the padding value to match the declared
bitrate in the header.

Issue: #6238
PiperOrigin-RevId: 261163904
2019-08-01 20:40:10 +01:00
olly
42d3ca273b Propagate non-standard MIME type aliases
Issue: #5938
PiperOrigin-RevId: 261150349
2019-08-01 20:39:51 +01:00
olly
4c40878b6b Shorten data length if it exceeds length of input
Issue: #6241
PiperOrigin-RevId: 261126968
2019-08-01 20:39:33 +01:00
olly
cb8983afd1 Standardize ALAC initialization data
Android considers ALAC initialization data to consider of the magic
cookie only, where-as FFmpeg requires a full atom. Standardize around
the Android definition, since it makes more sense (the magic cookie
being contained within an atom is container specific, where-as the
decoder shouldn't care what container the media stream is carried in)

Issue: #5938
PiperOrigin-RevId: 261124155
2019-08-01 20:38:55 +01:00
olly
95ed5ce65d Make OggSeeker.startSeek take a granule rather than a time
PiperOrigin-RevId: 261102180
2019-08-01 20:38:37 +01:00
olly
cbc1385fd3 Some no-op cleanup for DefaultOggSeeker
PiperOrigin-RevId: 261102008
2019-08-01 20:38:18 +01:00
bachinger
1bb0703f2b return lg specific mime type as codec supported type for OMX.lge.alac.decoder
ISSUE: #5938
PiperOrigin-RevId: 261097045
2019-08-01 20:37:59 +01:00
sofijajvc
b2c71e8b3f Extract VpxInputBuffer to a common class
This class will be shared by both vp9 and av1 extension.

PiperOrigin-RevId: 261089225
2019-08-01 20:37:40 +01:00
Oliver Woodman
b57aa34b66 Merge pull request #6239 from ittiam-systems:vorbis-picture-parse
PiperOrigin-RevId: 261087432
2019-08-01 20:37:21 +01:00
olly
a2cf427b4b Mp3Extractor: Avoid outputting non-zero position seek frame as a sample
Checking inputPosition == 0 isn't sufficient because the synchronization
at the top of read() may advance the input (i.e. in the case where there's
some garbage prior to the seek frame).

PiperOrigin-RevId: 261086901
2019-08-01 20:36:58 +01:00
tonihei
561949a225 Remove AnalyticsCollector.Factory.
This factory was only needed in the past when we didn't have
AnalyticsCollector.setPlayer. Code becomes easier to use without this factory.

PiperOrigin-RevId: 261081860
2019-08-01 20:36:40 +01:00
olly
526cc72e04 WavExtractor: Skip to data start position if position reset to 0
PiperOrigin-RevId: 260970865
2019-08-01 20:36:21 +01:00
olly
288aa52dec Clean up some Ogg comments & document granulePosition
PiperOrigin-RevId: 260947018
2019-08-01 20:36:02 +01:00
olly
80ab74748d Mp3Extractor: Avoid outputting seek frame as a sample
This could previously occur when seeking back to position=0

PiperOrigin-RevId: 260933636
2019-08-01 20:35:43 +01:00
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
Venkatarama NG. Avadhani
27a4f96cb1 Clean up FLAC picture parsing 2019-07-30 12:15:36 +05:30
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
Venkatarama NG. Avadhani
ea64ecf2c4 Parse Picture Metadata in FLAC 2019-07-29 14:34:35 +05:30
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