838 Commits

Author SHA1 Message Date
Daniele Sparano
fc61d96d5c Replace literal with constant variable 2023-10-17 11:42:32 +00:00
Daniele Sparano
e71ca5a740 Add luma and chroma bit depths to Format, set them as signalled in containers and parameter sets 2023-10-17 11:42:32 +00:00
samrobinson
fe1144487a Parse metadata from srfr atom in SMTA.
PiperOrigin-RevId: 573829216
2023-10-16 09:11:53 -07:00
claincly
37c86f3c15 Enable per-mediaItem effect in CompositionPlayer
Currently the effects are applied one frame too early. This will be fixed in
a later CL.

PiperOrigin-RevId: 573773074
2023-10-16 04:41:22 -07:00
Googler
8b7ebc7032 Remove deprecated DownloadNotificationHelper.buildProgressNotification
Use a non deprecated method that takes a `notMetRequirements` parameter
instead.

#minor-release

PiperOrigin-RevId: 573252909
2023-10-13 10:17:57 -07:00
Tianyi Feng
492048c00b Modify the comment lines 2023-10-12 09:56:28 +00:00
Tianyi Feng
834b61d1b7 Update the year in the copyright 2023-10-12 09:56:28 +00:00
Tianyi Feng
49f45c45d1 Rebase and resolve conflict in the release notes 2023-10-12 09:56:28 +00:00
Tianyi Feng
215f663019 Format with google-java-format 2023-10-12 09:56:28 +00:00
Cedric T
0f200ba5d1 Update nits 2023-10-12 09:56:28 +00:00
Cedric T
24d03b0625 Rename DTSE to DTSHD 2023-10-12 09:56:28 +00:00
Cedric T
7edfe58283 Remove current mimetype state and add DTSHD test cases 2023-10-12 09:56:28 +00:00
Cedric T
25acaa1c81 Fix DTS Express Audio Buffer Underflow Issue. 2023-10-12 09:56:28 +00:00
tofunmi
8f2161c43d Support customized loading in ExternallyLoadedMediaSource
PiperOrigin-RevId: 572299971
2023-10-10 10:44:08 -07:00
ibaker
66fa591959 Add experimental opt-in to parse DASH subtitles during extraction
This currently only applies to subtitles muxed into mp4 segments, and
not standalone text files linked directly from the manifest.

Issue: androidx/media#288

#minor-release

PiperOrigin-RevId: 572263764
2023-10-10 08:53:42 -07:00
tonihei
e5fa0c2ce9 Remove unneccessary method parameter
The value already exists as a class field.

#minor-release

PiperOrigin-RevId: 572200771
2023-10-10 04:09:15 -07:00
tonihei
f20d18e6ca Align audio adaptive support checks with video
In particular:
 - Add allowAudioNonSeamlessAdaptiveness parameter (default true, same
   as video and as already implemented by default)
 - Forward mixedMimeTypeAdaptation support to AudioTrackScore
   (as for VideoTrackScore) and adapt mixed MIME type adaptive
   support accordingly
 - Check adaptive support when deciding whether a track is allowed for
   adaptation (also same check as for video). This takes the new
   parameter into account.

#minor-release

PiperOrigin-RevId: 572191308
2023-10-10 03:18:22 -07:00
christosts
05b17b5430 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
2023-10-09 05:04:51 -07:00
michaelkatz
a789db5b41 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
2023-10-06 08:37:24 -07:00
michaelkatz
ab42d64d6d 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
2023-10-06 07:46:14 -07:00
ibaker
272428734b 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
2023-10-06 07:33:43 -07:00
tofunmi
e5010e3d71 Support updating the mediaItem in ExternallyLoadedMediaSource
PiperOrigin-RevId: 571308986
2023-10-06 05:24:35 -07:00
tofunmi
addfd3e986 Create ExternallyLoadedMediaPeriod and ExternallyLoadedMediaSource
PiperOrigin-RevId: 571292394
2023-10-06 03:54:19 -07:00
tonihei
89d01981bc 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
2023-10-06 03:44:14 -07:00
tonihei
f8d2e362a5 Rename FfmpegVideoRenderer to ExperimentalFfmpegVideoRenderer
This makes it clearer that this class can't be used yet.

PiperOrigin-RevId: 571267898
2023-10-06 01:50:54 -07:00
ibaker
002ee0555d 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).

#minor-release

PiperOrigin-RevId: 571021417
2023-10-05 08:17:23 -07:00
tofunmi
9cc75ca52e 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
2023-10-05 05:49:49 -07:00
tonihei
87f1b4252e Update documentation wrongly referencing the decode-only flag
#minor-release

