19394 Commits

Author SHA1 Message Date
tonihei
fdaf9b47df Use more targeted listening in session PlayerActivity
The current metadata updates are triggered by item transitions,
but depending on the speed of loading the playlist, the first
metadata may only be known later via metadata-change callbacks.

Slow playlist loading also means the UI stays empty and it's
beneficial to show a placeholder to avoid the impressions the
UI hangs.

Finally, clean-up by removing unused string constants and merging
all listeners into onEvents

#minor-release

PiperOrigin-RevId: 571951529
(cherry picked from commit fd81c904e11c47dcd7694e9b2f610914d4cf2596)
2023-10-23 13:13:46 +01:00
ibaker
99ea703455 Fix the asset and dump file names for the standalone TTML DASH test
#minor-release

PiperOrigin-RevId: 571941997
(cherry picked from commit 33c151eb5b5ce85e554215af0c1d860b66c66fab)
2023-10-23 13:13:46 +01:00
christosts
3ba8459624 Report dropped frames from the VideoSink
After 4fad529433, MediaCodecVideoRenderer does not report if frames
are dropped from the VideoSink. This commit fixes this.

#minor-release

PiperOrigin-RevId: 571905721
(cherry picked from commit 05b17b543060c1f32ae7af212e5e8b33203bdadd)
2023-10-23 13:13:46 +01:00
ibaker
1818d46077 Return true from CuesResolver.addCues if the output changed
This belongs in the resolver, because it depends on the resolution
algorithm (and therefore the logic can't live in `TextRenderer`).

This also fixes a bug in `TextRenderer` where we were doing arithmetic
with `cues.durationUs` without checking if it was `TIME_UNSET` first.

#minor-release

PiperOrigin-RevId: 571332750
(cherry picked from commit 272428734b79ac6857a4333ede2b12563f8b78de)
2023-10-23 13:13:46 +01:00
ibaker
6ad54d72ad Update TextRenderer to handle CuesWithTiming instances directly
The existing `Subtitle` handling code is left intact to support the
legacy post-`SampleQueue` decoding path for now.

This also includes full support for merging overlapping `CuesWithTiming`
instances, which explains the test dump file changes, and which should
resolve the following issues (if used with the
decoder-before-`SampleQueue` subtitle logic added in
5d453fcf37):

* Issue: google/ExoPlayer#10295
* Issue: google/ExoPlayer#4794

It should also help resolve Issue: androidx/media#288, but that will also require
some changes in the DASH module to enable pre-`SampleQueue` subtitle
parsing (which should happen soon).

PiperOrigin-RevId: 571021417
(cherry picked from commit 002ee0555dc35dce9570f1a991b33ec92743db10)
2023-10-23 13:13:42 +01:00
jbibik
c16accb816 Update RELEASENOTES.md for 1.2.0-beta01 release
PiperOrigin-RevId: 571941830
(cherry picked from commit 62ad1dfdf5699b72f5f218c9cabcf73fb1a9f070)
1.2.0-beta01
2023-10-17 15:57:14 +01:00
jbibik
ef013c04ab Bump Media3 version numbers for 1.2.0-beta01 release
#minor-release

PiperOrigin-RevId: 572003628
(cherry picked from commit 97645a200d6abcdbacd1805ef149b5f2b02943c0)
2023-10-09 22:47:37 +01:00
michaelkatz
f776021dcc Deflake RTSP keep-alive monitor test
Alters RTSP KeepAlive monitor test to just make sure that keep-alive message is sent.

The test was added in 42c1846984

#minor-release

PiperOrigin-RevId: 571349013
(cherry picked from commit 417970f7132ab9fd539ba692309e29050b7001d5)
2023-10-06 19:20:13 +01:00
jbibik
efb8c70a4b Add multidex Gradle dependency to test-session-current
#minor-release

PiperOrigin-RevId: 571347856
(cherry picked from commit e63be0317f2152398174bb01c3ea134a0883da10)
2023-10-06 19:20:13 +01:00
michaelkatz
f43d0f187a Update cached playbackHeadPosition when pausing after AudioTrack.stop()
In some streaming scenarios, like offload, the sink may finish writing buffers a bit before playback reaches the end of the track. In this case a player may pause while in this 'stopping' state.

The AudioTrackPositionTracker needs to update the cached values it uses to calculate position in the `PLAYSTATE_STOPPED`/`PLAYSTATE_STOPPING` states if pause/play are called during this period.

PiperOrigin-RevId: 571345914
(cherry picked from commit a789db5b41d9d7a671e83a488b3dec372eaa8b3d)
2023-10-06 19:20:13 +01:00
michaelkatz
5d0d30a280 Allow pause if in offload mode after writing all buffers
In offload mode, `AudioTrack#stop()` will put the track in `PLAYSTATE_STOPPING` rather than `PLAYSTATE_STOPPED`. The difference in state means that `AudioTrack` can be paused and played during this 'stopping' period.

Currently, if `AudioTrackPositionTracker#handleEndOfStream()` has been called then `DefaultAudioSink` in `pause()` won't call `AudioTrack#pause()`. `AudioTrack#pause()` should be called in this case if in offload mode.

#minor-release

PiperOrigin-RevId: 571335108
(cherry picked from commit ab42d64d6d5f1859f1c45aebfe26060978b864bd)
2023-10-06 19:20:12 +01:00
bachinger
da5a743175 Add MEDIA_PLAY_FROM_SEARCH to manifest of session demo app
This is required to make GMS send voice commands to the app.

#minor-release

PiperOrigin-RevId: 571326122
(cherry picked from commit 78f403aa7b795e0e3bcd2f4682bef171f545d4fa)
2023-10-06 15:57:25 +01:00
tonihei
7e9ca0bf74 Deprecate decode-only flag.
The flag is no longer used by our components and only set and checked
in a few places to guarantee compatiblity with existing renderers and
decoders that still use it.

The flag will be removed in the future due to its design limitations.

#minor-release

PiperOrigin-RevId: 571291168
(cherry picked from commit 89d01981bc4cf9218e73bcce1b52c7afe29fbecd)
2023-10-06 15:57:25 +01:00
tonihei
03008b966d Remove release notes lines added by merge conflict
#minor-release

PiperOrigin-RevId: 571005643
(cherry picked from commit 49b1e0bbc2a82f3b9c6ba0a1696ee0b1e53673ec)
2023-10-06 15:57:25 +01:00
ibaker
dad362b414 Add tests for CuesWithTiming.endTimeUs
#minor-release

PiperOrigin-RevId: 570988195
(cherry picked from commit 6057b59723ce6e45ec8a68007eff6687956a9a73)
2023-10-06 15:57:25 +01:00
tofunmi
a4582be2c1 Change equalTo check in ImagePlaybackTest to atLeast
The aim of this test is to make sure the image is onscreen for the right amount of time, so to drive down flakes from the decoder taking too long, change this to an atLeast check

#minor-release

PiperOrigin-RevId: 570988044
(cherry picked from commit 9cc75ca52e49792bed43e4d8fbf67b9a0576fdc0)
2023-10-06 15:57:25 +01:00
tonihei
3c414fcde4 Update documentation wrongly referencing the decode-only flag
#minor-release

PiperOrigin-RevId: 570973457
(cherry picked from commit 87f1b4252ec2d342a153e49aac19455cb91655d1)
2023-10-06 15:57:25 +01:00
samrobinson
fbb64e2db2 Remove experimental keepAudioTrackOnSeek.
PiperOrigin-RevId: 570966027
(cherry picked from commit 068d420ba2d27847c5c581d851ff6a5e1ec45611)
2023-10-06 15:57:25 +01:00
michaelkatz
21c714d8d4 Use RTSP Setup response timeout value in KeepAliveMonitor intervalMs
Set KeepAliveMonitor to send a keep-alive message at half the timeout value, if provided, by the RTSP Setup response.

Issue: androidx/media#662
PiperOrigin-RevId: 570946237
(cherry picked from commit 42c1846984fc8ebca5cdbdcf6df8d2dca44eea96)
2023-10-06 15:57:25 +01:00
ibaker
1a0000db1d Add CuesWithTiming.endTimeUs
In most cases this is more useful than `durationUs`.

We will keep `durationUs`, and the constructor will continue to take
`startTimeUs` and `durationUs`, to allow for use-cases where we don't
know the start time but still want to indicate a duration (this will be
used to implement CEA-608 timeout).

#minor-release

PiperOrigin-RevId: 570944449
(cherry picked from commit bf7b91e57e477f71644d5e585e0e999deadf7fa3)
2023-10-06 15:57:25 +01:00
tonihei
df85a996ba Add Decoder.setOutputStartTimeUs and use it in extension decoders
This gets rid of the reliance on the decode only flag that is still
set on input buffers to the decoder if they are less than the start
time.

We still need to set and check the decode-only flag in SimpleDecoder
to ensure compatbility with custom decoders that use the flag while
it's not fully removed.

PiperOrigin-RevId: 570736692
(cherry picked from commit a03e20fe6c423389d54eb08d3b1f1d19499a0d9a)
2023-10-06 15:57:25 +01:00
tonihei
7bfddf9558 Remove wrong Javadoc
The corresponding logic has been removed in 796781d4c3

#minor-release

PiperOrigin-RevId: 570729509
(cherry picked from commit 64fe863f315bbc870b347c4d9ea8009fb7713773)
2023-10-06 15:57:25 +01:00
tonihei
889739d33e Replace ENCODING_DTS_UHD_P2 value by reference to platform constant
#minor-release

PiperOrigin-RevId: 570696505
(cherry picked from commit 9ef1c20e7af4cc483e3ab408218545b182c1a28e)
2023-10-06 15:57:25 +01:00
tofunmi
c99c71b5a4 Update getName of BitmapFactoryImageDecoder
cleanup from 8f5835c51c

#minor-release

PiperOrigin-RevId: 570663437
(cherry picked from commit 572fb4676cd8ce5b40c8ab044aeb2250390f1c17)
2023-10-06 15:57:25 +01:00
tonihei
6d2bf513fb Add onAudioTrackInitialized/Released events
This is useful for analytics and understanding player behavior
during transitions.

#minor-release

PiperOrigin-RevId: 570623227
(cherry picked from commit 8e2bf21011c63e2ca2fc58c4353cd66930b621e3)
2023-10-06 15:57:25 +01:00
rohks
55633658c6 Add nullness annotations to DecoderVideoRenderer
Also fixed a bug where format queue was polled with wrong timestamp value.

#fixit

PiperOrigin-RevId: 570420304
(cherry picked from commit a879bae1ee2c684e8100f50bcff39655d46a2e8d)
2023-10-06 15:57:25 +01:00
rohks
7957554442 Add nullness annotations to MediaCodecRenderer
#fixit

PiperOrigin-RevId: 570403923
(cherry picked from commit 7a91474af9f84595743655b18f4164e193bf2fc1)
2023-10-06 15:57:25 +01:00
tonihei
0480b70f36 Move decode-only handling out of MetadataDecoder interface logic
The interface requires the implementation to return null if the
decode-only flag is set. So instead of setting the flag and returning
null, we can simply not call the method and assume it's null.

The only reason where this wouldn't work is if the metadata format
has keyframe-like logic and requires previous metadata to decode
the next one. This is not something we came across before and it seems
ignorable. If that feature is needed in the future, we should instead
add a method to MetadataDecoder to set the first output timestamp.

#minor-release

PiperOrigin-RevId: 570399838
(cherry picked from commit 796781d4c365e31a196c96e0588e4ff5ff0e3bf0)
2023-10-06 15:57:25 +01:00
michaelkatz
2564c11834 Disable offload scheduling at set up for track transition
While sleeping for offload, position is estimated based on time playing. If asleep and AudioTrack is reused, then the position will keep incrementing as the subsequent item plays. That is until wakeup when playing position is updated to the timestamp of the second item. Offload scheduling should be disabled until track transitions fully.

PiperOrigin-RevId: 570397140
(cherry picked from commit da06bf057a230293c8fb7f06cbfba71df8c4b5b1)
2023-10-06 15:57:24 +01:00
jbibik
e4637d82b7 Add DashPlayback test with sideloaded TTML subtitles
The test is hidden behind the Ignore annotation due to some flakiness just like `webvttInMp4`. However, it will be removed when the subtitle parsing is moved to a pre-sample-queue architecture.

#minor-release

PiperOrigin-RevId: 570376275
(cherry picked from commit bd5a3920b85423f1c1b625369fd606a9f36e1248)
2023-10-06 15:57:24 +01:00
jbibik
484339e3e6 Add Dumper support for outputting multiline strings
PiperOrigin-RevId: 570348425
(cherry picked from commit b83f12c4ba5f7adac388f003596214b03d1d9358)
2023-10-06 15:57:24 +01:00
tonihei
bc3dded868 Explicitly mark DecoderOutputBuffer as shouldBeSkipped if needed
In some cases, SimpleDecoder output needs to be skipped for rendering
because the decoder produces no data. This is one of the remaining
usages of BUFFER_FLAG_DECODE_ONLY at the moment and can be more
directly solved without using the flag. SimpleDecoder still needs to
check the flag though for backwards compatbility with custom decoders
while the flag is not completely removed.

PiperOrigin-RevId: 570345233
(cherry picked from commit c8aac24ffd8bfe708d68a251a9f28b3b48bed50c)
2023-10-06 15:57:24 +01:00
samrobinson
27d6a9bcbd Deprecate experimental keepAudioTrackOnSeek methods.
#minor-release

PiperOrigin-RevId: 570340714
(cherry picked from commit 1bb501ab5046cfb7c9e21302cd3a0d73c176512c)
2023-10-06 15:57:24 +01:00
ibaker
ffe65b358f Fix Util.scaleLargeValue/Timestamp to handle negative numbers
#minor-release

PiperOrigin-RevId: 570337535
(cherry picked from commit 9edbfa974aeab851065655e09e8c1accf51a009c)
2023-10-06 15:57:24 +01:00
Copybara-Service
948491f665 Merge pull request #574 from hugohlln:main
PiperOrigin-RevId: 570037211
(cherry picked from commit b06d82323865870e5c3572e867d3cc165200e497)
2023-10-06 15:57:24 +01:00
christosts
ecfddb9aeb MediaCodeVideoRenderer: flush video sink before codec
When seeking, we must first flush the video sink so it stops
using any SurfaceTextures before flushing MediaCodec.

#minor-release

PiperOrigin-RevId: 570015998
(cherry picked from commit 144bd7223626a2936368cbcb3bf3f7004ebe5e45)
2023-10-06 15:57:24 +01:00
ibaker
1c7b426ccb Mark test_session_current support app as MultiDexApplication
PiperOrigin-RevId: 570015354
(cherry picked from commit e9bf41ca044368f6833984a38b0f7804ce9b1960)
2023-10-06 15:57:24 +01:00
bachinger
4acce9bcae Update playlist UI when playlist is updated
When changing the playlist on Android Auto the UI of the
activity needs to be kept in sync.

PiperOrigin-RevId: 569528785
(cherry picked from commit 52d9fbff73cddd5c0881f6fd53a6ba35220d0ed1)
2023-10-06 15:57:24 +01:00
oceanjules
12332a4afc Remove FfmpegVideoRenderer from Media3 1.2.0 release 2023-10-04 13:13:58 +01:00
ibaker
8f5835c51c Rename DefaultImageDecoder to BitmapFactoryImageDecoder
This reflects the documented behaviour of this class.

#minor-release

PiperOrigin-RevId: 569475137
2023-09-29 06:27:24 -07:00
claincly
34dddfe9d5 Add previewing specific video graph.
PiperOrigin-RevId: 569473178
2023-09-29 06:16:16 -07:00
christosts
0b4638af15 ExportTest: make 8K asset and trim
Move remote 8K file to local and trim to 320ms.

Trim done with ffmpeg:

`ffmpeg -i {remote_file} -t 0.3 -c:v copy -c:a copy 8k24fps_300ms.mp4`

PiperOrigin-RevId: 569449962
2023-09-29 04:07:40 -07:00
bachinger
cbd23925d5 Add demos/session-automotive module
This change also enables Android Auto support for the
session demo.

PiperOrigin-RevId: 569448376
2023-09-29 04:00:58 -07:00
bachinger
a3b1661513 Bump Media3 version numbers for 1.2.0-alpha02
PiperOrigin-RevId: 569269992
2023-09-28 13:15:46 -07:00
ibaker
d50f662b10 Mark DefaultImageDecoder.BitmapDecoder as @VisibleForTesting
It seems likely we will define a new "image decoder" interface that
returns `ListenableFuture<Bitmap>`, and naming that will be
hard/annoying if we need to keep this interface working too.

It's also not really clear what a non-test implementation of this
interface would be expected to do, since `DefaultImageDecoder` is
documented to always decode using `BitmapFactory`.

#minor-release

PiperOrigin-RevId: 569206325
2023-09-28 09:33:59 -07:00
Copybara-Service
6d77838a6b Merge pull request #675 from shanujshekhar:shanujs/add-new-apis-exomediadrm
PiperOrigin-RevId: 569205163
2023-09-28 09:31:14 -07:00
claincly
cd6f8a42a5 Move Single/MultiVideoGraph impl to effect
PiperOrigin-RevId: 569188658
2023-09-28 08:27:06 -07:00
Ian Baker
a1767d349a Fix review comments 2023-09-28 15:57:13 +01:00
ibaker
d716de02aa Suppress lint in PlayerControlView and TrackSelectionDialogBuilder
PiperOrigin-RevId: 569165562
2023-09-28 06:48:54 -07:00
bachinger
db26b378f8 Update release notes for 1.2.0-alpha02
PiperOrigin-RevId: 569161165
2023-09-28 06:29:42 -07:00