20446 Commits

Author SHA1 Message Date
Rohit Singh
a7f5c3f5b6 Update dump files 2024-04-30 16:31:50 +01:00
Rohit Singh
4b14bc2c3e Format with google-java-format 2024-04-30 16:31:50 +01:00
Daniele Sparano
b82f4b8e28 Tidy up dummy pusi, do not apply to H262 streams 2024-04-30 16:31:50 +01:00
Daniele Sparano
85826ebc19 Fix dummy pusi solution for byte range and key frame only NAL stream cases 2024-04-30 16:31:49 +01:00
Tofunmi Adigun-Hameed
c002ff6a6f Merge pull request #419 from v-novaltd:vnova-104 2024-04-30 16:31:49 +01:00
sheenachhabra
72013446c4 Update error message to be more specific
PiperOrigin-RevId: 629405290
2024-04-30 07:28:35 -07:00
sheenachhabra
6956d8099a Rename Muxer.addMetadata to addMetadataEntry
This is to make it clear that the method adds a single metadata entry, not a collection of metadata entries.

PiperOrigin-RevId: 629398485
2024-04-30 06:55:50 -07:00
sheenachhabra
bc77cef403 Rollback of 08abc964ab
PiperOrigin-RevId: 629382753
2024-04-30 05:41:45 -07:00
tofunmi
28655d27a7 test: use Ascii.equalsIgnoreCase for device model matching
PiperOrigin-RevId: 629349367
2024-04-30 02:54:38 -07:00
Rohit Kumar Singh
43f098da0f Merge Issue: androidx/media#882: Extend MPEG2TS implementation with MPEG-H support
Imported from GitHub PR https://github.com/androidx/media/pull/882

Merge 27a4c43de6294a5482b85ff8e2b4501057f3e946 into a49b625cc585970843f27410b614c6470924e7e5

COPYBARA_INTEGRATE_REVIEW=https://github.com/androidx/media/pull/882 from androidx:ts_mpegh_reader_patch 27a4c43de6294a5482b85ff8e2b4501057f3e946
PiperOrigin-RevId: 629132035
2024-04-29 11:33:38 -07:00
ibaker
96bc9e9652 Propagate ID3 TCON frame to MediaMetada.genre
This change also includes mapping the numeric ID3v1 codes to their
string equivalents before setting them into `MediaMetadata`. This
mapping already existed, but it was previously only used when parsing
MP4 `gnre` atoms.

Issue: androidx/media#1305
PiperOrigin-RevId: 629113480
2024-04-29 10:38:51 -07:00
rohks
c6492e01e4 Remove redundant final in PesReader methods
Since the class is final, declaring the overridden methods as final is unnecessary.

PiperOrigin-RevId: 629103982
2024-04-29 10:12:05 -07:00
tonihei
74bb4ac98d Fix lint errors in shortform demo app
PiperOrigin-RevId: 629080780
2024-04-29 08:50:06 -07:00
tonihei
a49b625cc5 Add renderer message to update priority
This can be used to set the new codec importance values.

PiperOrigin-RevId: 629073176
2024-04-29 08:17:37 -07:00
tonihei
344fc8a8c0 Add IntDef for priority values
This makes it easier to reference these values in documentation
and method parameters.