PiperOrigin-RevId: 570973457
2023-10-05 04:32:40 -07:00
samrobinson
068d420ba2 Remove experimental keepAudioTrackOnSeek.
PiperOrigin-RevId: 570966027
2023-10-05 03:52:51 -07:00
tonihei
a03e20fe6c 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
2023-10-04 10:37:25 -07:00
tofunmi
572fb4676c Update getName of BitmapFactoryImageDecoder
cleanup from 8f5835c51c

#minor-release

PiperOrigin-RevId: 570663437
2023-10-04 05:23:32 -07:00
tonihei
8e2bf21011 Add onAudioTrackInitialized/Released events
This is useful for analytics and understanding player behavior
during transitions.

#minor-release

PiperOrigin-RevId: 570623227
2023-10-04 01:50:15 -07:00
rohks
a879bae1ee Add nullness annotations to DecoderVideoRenderer
Also fixed a bug where format queue was polled with wrong timestamp value.

#fixit

PiperOrigin-RevId: 570420304
2023-10-03 10:06:35 -07:00
rohks
7a91474af9 Add nullness annotations to MediaCodecRenderer
#fixit

PiperOrigin-RevId: 570403923
2023-10-03 09:05:49 -07:00
tonihei
796781d4c3 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
2023-10-03 08:49:18 -07:00
michaelkatz
da06bf057a 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
2023-10-03 08:37:31 -07:00
samrobinson
1bb501ab50 Deprecate experimental keepAudioTrackOnSeek methods.
#minor-release

PiperOrigin-RevId: 570340714
2023-10-03 04:09:49 -07:00
christosts
144bd72236 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
2023-10-02 04:03:23 -07: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
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
Ian Baker
a1767d349a Fix review comments 2023-09-28 15:57:13 +01:00
ibaker
b4771e07b5 Mark HEIF decoding as only supported on API 26+
https://developer.android.com/guide/topics/media/platform/supported-formats#image-formats

#minor-release

PiperOrigin-RevId: 568864219
2023-09-27 08:56:06 -07:00
Ian Baker
8e6d3e7541 Reformat some javadoc and use Guava empty list 2023-09-26 16:07:38 +01:00
Shanuj Shekhar
aba15b6952 Add new APIs to ExoMediaDrm
Changes
---
- Added `removeOfflineLicense(byte[])` and `getOfflineLicenseKeySetIds` and consumed them in their implementations

Background
---
- These APIs will help in addressing an increasing amount of `java.lang.IllegalArgumentException: Failed to restore keys: BAD_VALUE` which is our top playback error in our app
	- Based on our discussion with Widevine team and [this exoplayer issue](https://github.com/google/ExoPlayer/issues/11202#issuecomment-1708792594)
		- TL;DR: The failure occurs on startup if the user has 200+ offline licenses, we would like to add the functionality to remove offline licenses

**Note: Why we want these APIs in ExoMediaDrm and not in OfflineLicenseHelper**
	- As per the issue above, we would like to access these 2 public APIs in MediaDrm that don’t exist in `OfflineLicenseHelper` or `ExoMediaDrm`
		- APIs interested in:
			- [MediaDrm#removeOfflineLicense()](https://developer.android.com/reference/android/media/MediaDrm#removeOfflineLicense(byte%5B%5D)): To remove offline license
			- [MediaDrm#getOfflineLicenseKeySetIds()](https://developer.android.com/reference/android/media/MediaDrm#getOfflineLicenseKeySetIds()): To see number of offline licenses on startup

		- We use `OfflineLicenseHelper` to download license for L1 and we don't interact with `ExoMediaDrm` directly. But for the alternate Widevine integration, we directly depend on `ExoMediaDrm` APIs to override and call CDM Native APIs.
		- We would like to have the functionality of removing offline licenses for both integration which would need access to above APIs in `ExoMediaDrm`.

Links
---
- https://github.com/androidx/media/issues/659
2023-09-26 10:05:36 -04:00
tonihei
212f1f8ea8 Update decode-only flag logic in non-MediaCodec-renderers
MediaCodecRenderer has already been updated to not rely on the
input stream to mark its samples as decode-only and instead use
a simple time-based comparison to achieve the same effect.

This change makes the same update for all other renderers that
either use the flag directly or forward to a "decoder" instance.

PiperOrigin-RevId: 568232212
2023-09-25 08:53:19 -07:00
claincly
884b3de69a Update VideoSink queueBitmap() to match VideoFrameProcessor
PiperOrigin-RevId: 568226567
2023-09-25 08:31:35 -07:00
christosts
603d36726f Move DefaultImageDecoderTest in tests
Move DefaultImageDecoderTest in tests since we can decode images with
Robolectric's native graphics mode.

PiperOrigin-RevId: 567259458
2023-09-21 03:53:42 -07:00
claincly
5ae21b453a Extract the VideoSinkProvider interface
PiperOrigin-RevId: 566972998
2023-09-20 08:31:13 -07:00