Commit 25e56804 by bachinger Committed by Ian Baker

Ignore MetadataRenderer when evaluating SSAI period transitions

This makes the reading period advance early as expected at the end of an ad
period. Before this change the reading position of the metadata renderer
prevented advancing the period until metadata arrived after the start position of
the following period. Only then the reading position of the metadata renderer
is updated and beyond the start position of the following period which is a
condition to advance the reading period.

Because transitioning to the next period is a virtual transition and the
SharedMediaPeriod keeps reading from the same underlying sample streams, the
metadata renderer can safely be ignored for this check.

#minor-release

PiperOrigin-RevId: 432646037
parent d7df4260
...@@ -32,6 +32,8 @@ ...@@ -32,6 +32,8 @@
* RTSP: * RTSP:
* Add RTP reader for HEVC * Add RTP reader for HEVC
([#36](https://github.com/androidx/media/pull/36)). ([#36](https://github.com/androidx/media/pull/36)).
* Ad playback:
* Fix audio underruns between ad periods in live HLS SSAI streams.
* Remove deprecated symbols: * Remove deprecated symbols:
* Remove `Player.Listener.onTracksChanged`. Use * Remove `Player.Listener.onTracksChanged`. Use
`Player.Listener.onTracksInfoChanged` instead. `Player.Listener.onTracksInfoChanged` instead.
......
...@@ -39,6 +39,7 @@ import com.google.android.exoplayer2.analytics.AnalyticsCollector; ...@@ -39,6 +39,7 @@ import com.google.android.exoplayer2.analytics.AnalyticsCollector;
import com.google.android.exoplayer2.analytics.PlayerId; import com.google.android.exoplayer2.analytics.PlayerId;
import com.google.android.exoplayer2.drm.DrmSession; import com.google.android.exoplayer2.drm.DrmSession;
import com.google.android.exoplayer2.metadata.Metadata; import com.google.android.exoplayer2.metadata.Metadata;
import com.google.android.exoplayer2.metadata.MetadataRenderer;
import com.google.android.exoplayer2.source.BehindLiveWindowException; import com.google.android.exoplayer2.source.BehindLiveWindowException;
import com.google.android.exoplayer2.source.MediaPeriod; import com.google.android.exoplayer2.source.MediaPeriod;
import com.google.android.exoplayer2.source.MediaSource.MediaPeriodId; import com.google.android.exoplayer2.source.MediaSource.MediaPeriodId;
...@@ -2220,6 +2221,7 @@ import java.util.concurrent.atomic.AtomicBoolean; ...@@ -2220,6 +2221,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
return reading.info.isFollowedByTransitionToSameStream return reading.info.isFollowedByTransitionToSameStream
&& nextPeriod.prepared && nextPeriod.prepared
&& (renderer instanceof TextRenderer // [internal: b/181312195] && (renderer instanceof TextRenderer // [internal: b/181312195]
|| renderer instanceof MetadataRenderer
|| renderer.getReadingPositionUs() >= nextPeriod.getStartPositionRendererTime()); || renderer.getReadingPositionUs() >= nextPeriod.getStartPositionRendererTime());
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment