18709 Commits

Author SHA1 Message Date
rohks
7352a1be0a Add field measured throughput (mtp)
Updated `ExoTrackSelection` to provide the most recent bitrate estimate, enabling the inclusion of measured throughput (mtp) as a CMCD-Request field in Common Media Client Data (CMCD) logging.

Additionally, made changes to the `checkArgument` methods in `CmcdLog` to prevent the use of default values in certain cases.

PiperOrigin-RevId: 549369529
(cherry picked from commit cdb174c91a0a9e5387f9773ac24f015199a7999e)
2023-07-19 19:10:56 +01:00
rohks
6443614020 Add fields top bitrate(tb) and object duration(d)
Added these CMCD-Object fields to Common Media Client Data (CMCD) logging.

PiperOrigin-RevId: 548950296
(cherry picked from commit 1b2a2fcde00c5bd05573e777c4e8a2bf60db7137)
2023-07-18 11:24:34 +01:00
tonihei
3931c28697 Fix race condition in clipped sample streams
The streams return end-of-input if they read no samples, but know that
they are fully buffered to at least the clipped end time. This helps to
detect the end of stream even if there are no new buffers after the end
of the clip (e.g. for sparse metadata tracks).

The race condition occurs because the buffered position is evaluated
after reading the sample. So between reading "no sample" and checking
the buffered position, the source may have loaded arbitrary amounts
of data. This may lead to a situation where the source has not read
all samples, reads NOTHING_READ (because the queue is empty) and then
immediately returns end-of-stream (because the buffered position
jumped forward), causing all remaining samples in the stream to be
skipped. This can fixed by moving the buffered position check to
before reading the sample, so that it never exceeds the buffered
position at the time of reading "no sample".

#minor-release

PiperOrigin-RevId: 548646464
(cherry picked from commit c64d9fd6da90497547daf3deea536af2007784a5)
2023-07-17 12:17:17 +01:00
tonihei
d4c66e549a Remove duplicated release note entry
Issue: androidx/media#515

#minor-release

PiperOrigin-RevId: 548111465
(cherry picked from commit 42998d6400aaf6ce773383be9ed6386a7c56e125)
2023-07-14 14:36:33 +01:00
michaelkatz
09835006f4 Prepend Ogg ID and Comment Header Pages to offloaded Opus stream
Add Ogg ID Header and Comment Header Pages to the Ogg encapsulated Opus for offload playback. This further matches the RFC 7845 spec and provides initialization data to decoders.

PiperOrigin-RevId: 548080222
(cherry picked from commit 847f6f24d3770b6134a233b62a5fa9413c9bd26c)
2023-07-14 11:41:56 +01:00
rohks
57d0c197cc Add tests for DefaultSsChunkSource
Added tests for Common Media Client Data (CMCD) logging in SmoothStreaming(SS)

PiperOrigin-RevId: 548072725
2023-07-14 11:03:05 +01:00
rohks
88e34017a3 Fix dependencies for UI module
PiperOrigin-RevId: 548063325
(cherry picked from commit 4d40f2e7ddfce700e74f759d3ed8143df7f6b0c8)
2023-07-14 10:12:32 +01:00
rohks
77fb6525b1 Replace Dummy with Placeholder
`Dummy` is a non inclusive language.

PiperOrigin-RevId: 547815680
(cherry picked from commit ca10204b2df316c9524e1986cba272b8c855867e)
2023-07-13 16:55:49 +01:00
rohks
272c844abd Add fields streaming format(sf), stream type(st) and version(v)
Added these CMCD-Session fields to Common Media Client Data (CMCD) logging.

PiperOrigin-RevId: 547435498
(cherry picked from commit 0412a36564a09c0a237b91b4a78fed80336ea6b6)
2023-07-12 10:25:50 +01:00
bachinger
7d35f18732 Add custom layout to the state of the MediaController
This change also marks the buttons of the custom layout as
enabled/disabled according to available commands in the controller.
Accordingly, `CommandButton.Builder.setEnabled(boolean)` is deprecated
because the value is overridden by the library.

Issue: androidx/media#38

PiperOrigin-RevId: 547272588
(cherry picked from commit ea21d27a6974822a970261f38964ec86c305796b)
2023-07-11 20:59:01 +01:00
ibaker
996755c22b Expand @UnstableApi javadoc with how to request stable API additions
Issue: androidx/media#503

#minor-release

PiperOrigin-RevId: 547143885
(cherry picked from commit 2afcf9959124ee906b65569e7e4ae0ffb47e88a3)
2023-07-11 11:57:13 +01:00
ibaker
c1261aa266 Remove javadoc @link from non-javadoc comments
Also update type names to match the current names for these types.

PiperOrigin-RevId: 546884049
(cherry picked from commit eed0e42ff805f54161125bbb6983f30ba0d39e8a)
2023-07-10 16:46:18 +01:00
ibaker
bae387651b Clarify that new ConditionVariable instances are closed
#minor-release

PiperOrigin-RevId: 546803592
(cherry picked from commit a8520bdee63509597c19ecf72d96a5da1ecf4a0b)
2023-07-10 10:10:03 +01:00
andrewlewis
405e5a6e3e Fix incorrect class name for MediaPipe demo
Issue: androidx/media#500

#minor-release

PiperOrigin-RevId: 545942450
(cherry picked from commit bdbf3e29a1a49f1be1fd4ada7c36b4ae80c83510)
2023-07-06 12:07:21 +01:00
tonihei
9de5684d6e Change multidex dependency type to androidTestImplementation
This is only needed for instrumentation tests and should not
be included in regular builds.

Issue: androidx/media#499
PiperOrigin-RevId: 545913113
(cherry picked from commit 2250ffe6c8c5fa6b5bc728cd7a9fa075bcbb04d9)
2023-07-06 09:45:11 +01:00
rohks
0c6cfea048 Replace BitArray.skipBytes() with BitArray.skipBits()
Based on the spec, ETSI TS 102 366 V1.4.1 Annex F, 6 bits should have skipped instead of 6 bytes.

This correction was pointed out in Issue: androidx/media#474.

PiperOrigin-RevId: 545658365
(cherry picked from commit 07d4e5986b06ef6e362fe00fb97187469f42bc25)
2023-07-05 15:04:50 +01:00
ibaker
bcde7e03c2 Include timing info in some SCTE-35 toString implementations
This was helpful in investigating Issue: androidx/media#471

PiperOrigin-RevId: 545393217
(cherry picked from commit 3456382ae7116a8bb57b4212f449dfb50ea490d9)
2023-07-04 10:09:27 +00:00
michaelkatz
cb7b3862c4 Add nanoTime method to Clock to support overriding System.nanoTime()
PiperOrigin-RevId: 545237925
(cherry picked from commit de4575da28ee98a46e284cc8c7f11d34da1df29e)
2023-07-03 16:29:13 +00:00
tonihei
26ee4c35f3 Replace exoplayer.dev@gmail.com with android-media-github@google.com
#minor-release

PiperOrigin-RevId: 545165879
(cherry picked from commit 5e19a33095eeebec0dacbbb7e37c6ff5cb78055f)
2023-07-03 09:34:55 +00:00
ibaker
aa34db41f7 CEA-608: Only truncate to 32 visible characters
We introduced truncation to 32 chars in <unknown commit>
and included indent and offset in the calculation. I think this is
technically correct, but it causes problems with the content in
Issue: google/ExoPlayer#11019 and it doesn't seem a problem to only truncate actual
cue text (i.e. ignore offset and indent).

PiperOrigin-RevId: 544677965
(cherry picked from commit e8fdd83558dcb0a4f886c52c8b32e2c1f3637a48)
2023-06-30 16:35:46 +00:00
tonihei
aefba8a565 Remove dead code in ProgressiveMediaSource.Builder
These fields cannot be set and the logic to handle them can be removed.

PiperOrigin-RevId: 544646460
(cherry picked from commit 2f113c8b8234ca80fd0968f845dd195fcf956c6d)
2023-06-30 14:05:39 +00:00
microkatz
3a66617b9e Merge pull request #487 from vishnuchilakala:allow_unsigned_int_for_adaptation_set_id
PiperOrigin-RevId: 544601945
(cherry picked from commit 9513f2c551e73cdb0ffa27401d7817928b99064e)
2023-07-05 08:53:09 +00:00
tianyifeng
52706b2eb4 Ensure that ShuffleOrder has the same length as the current playlist
Add a fail-fast check in `ExoPlayerImpl` to ensure the equality of the lengths of `ShuffleOrder` and the current playlist. Also improve the documentation of `setShuffleOrder(ShuffleOrder)` with explicit instruction on this.

