Commit 347080fb 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.

PiperOrigin-RevId: 432646037
(cherry picked from commit 25e56804)
parent 812b8d5f
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
`SubtitleConfiguration` field and fall back to the `Factory` value if `SubtitleConfiguration` field and fall back to the `Factory` value if
it's not set it's not set
([#10016](https://github.com/google/ExoPlayer/issues/10016)). ([#10016](https://github.com/google/ExoPlayer/issues/10016)).
* Ad playback:
* Fix audio underruns between ad periods in live HLS SSAI streams.
### 2.17.0 (2022-02-24) ### 2.17.0 (2022-02-24)
......
...@@ -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