Clear TextRenderer.streamError when disabling or changing stream

Previously a stream error from one playlist item was incorrectly
preserved when switching to the next one, resulting in playback hanging.

Issue: androidx/media#2328
PiperOrigin-RevId: 752624979
This commit is contained in:
ibaker 2025-04-29 01:03:42 -07:00 committed by Copybara-Service
parent 4d7046c187
commit ecfd9d1e92
2 changed files with 5 additions and 0 deletions

View File

@ -42,6 +42,9 @@
* Text:
* Fix SSA and SubRip to display an in-progress cue when enabling subtitles
([#2309](https://github.com/androidx/media/issues/2309)).
* Fix playback getting stuck when switching from a stream with a subtitle
error to a live stream with an empty subtitle track
([#2328](https://github.com/androidx/media/issues/2328)).
* Metadata:
* Image:
* DataSource:

View File

@ -208,6 +208,7 @@ public final class TextRenderer extends BaseRenderer implements Callback {
long offsetUs,
MediaSource.MediaPeriodId mediaPeriodId) {
streamFormat = formats[0];
streamError = null;
if (!isCuesWithTiming(streamFormat)) {
assertLegacyDecodingEnabledIfRequired();
if (subtitleDecoder != null) {
@ -460,6 +461,7 @@ public final class TextRenderer extends BaseRenderer implements Callback {
@Override
protected void onDisabled() {
streamFormat = null;
streamError = null;
finalStreamEndPositionUs = C.TIME_UNSET;
clearOutput();
lastRendererPositionUs = C.TIME_UNSET;