Issue: androidx/media#480

#minor-release

PiperOrigin-RevId: 544009359
(cherry picked from commit d895a46b280f1f9764f63a5fc1ba16ab2727191e)
2023-06-28 10:41:49 +00:00
tonihei
f768fedaee Clarify MediaPeriod.readDiscontinuity Javadoc
It currently wrongly documents that it is only called before reading
streams (that has never been the case and all MediaPeriods already need
to handle calls after reading samples from the streams).

It was also a bit unclear what a discontinuity implies and the new
Javadoc calls out the main use case for discontinuties and the intended
meaning of returning a discontinuity.

#minor-release

PiperOrigin-RevId: 543989124
(cherry picked from commit b324b8aa72db8853cf28429fa6462acdbf769f21)
2023-06-28 08:55:56 +00:00
tianyifeng
7683ee254a Use different package names in DiagnosticInfo for media3 and exoplayer
Issue: androidx/media#476

#minor-release

PiperOrigin-RevId: 543460075
(cherry picked from commit 140c83ce7ef08ed010b474baf1ea31419df766bb)
2023-06-26 16:28:47 +00:00
tonihei
ec13c42800 Do not trim audio samples by changing their timestamp
MP4 edit lists sometimes ask to start playback between two samples.
If this happens, we currently change the timestamp of the first
sample to zero to trim it (e.g. to display the first frame for a
slightly shorter period of time). However, we can't do this to audio
samples are they have an inherent duration and trimming them this
way is not possible.

PiperOrigin-RevId: 543420218
(cherry picked from commit 232246240415443ff8d3a8cd5930273b4085ddaa)
2023-06-26 13:26:35 +00:00
Googler
bf4561c606 Removing @CallSuper from [add,remove]Listener of ForwardingListener.
PiperOrigin-RevId: 543373503
(cherry picked from commit 1fc49ce288809e7634971f9dcb8121fe13e6a854)
2023-06-26 09:11:27 +00:00
jbibik
b220dfe73c Cleaner unified PlayerInfo update method in MediaControllerImplBase
`MediaControllerImplBase` has 2 methods for updating listeners about `PlayerInfo` changes - `updatePlayerInfo` (for masking the state) and `onPlayerInfoChanged` (when communicating with the session). There is a set number of listener callbacks related to `PlayerInfo` updates and both methods should go through the same control flow (whether we know that masking will ignore most of them or not).

A unified method `notifyPlayerInfoListenersWithReasons` encapsulates only the shared logic of 2 methods - listeners' callbacks. This ensures that both methods call them in the same order and none are missed out.

PiperOrigin-RevId: 542587879
(cherry picked from commit c2d80516628e4f62a4ec88ae1240002e6cc85aef)
2023-06-22 16:49:36 +00:00
jbibik
e008e21b0f Fix missing equals sign in inline-comment parameter names
PiperOrigin-RevId: 542577676
(cherry picked from commit ea0f564c1ea409f717c4cc0277d6c7b82eeb84b9)
2023-06-22 16:09:57 +00:00
jbibik
b4c7e6cb86 Order MediaControllerImplBase listener callbacks as in ExoPlayerImpl
The callbacks for `PlayerInfo` changes are currently in both `MediaControllerImplBase.updatePlayerInfo` (masking) and `MediaControllerImplBase.onPlayerInfoChanged`. But the order was different between them both and `ExoPlayerImpl.updatePlaybackInfo` which they are trying to mimic.

#minor-release

PiperOrigin-RevId: 542519070
(cherry picked from commit b8ac5b42107b7d291162558378c2482bb84576f0)
2023-06-22 11:19:48 +00:00
ibaker
4f5d59b58f Switch to SVG assets hosted on developer.android.com for reference docs
#minor-release

PiperOrigin-RevId: 541970884
(cherry picked from commit 34f23451e66ca85a32a072ad4eada271fd79f898)
2023-06-20 17:23:37 +00:00
bachinger
f6a30f6645 Fix ArrayIndexOutOfBoundIndex when re-preparing after exception
When an app tried to re-prepare a live streeam with server side inserted
ad after a playback exception, the player tried to find the ad group by
its index in the ad playback state of the next timeline when creating
the first period.