PiperOrigin-RevId: 629072314
2024-04-29 08:14:20 -07:00
tianyifeng
e180e263a5 Refresh HlsMediaPlaylist with delivery directives when possible
When refreshing the media playlist, we should try to request via a url with [delivery directives](https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis#section-6.2.5). However, when initially loading the media playlist or when the last loading with delivery directives encountered an error, we should not allow using those directives.

PiperOrigin-RevId: 629060177
2024-04-29 07:24:35 -07:00
ibaker
b0e48175f0 Add ID3 TCON genre to MP3 test samples
This change adds a 'free-form' text genre to the existing
`bear-id3.mp3` sample, and adds a new sample with a 'numeric' genre ([9
is Metal](https://mutagen-specs.readthedocs.io/en/latest/id3/id3v2.4.0-frames.html#appendix-a-genre-list-from-id3v1)).

The samples were modified with:

```shell
$ id3edit --set-genre "Gorpcore" bear-id3.mp3
$ id3edit --set-genre "9" bear-id3-numeric-genre.mp3
```

Reading the numeric genre with `exiftool` shows the mapping back to
'Metal':

```
$ exiftool bear-id3-numeric-genre.mp3 | grep Genre
Genre                           : Metal
```

The playback dumps don't contain the genre because it's not yet
propagated to `MediaMetadata.genre`. That is done in a follow-up
change.

Issue: androidx/media#1305
PiperOrigin-RevId: 629043506
2024-04-29 06:03:39 -07:00
bachinger
d292f80926 Remove MSG_DO_SOME_WORK when requesting playlist update
This removes a window of inconsistency between the timeline
known to the player and the most recent timeline in the
`MediaSourceList` by removing the `MSG_DO_SOME_WORK` when
sending `MSG_PLAYLIST_UPDATE_REQUESTED`. `MSG_DO_SOME_WORK`
is then sent again when the playlist update is requested.

PiperOrigin-RevId: 629021752
2024-04-29 04:06:13 -07:00
tofunmi
7089253bef Effect:migrate setEnableColorTransfers to setSdrWorkingColorSpace
Part of a two stage change to remove the conversion to linear colors in the SDR effects pipeline by default. Changes the boolean to an intdef, introducing a third option that gets all sdr input into the same colorspace.

This is a planned API breaking change, but this change should not change the behavior of the pipeline.

PiperOrigin-RevId: 629013747
2024-04-29 03:26:58 -07:00
claincly
43de3b67cf Fix PassthroughShaderProgram flush
PiperOrigin-RevId: 629007018
2024-04-29 02:51:27 -07:00
ibaker
854e8aad32 Add Dumper.addIfNonDefault methods
Remove the duplicate implementations in `PlaybackOutput` and
`DumpableFormat`.

PiperOrigin-RevId: 628419737
2024-04-26 09:00:44 -07:00
ibaker
e759b44c45 Remove @Nullable from Dumper.add methods
`checkNotNull` was added to the `Object` variant in b83f12c4ba. It
doesn't seem to have caused any test failures, so I guess we never
pass `null` in here - and might as well update the annotation to match
reality. And then for consistency we should ban `null` from the
`byte[]` overload too.

PiperOrigin-RevId: 628419003
2024-04-26 08:56:56 -07:00
bachinger
38813dd30e Migrate DefaultAnalyticsCollectorTest to use the playlist API
Some test cases are still using `ConcatenatingMediaSource`
even if they do not test specific features of the concatenating
source. Apparently these test have a slightly different timing
behavior when it comes to updating the `MediaPeriodQueue` and
emitting change events with analytics.

Using the playlist API ensures testing the future-proof code path.

PiperOrigin-RevId: 628413460
2024-04-26 08:35:58 -07:00
claincly
4be30bb308 Support seeking when playing back a composition
PiperOrigin-RevId: 628382976
2024-04-26 06:06:23 -07:00
ibaker
5666678d8a Use Dumper.addTime in more places
This ensures that `C.TIME_UNSET` is more clear in dump files. Some of
these call-sites will **never** pass `C.TIME_UNSET`, but it seems
clearest to always use `addTime` and maybe it will ensure when these
sites are copied in future, `addTime` will be used in the new location
too.

PiperOrigin-RevId: 628363183
2024-04-26 04:20:56 -07:00
ibaker
e194225b32 Fix parsing some MP4 metadata fields we wrongly assumed were 1 byte
This fixes parsing the `gnre` and `tmpo` values, as seen in the test
dump changes in this CL.

Issue: androidx/media#1305
PiperOrigin-RevId: 628352773
2024-04-26 03:30:14 -07:00
Googler
08abc964ab Box: Implement ctts box
Add ctts box implementation to handle muxing B-frame videos.
Add method convertPresentationTimestampsToCompositionOffset to
provide sample offsets. Return empty ctts box in case of video
does not contain B-frame. Add ctts box to MoovStructure to handle
muxing the video containing B-frames.

PiperOrigin-RevId: 628346257
2024-04-26 02:57:53 -07:00
ibaker
d76ee54ca6 Add two MP4 samples with metadata
The first has a string genre, and various other values set, generated
from `sample.mp4` with the command below [1].

The second has a numeric genre, to test `gnre` atom parsing. This
parsing is currently broken, the fix is in a follow-up change. This
file was also generated from `sample.mp4` with the command below [2].

This change also includes `CommentFrame.text` in its `toString`
representation, otherwise there's no difference between e.g. different
levels of `ITUNESADVISORY` in the extractor dump files.

Issue: androidx/media#1305

-----

[1]

```shell
$ AP_PADDING="DEFAULT_PAD=0" \
    AtomicParsley sample.mp4 \
    --artist "Test Artist" \
    --album "Test Album" \
    --tracknum 2/12 \
    --disk 2/3 \
    --year 2024  \
    --genre "Gorpcore" \
    --bpm 120 \
    --compilation true \
    --advisory clean \
    --gapless true \
    --sortOrder artist "Sorting Artist" \
    --sortOrder album "Sorting Album" \
    --preventOptimizing \
    -o sample_with_metadata.mp4
```

[2]
```shell
$ AP_PADDING="DEFAULT_PAD=0" \
    AtomicParsley sample.mp4 \
    --genre "Metal" \
    --preventOptimizing \
    -o sample_with_numeric_genre.mp4
```

PiperOrigin-RevId: 628345458
2024-04-26 02:53:33 -07:00
ibaker
acb3a54dee Add MediaMetadata to playback test dump files
This change also adds some runtime redirection of calls to
`Dumper.add(String, Object)` to `add(String, byte[])` if
`value instanceof byte[]`. This simplifies the implementation of
`PlaybackOutput.dumpIfNotEqual` and seems like a reasonable amound of
'magic' for a test utility.

Issue: androidx/media#1305
PiperOrigin-RevId: 628119473
2024-04-25 10:35:18 -07:00
tofunmi
5ee6c9b16d ultraHdr test: add checks for devices with invalid color formats
PiperOrigin-RevId: 628101730
2024-04-25 09:37:16 -07:00
kimvde
bf266c96a9 Set stream offset on video sink
PiperOrigin-RevId: 628084729
2024-04-25 08:32:23 -07:00
kimvde
a6eef7b8d8 Set clock on VideoSink
PiperOrigin-RevId: 628083794
2024-04-25 08:28:14 -07:00
kimvde
c87940eb27 AudioGraph refactoring: configure mixer and add sources in one place
PiperOrigin-RevId: 628076773
2024-04-25 08:02:00 -07:00
tonihei
13a3aa7e77 Add TestPlayerRunHelper run(player).untilBackgroundThreadCondition(..)
This method is useful for cases where the target condition can
become true outside of a message on the main thread. To ensure we
don't execute the rest of the test method in parallel with other
code, we have to introduce artifical messages on the main thread
that check the target condition.

PiperOrigin-RevId: 628072444
2024-04-25 07:43:19 -07:00
kimvde
00ce572a4f Always reconfigure video sink for video after image
Before this CL, the video sink was not reconfigured for the second video
in a sequence with video-image-video. For example, the stream offset
and listener were not set for the second video.

PiperOrigin-RevId: 628065991
2024-04-25 07:19:07 -07:00
bachinger
0e3b05c67d Add metadata field durationMs
PiperOrigin-RevId: 628038241
2024-04-25 05:05:42 -07:00
tonihei
ed1cf35f30 Extend async crypto flag to audio
This is only supported from API 35

PiperOrigin-RevId: 628014091
2024-04-25 03:07:44 -07:00
tonihei
d0d6ce52a5 Import androidx.media
This imports all the classes and resources needed by our code.

We still have the nominal dependency on the artifact as we need
to access the Parcelable CREATORs of MediaSessionCompat.Token,
MediaDescriptionCompat, RatingCompat and MediaBrowserCompat.MediaItem.

Mechanical import steps:
 - Put all files under a new 'legacy' package and change all import
   statements accordingly.
 - Reformat to adhere to Media3 java style guide
 - Remove all existing @RestrictTo annotations and replace them with
   top-level @RestrictTo(LIBRARY) on all classes in the new package.
 - Remove @NonNull annotations and fixed nullability test errors
 - Fix HTML javadoc build errors
 - Fix Lint errors (but not warnings)

The code still contains many lint warnings that will be fixed
separately.

PiperOrigin-RevId: 627999285
2024-04-25 01:56:23 -07:00
tonihei
43d1fa933c Remove flakiness from MCCPlaybackStateCompatActionsWithMediaSessionTest
The tests were reigstering a listener to wait for the first event, but
this first even may have happened already by the time the listener is
registered. Instead we can wait until the controller is connected and
assume that the initial state already arrived.

PiperOrigin-RevId: 627683245
2024-04-24 04:27:44 -07:00
tonihei
f9ea4f0444 Fix error-prone warning comparing CharSequence with String
PiperOrigin-RevId: 627679923
2024-04-24 04:11:56 -07:00
kimvde
579386ff27 Set VideoFrameMetadataListener on VideoSink
PiperOrigin-RevId: 627652670
2024-04-24 02:04:23 -07:00
ibaker
3322092070 Fix MP4 ID3 sort tag mapping
The ID3 tags are documented here:
https://wiki.hydrogenaud.io/index.php?title=Foobar2000:ID3_Tag_Mapping

The MP4 fourcc types are documented here:
https://mutagen.readthedocs.io/en/latest/api/mp4.html#mutagen.mp4.MP4Tags

From the field definitions at the top of this file:

* `TYPE_SORT_ALBUM = 0x736f616c = 'soal'`
* `TYPE_SORT_ARTIST = 0x736f6172 = 'soar'`
* `TYPE_SORT_ALBUM_ARTIST = 0x736f6161 = 'soaa'`

Issue: androidx/media#1302

#minor-release

PiperOrigin-RevId: 627486902
2024-04-23 13:29:40 -07:00
claincly
124c70ac26 Add MIME type to match any image
PiperOrigin-RevId: 627486539
2024-04-23 13:27:42 -07:00
rohks
8ff9e4a838 Add test for H.264 I-frames only track in TsExtractorTest
Sample is created by re-encoding the existing H.264 sample with `ffmpeg`.

PiperOrigin-RevId: 627470063
2024-04-23 12:30:11 -07:00
kimvde
abd0ff7352 Remove configure methods
Pass the parameters to the constructor instead

PiperOrigin-RevId: 627420999
2024-04-23 09:59:56 -07:00
tonihei
bf9f8a3719 Treat playback after stop as a new playback
This implies we should report it as STATE_JOINING_FOREGROUND
instead of STATE_BUFFERING.

PiperOrigin-RevId: 627406584
2024-04-23 09:09:15 -07:00
tofunmi
73f614b14d Effect: support disabling color transfers when HDR->SDR tonemapping
also makes the setter more flexible by ignoring the value of the setter when the output is hdr rather than throwing (since all HDR content must be have a linear color space)

PiperOrigin-RevId: 627388436
2024-04-23 08:02:30 -07:00
Googler
f2276f613d Fix SocketTimeoutException in CronetDataSource.
In some versions of Cronet, the request provided by the callback is not always the same. This leads to callback not completing and request timing out.

The fix changes from having one `UrlRequestCallback` per `CronetDataSource` to one `UrlRequestCallback` per `UrlRequest`. Everytime a current request is canceled, the current callback is closed.

PiperOrigin-RevId: 627379153
2024-04-23 07:21:20 -07:00
sheenachhabra
b813bd3976 Use silence audio in RawAssetLoader tests
This is avoid dependency on `MediaExtractor` whose
behaviour is not consistent across different API versions.

PiperOrigin-RevId: 627330485
2024-04-23 03:38:31 -07:00
bachinger
4091303c7e Read device volume directly from binder with legacy session
PiperOrigin-RevId: 627328652
2024-04-23 03:31:33 -07:00