2261 Commits

Author SHA1 Message Date
tonihei
6617862f0b Add allowAudioMixedChannelCountAdaptiveness parameter to DefaultTrackSelector.
We already allow mixed mime type and mixed sample rate adaptation on request,
so for completeness, we can also allow mixed channel count adaptation.

Issue:#6257
PiperOrigin-RevId: 261930046
2019-08-09 18:33:01 +01:00
olly
fd803a39a3 Further MediaPeriod.selectTracks documentation tweak
PiperOrigin-RevId: 261917229
2019-08-09 18:32:41 +01:00
Yannick RUI
831de75f89 Missing documentation link 2019-08-09 10:42:12 +02:00
Yannick RUI
73d6a0f2bd Automatically show closed captioning/hearing impaired text track 2019-08-08 09:17:55 +02:00
tonihei
a9b93d7ec2 Fix some remaining extension API nullability issues.
PiperOrigin-RevId: 261910303
2019-08-06 15:54:08 +01:00
tonihei
b0330edc0b Fix some Android Studio nullness warning created by new @NonNullApi.
PiperOrigin-RevId: 261888086
2019-08-06 15:53:52 +01:00
ibaker
3b9288b805 Migrate literal usages of 1000 to (new) C.MILLIS_PER_SECOND
This only covers calls to scaleLargeTimestamp()

PiperOrigin-RevId: 261878019
2019-08-06 15:53:37 +01:00
ibaker
4603188165 Add inband emsg-v1 support to FragmentedMp4Extractor
This also decouples EventMessageEncoder's serialization schema from the emesg spec (it happens to still match the emsg-v0 spec, but this is no longer required).

PiperOrigin-RevId: 261877918
2019-08-06 15:53:21 +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
sofijajvc
b6441a02f5 Introduce common output buffer class for video decoders
PiperOrigin-RevId: 261693054
2019-08-05 20:27:04 +01:00
tonihei
d6e74bc19b Ensure position reset keep window sequence number.
We currently keep the sequence number if we don't reset the position. However,
the sequence number should be kept if we don't reset the state. Otherwise
re-prepare with position reset is counted as new playback although it's still
the same.

PiperOrigin-RevId: 261644924
2019-08-05 10:55:04 +01:00
olly
fb0481c520 Bump annotations dependency + update release notes
PiperOrigin-RevId: 261353271
2019-08-02 19:04:56 +01:00
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