If a source that supports server side ad, has removed the ad playback
state when the source has been removed, this causes a crash. For live
streams this is a reasonable thing to do given the exception could be
caused by an invalid ad playback state.

This change removes the ad metadata from the current period for live
streams and the timeline. In case the ad playback state is not reset
by the source, the first timeline refresh would ad the metadata again.

PiperOrigin-RevId: 541959628
(cherry picked from commit 4604f0cde691311d8a1104d66e6eb724766ce4b0)
2023-06-20 16:55:22 +00:00
jbibik
4710b8f03a Fixed spelling across various PlayerInfo *ChangeReason fields
PiperOrigin-RevId: 541892788
(cherry picked from commit b9cc70d9e2d0248a10ad209e362db630a051448c)
2023-06-20 13:06:34 +00:00
tonihei
3561258949 Fix spurious sessions created for events after the playlist is cleared
Some events may arrive after the playlist is cleared (e.g. load
cancellation). In this case, the DefaultPlaybackSessionManager may
create a new session for the already removed item.

We already have checks in place that ignore events with old
windowSequenceNumbers, but these checks only work if the current
session is set (i.e. the playlist is non-empty). The fix is to add
the same check for empty playlists by keeping note of the last
removed window sequence number.

PiperOrigin-RevId: 541870812
(cherry picked from commit e0191ddded1754cc31b025493970240aeb08a46e)
2023-06-20 12:27:23 +01:00
Marc Baechinger
7e0296fa7c Merge pull request #436 from jaeho-lee104:feature/improve_condition
PiperOrigin-RevId: 540875285
(cherry picked from commit af69d5822ae4df4a2a9dec2706a49c15f5112d3d)
2023-06-19 16:25:40 +01:00
rohks
f01ca9d9f1 Refactor method CmcdLog.createInstance to accept bufferedDurationUs
Instead of providing `playbackDurationUs` and `loadPositionUs` individually, which are used to calculate the buffer duration for CMCD logging, we can directly pass the pre-calculated `bufferedDurationUs` available in the `getNextChunk` method of the chunk source classes.

Issue: google/ExoPlayer#8699

#minor-release

PiperOrigin-RevId: 540630112
(cherry picked from commit be9b057dda1a6a2da0e57b3b6f3620b371b7fd6e)
2023-06-15 18:55:30 +01:00
rohks
0aede89586 Add CMCD logging when requesting initialization chunk for DASH and HLS
Additionally, two existing methods to `buildDataSpec` in `DashUtil` have been deprecated, while a new method has been added that allows the inclusion of `httpRequestHeaders`.

Issue: google/ExoPlayer#8699

#minor-release

PiperOrigin-RevId: 540594444
(cherry picked from commit 52878b2aca599d7aee3d87d76d602e81b1946d00)
2023-06-15 16:48:55 +01:00
jbibik
2367e7a9e8 Default RepeatMode for conversion is NONE/OFF
Current behaviour causes an app to crash if it receives an unrecognized repeat mode send over the wire. In order to avoid the crash, a sensible default had to be chosen.

For `Player.RepeatMode`, it is `Player.REPEAT_MODE_OFF`, which is the same value we use as default when unbundling `PlayerInfo`.

For `PlaybackStateCompat.RepeatMode`, it is `PlaybackStateCompat.REPEAT_MODE_NONE`, which is what we use in the no-arg `LegacyPlayerInfo` constructor.

Issue: androidx/media#448

#minor-release

PiperOrigin-RevId: 540563792
(cherry picked from commit 501da109ced14c498eeafcd62d1fbe12e6ecc76e)
2023-06-15 14:31:59 +01:00
ibaker
3c9831fcb4 Remove = from parameter args in call to Constructor.newInstance
These comments reflect the parameter names of the constructor that
we're reflectively calling, but errorprone complains that they don't
match the parameter names of `Constructor.newInstance`.

PiperOrigin-RevId: 540348118
(cherry picked from commit 567890da9ed473b32b6e23c2b499e1e40d835487)
2023-06-14 20:32:01 +01:00
siroberts
648e9943e5 Add missing checkNotNull to bitmapLoader.
#minor-release

PiperOrigin-RevId: 540309118
(cherry picked from commit cf21add916538d3debd51f53ab43710d813e7b02)
2023-06-14 18:22:13 +01:00
bachinger
3cfdd4fdc5 Implement equals/hashCode for CommandButton
#minor-release

