media/libraries
ibaker 1d2116c53a Add fps-awareness to DefaultTrackSelector
This change aims to prioritise tracks that have a 'smooth enough for
video' frame rate, without always selecting the track with the highest
frame rate.

In particular MP4 files extracted from motion photos sometimes have two
HEVC tracks, with the higher-res one having a very low frame rate (not
intended for use in video playback). Before this change
`DefaultTrackSelector` would pick the low-fps, high-res track.

This change adds a somewhat arbitrary 10fps threshold for "smooth video
playback", meaning any tracks above this threshold are selected in
preference to tracks below it. Within the tracks above the threshold
other attributes are used to select the preferred track. We deliberately
don't pick the highest-fps track (over pixel count and bitrate), because
most users would prefer to see a 30fps 4k track over a 60fps 720p track.

This change also includes a test MP4 file, extracted from the existing
`jpeg/pixel-motion-photo-2-hevc-tracks.jpg` file by logging
`mp4StartPosition` in
[`MotionPhotoDescription.getMotionPhotoMetadata`](b930b40a16/libraries/extractor/src/main/java/androidx/media3/extractor/jpeg/MotionPhotoDescription.java (L123))
and then using `dd`:

```
mp4StartPosition=2603594

$ dd if=jpeg/pixel-motion-photo-2-hevc-tracks.jpg \
    of=mp4/pixel-motion-photo-2-hevc-tracks.mp4 \
    bs=1 \
    skip=2603594
```

----

This solution is in addition to the `JpegMotionPhotoExtractor` change
made specifically for these two-track motion photos in
5266c71b3a.
We will keep both changes, even though that change is not strictly
needed after this one, because adding the role flags helps to
communicate more clearly the intended usage of these tracks. This
change to consider FPS seems like a generally useful improvement to
`DefaultTrackSelector`, since it seems unlikely we would prefer a 5fps
video track over a 30fps one.

Issue: androidx/media#1051
PiperOrigin-RevId: 611015459
(cherry picked from commit c7e00b12b4)
2024-04-02 18:34:46 +00:00
..
cast Return empty timeline when media info is null 2023-11-20 09:55:36 -08:00
common Allow renderer retry for audio track offload initialization failure 2024-04-02 18:24:33 +00:00
container Remove empty container/src/androidTest directory 2023-12-11 10:41:51 -08:00
database Do not trim audio samples by changing their timestamp 2023-06-29 22:50:04 +00:00
datasource Add supportsMimeType API to bitmapLoader 2024-01-12 13:49:38 -08:00
datasource_cronet Replace or suppress deprecated usages 2024-02-08 17:29:12 +00:00
datasource_okhttp Replace or suppress deprecated usages 2024-02-08 17:29:12 +00:00
datasource_rtmp Remove exoplayer2-only javadoc machinery from media3 2023-06-05 09:47:58 +00:00
decoder Satisfy nullness checker correctness by using local variable 2023-10-31 12:56:32 +00:00
decoder_av1 Replace or suppress deprecated usages 2024-02-08 17:29:12 +00:00
decoder_ffmpeg Replace or suppress deprecated usages 2024-02-08 17:29:12 +00:00
decoder_flac Replace or suppress deprecated usages 2024-02-08 17:29:12 +00:00
decoder_midi MidiExtractor: mark only the first sample as key-frame 2023-11-21 07:39:46 -08:00
decoder_opus Replace or suppress deprecated usages 2024-02-08 17:29:12 +00:00
decoder_vp9 Replace or suppress deprecated usages 2024-02-08 17:29:12 +00:00
effect Fix forward for 216f3fedb8 2024-04-02 16:41:12 +00:00
exoplayer Add fps-awareness to DefaultTrackSelector 2024-04-02 18:34:46 +00:00
exoplayer_dash Rollback of 406c0a15be 2024-02-08 17:30:17 +00:00
exoplayer_hls Rollback of 406c0a15be 2024-02-08 17:30:17 +00:00
exoplayer_ima Replace or suppress deprecated usages 2024-02-08 17:29:12 +00:00
exoplayer_rtsp Allow empty information attributes in RTSP Session Description 2024-04-02 17:08:26 +00:00
exoplayer_smoothstreaming Rollback of 406c0a15be 2024-02-08 17:30:17 +00:00
exoplayer_workmanager Remove exoplayer2-only javadoc machinery from media3 2023-06-05 09:47:58 +00:00
extractor Set correct track id when skipping empty tracks in Mp4Extractor 2024-02-08 17:30:17 +00:00
muxer Write "stco" box instead of "co64" for fragmented MP4 2024-01-25 11:42:44 +00:00
session Check whether the session activity pending intent is an activity 2024-04-02 16:41:11 +00:00
test_data Add fps-awareness to DefaultTrackSelector 2024-04-02 18:34:46 +00:00
test_exoplayer_playback Disable 'skip buffers with identical release times' in GTS tests 2024-01-25 11:42:43 +00:00
test_session_common Add session extras to the state of the controller 2023-11-21 14:32:33 -08:00
test_session_current Check whether the session activity pending intent is an activity 2024-04-02 16:41:11 +00:00
test_utils Rollback of 406c0a15be 2024-02-08 17:30:17 +00:00
test_utils_robolectric Fix docs on playUntilStartOfMediaItem to match playUntilPosition 2024-04-02 16:41:12 +00:00
transformer Fix failure to write negative PTS sample 2024-04-02 16:57:22 +00:00
ui Fallback to including track language name if display name is not found 2024-04-02 16:13:56 +00:00
ui_leanback Bump effect and leanback minSdk to 19 2024-01-10 07:22:00 -08:00
lint.xml Update recommended way to suppress @UnstableApi errors in lint.xml 2023-11-15 02:34:40 -08:00