Skip to content

Commit

Permalink
Use zero offset when delegating EMSG sample data
Browse files Browse the repository at this point in the history
When delegating EMSG samples in `HlsSampleStreamWrapper`,
the offset passed into `sampleMetadata(..)` of the delegate
`TrackOutput` must be zero because it is called immediately
after `sampleData(..)` is called.

The condition to trigger this issue is that more than one
metadata samples are pending in `pendingMetadataSampleInfos`
of `FragmentedMp4Extractor` which produces non-zero offsets.

Issue: #1002
Issue: #1203
PiperOrigin-RevId: 623210835
  • Loading branch information
marcbaechinger authored and Copybara-Service committed Apr 9, 2024
1 parent 24e92bb commit 5a84e09
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
* Cronet Extension:
* RTMP Extension:
* HLS Extension:
* Fix bug where pending EMSG samples waiting for a discontinuity were
delegated in `HlsSampleStreamWrapper` with an incorrect offset causing
an `IndexOutOfBoundsException` or an `IllegalArgumentException`
([#1002](https://github.com/androidx/media/issues/1002)).
* DASH Extension:
* Smooth Streaming Extension:
* RTSP Extension:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1882,7 +1882,7 @@ public void sampleMetadata(
int sampleSize = sampleForDelegate.bytesLeft();

delegate.sampleData(sampleForDelegate, sampleSize);
delegate.sampleMetadata(timeUs, flags, sampleSize, offset, cryptoData);
delegate.sampleMetadata(timeUs, flags, sampleSize, /* offset= */ 0, cryptoData);
}

private boolean emsgContainsExpectedWrappedFormat(EventMessage emsg) {
Expand Down

0 comments on commit 5a84e09

Please sign in to comment.