PiperOrigin-RevId: 540274932
(cherry picked from commit 3d674fa2f39414824871c88dd73246cbeddb95f8)
2023-06-14 16:13:48 +01:00
ibaker
983d9d57d7 Stop suppressing exceptions in MediaCodec.Callback during flush
Previously `AsynchronousMediaCodecCallback.mediaCodecException` was
cleared when flushing completed. This behaviour was changed in
aeff51c507
so now the exception is not cleared.

The result after that commit was that we would **only** suppress/ignore
the expression if a flush was currently pending, and we would throw it
both before and after the flush. This doesn't really make sense, so this
commit changes the behaviour to also throw the exception during the
flush.

This commit also corrects the assertion in
`flush_withPendingError_resetsError` and deflakes it so that it
consistently passes. The previous version of this test, although the
assertion was incorrect, would often pass because the
`dequeueInputBuffer` call would happen while the `flush` was still
pending, so the exception was suppressed.

#minor-release

PiperOrigin-RevId: 540237228
(cherry picked from commit 248d1d99ecd1f3d57b1acc1cdc6f160b3b8aa495)
2023-06-14 13:07:39 +01:00
tonihei
a9b78318ca Add missing @Override
PiperOrigin-RevId: 540220141
(cherry picked from commit c76680a65c8647c9ce153d116e4bfd94da765daa)
2023-06-14 11:26:38 +01:00
jbibik
9dec0d308b Notify listeners of error changes when masking in MediaControllerImplBase
Currently, the implementation of `MediaControllerImplBase` differs from `ExoPlayerImpl`. The listeners of the former are notified of player error changes only in `onPlayerInfoChanged` and not `updatePlayerInfo` (masking method). Whereas `ExoPlayerImpl` has one unified method - `updatePlaybackInfo` - which sends the events to all the available listeners.

This change fixes the lack of 2 particular callbacks - `onPlayerErrorChanged` and `onPlayerError`, however, there might be more differences. Ideally, there should be a unified method for oldPlayerInfo/newPlayerInfo comparison-update-notify-listeners flow.

Issue: androidx/media#449

#minor-release

PiperOrigin-RevId: 539961618
(cherry picked from commit 4b5a4577905d86ec6e24a92a088a65689c7be901)
2023-06-13 15:46:46 +01:00
ibaker
6615399861 Release ExoPlayer instances in ExoPlayerTest
This was recommended in https://github.com/robolectric/robolectric/issues/8187#issuecomment-1552060094

PiperOrigin-RevId: 539691757
(cherry picked from commit 959e97413887fff5096df65783a895803060d31a)
2023-06-12 18:19:56 +01:00
bachinger
c3a96b2e08 Clean up HLS sample for cast demo
Issue: androidx/media#452
#minor-release
PiperOrigin-RevId: 539613535
(cherry picked from commit c2f78db87e9cd4bcf118d6ab1b7e3a7d86ee55e9)
2023-06-12 11:40:30 +00:00
claincly
0cf3ab31bf Factor out video decoding and fix two minor issues
1. Not treating 0 as valid buffer index
2. Not handling the case the last frame is a comparison frame

PiperOrigin-RevId: 539607482
(cherry picked from commit 4b1ac2f17229a31754440693dc06ef583752070a)
2023-06-12 11:05:08 +00:00
ibaker
8ff61a1430 Stop setting -no-module-directories in ExoPlayer javadoc generation
This flag was introduced to fix links in javadoc search when generating
it with Java 11: <unknown commit>

The flag is no longer supported with Java 17 (which is required for
Gradle 8.0+), and seems to no longer be needed: I generated the javadoc
with it removed and the search links work OK.

PiperOrigin-RevId: 536738686
2023-08-11 15:52:04 +00:00
Tofunmi Adigun-Hameed
5328d6464a
Merge pull request #498 from androidx/release-1.1.0
Release 1.1.0
1.1.0
2023-07-05 08:56:12 +00:00
ibaker
00005cb09d Replace exoplayer.dev@gmail.com with android-media-github@google.com
#minor-release

PiperOrigin-RevId: 544596686
(cherry picked from commit f2c0eab468fa683e03323cc7164f450a123d773a)
2023-06-30 10:57:51 +01:00