Skip to content

Commit

Permalink
Use outputStreamEnded for MetadataRenderer#isEnded
Browse files Browse the repository at this point in the history
Issue: #8710
PiperOrigin-RevId: 366051836
  • Loading branch information
icbaker authored and marcbaechinger committed Apr 12, 2021
1 parent 6d0a04d commit e8742b3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@
spec ([#8704](https://github.com/google/ExoPlayer/issues/8704)).
* Support TTML `textEmphasis` attributes, used for Japanese boutens.
* Support TTML `shear` attributes.
* Metadata:
* Ensure that timed metadata near the end of a period is not dropped
([#8710](https://github.com/google/ExoPlayer/issues/8710)).
* MediaSession extension: Remove dependency to core module and rely on common
only. The `TimelineQueueEditor` uses a new `MediaDescriptionConverter` for
this purpose and does not rely on the `ConcatenatingMediaSource` anymore.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public final class MetadataRenderer extends BaseRenderer implements Callback {
private int pendingMetadataCount;
@Nullable private MetadataDecoder decoder;
private boolean inputStreamEnded;
private boolean outputStreamEnded;
private long subsampleOffsetUs;

/**
Expand Down Expand Up @@ -118,6 +119,7 @@ protected void onStreamChanged(Format[] formats, long startPositionUs, long offs
protected void onPositionReset(long positionUs, boolean joining) {
flushPendingMetadata();
inputStreamEnded = false;
outputStreamEnded = false;
}

@Override
Expand Down Expand Up @@ -158,6 +160,9 @@ public void render(long positionUs, long elapsedRealtimeUs) {
pendingMetadataIndex = (pendingMetadataIndex + 1) % MAX_PENDING_METADATA_COUNT;
pendingMetadataCount--;
}
if (inputStreamEnded && pendingMetadataCount == 0) {
outputStreamEnded = true;
}
}

/**
Expand Down Expand Up @@ -198,7 +203,7 @@ protected void onDisabled() {

@Override
public boolean isEnded() {
return inputStreamEnded;
return outputStreamEnded;
}

@Override
Expand Down

0 comments on commit e8742b3

Please sign in to comment.