media/libraries
tonihei 4b6e886ad2 Improve position estimate when transitioning to another checkpoint
When transitioning to the next media position parameter checkpoint
we estimate the position because the audio processor chain no longer
provides access to the actual playout duration.

The estimate using the declared speed and the last checkpoint may
have drifted over time, so we currently estimate relative to the
next checkpoint, which is closer and presumably provides a better
estimate. However, this assumes that these checkpoint are perfectly
aligned without any position jumps.

The current approach has two issues:
 - The next checkpoint may include a position jump by design, e.g.
   if it was set for a new item in the playlist and the duration of
   the current item wasn't perfectly accurate.
 - The sudden switch between two estimation methods may cause a jump
   in the output position, which is visible when we add new media
   position checkpoints to the queue, not when we actually reach the
   playback position of the checkpoint.

We can fix both issues by taking a slightly different approach:
 - Continuously monitor the estimate using the current checkpoint. If
   it starts drifting, we can adjust it directly. This way the estimate
   is always aligned with the actual position.
 - The change above means we can safely switch to using the estimate
   based on the previous checkpoint. This way we don't have to make
   assumptions about the next checkpoint and any position jumps will
   only happen when we actually reach this checkpoint (which is more
   what a user expects to see, e.g. at a playlist item transition).

Issue: androidx/media#1698
PiperOrigin-RevId: 690979859
(cherry picked from commit 7c0cffdca8)
2024-11-05 13:10:06 +00:00
..
cast Remove @DoNotInline annotations 2024-09-18 04:47:39 -07:00
common Bump Media3 to 1.5.0-rc01 2024-11-01 17:48:21 +00:00
common_ktx Add jvmTarget and kotlin-android plugin to common_ktx module 2024-08-15 10:36:10 -07:00
container Support CEA-608 subtitles in Dolby Vision 2024-10-31 14:41:24 +00:00
database Do not trim audio samples by changing their timestamp 2023-06-29 22:50:04 +00:00
datasource DataSourceContractTest: Tighten assertions around 'not found' URIs 2024-11-05 13:09:10 +00:00
datasource_cronet DataSourceContractTest: Tighten assertions around 'not found' URIs 2024-11-05 13:09:10 +00:00
datasource_okhttp DataSourceContractTest: Tighten assertions around 'not found' URIs 2024-11-05 13:09:10 +00:00
datasource_rtmp Remove exoplayer2-only javadoc machinery from media3 2023-06-05 09:47:58 +00:00
decoder MediaCodecVideoRenderer skips decoder inputs unused as reference 2024-07-09 03:43:06 -07:00
decoder_av1 Add 16 KB page support for decoder extensions on Android 15 2024-10-10 10:18:20 -07:00
decoder_ffmpeg Add 16 KB page support for decoder extensions on Android 15 2024-10-10 10:18:20 -07:00
decoder_flac Re-enable disabled tests in FlacExtractorSeekTest 2024-10-11 04:38:25 -07:00
decoder_iamf Use assumeTrue for libiamf availability check in IamfDecoderTest 2024-10-31 14:41:24 +00:00
decoder_midi Add missing module registrations 2024-05-23 04:50:01 -07:00
decoder_opus Refactor OpusDecoderTest to use OpusLibrary.isAvailable() 2024-10-31 14:41:24 +00:00
decoder_vp9 Add 16 KB page support for decoder extensions on Android 15 2024-10-10 10:18:20 -07:00
effect Make VideoGraph and VideoFrameProcessor listener methods optional 2024-10-17 02:38:03 -07:00
exoplayer Improve position estimate when transitioning to another checkpoint 2024-11-05 13:10:06 +00:00
exoplayer_dash Release the Surface at the end of every playback test 2024-11-05 12:07:17 +00:00
exoplayer_hls Release the Surface at the end of every playback test 2024-11-05 12:07:17 +00:00
exoplayer_ima Account for missing preroll when converting adPodIndex to adGroupIndex 2024-10-04 08:11:04 -07:00
exoplayer_rtsp Format with google-java-format 2024-09-12 04:47:05 +00:00
exoplayer_smoothstreaming Formatting and javadoc 2024-10-09 13:50:30 +01:00
exoplayer_workmanager Remove exoplayer2-only javadoc machinery from media3 2023-06-05 09:47:58 +00:00
extractor Fix handling of cues that exceed total duration in MatroskaExtractor 2024-11-05 13:09:10 +00:00
muxer Add HALF_UP rounding TODO to scaleLargeTimestamp (and its usages) 2024-10-17 08:25:03 -07:00
session Removed unused constructor 2024-11-05 12:13:17 +00:00
test_data Fix handling of cues that exceed total duration in MatroskaExtractor 2024-11-05 13:09:10 +00:00
test_exoplayer_playback Revert erroneous changes 2024-07-24 16:17:02 +01:00
test_session_common Add media button preferences 2024-10-17 09:54:36 -07:00
test_session_current Suppress not-applicable lint warning 2024-11-05 12:13:17 +00:00
test_utils DataSourceContractTest: Tighten assertions around 'not found' URIs 2024-11-05 13:09:10 +00:00
test_utils_robolectric Bump minSdk to 21 and remove resulting simple dead code 2024-07-12 08:11:01 -07:00
transformer Remove deprecated DefaultEncoderFactory constructors. 2024-10-17 01:53:23 -07:00
ui Align spelling of fullScreen to fullscreen 2024-11-05 12:13:16 +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