diff --git a/RELEASENOTES.md b/RELEASENOTES.md index eb229a98cc..7a40269cfd 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -20,6 +20,8 @@ ([#4690](https://github.com/google/ExoPlayer/issues/4690)). * Fix issue with applying the `show_buffering` attribute in `PlayerView` ([#5139](https://github.com/google/ExoPlayer/issues/5139)). +* Fix issue where null `Metadata` was output when it failed to decode + ([#5149](https://github.com/google/ExoPlayer/issues/5149)). ### 2.9.1 ### diff --git a/library/core/src/main/java/com/google/android/exoplayer2/metadata/MetadataRenderer.java b/library/core/src/main/java/com/google/android/exoplayer2/metadata/MetadataRenderer.java index 152eb97e0c..864616e810 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/metadata/MetadataRenderer.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/metadata/MetadataRenderer.java @@ -129,9 +129,12 @@ public final class MetadataRenderer extends BaseRenderer implements Callback { buffer.subsampleOffsetUs = formatHolder.format.subsampleOffsetUs; buffer.flip(); int index = (pendingMetadataIndex + pendingMetadataCount) % MAX_PENDING_METADATA_COUNT; - pendingMetadata[index] = decoder.decode(buffer); - pendingMetadataTimestamps[index] = buffer.timeUs; - pendingMetadataCount++; + Metadata metadata = decoder.decode(buffer); + if (metadata != null) { + pendingMetadata[index] = metadata; + pendingMetadataTimestamps[index] = buffer.timeUs; + pendingMetadataCount++; + } } } }