Use zero offset when delegating EMSG sample data

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: androidx/media#1002
Issue: androidx/media#1203
PiperOrigin-RevId: 623210835
This commit is contained in:
bachinger 2024-04-09 10:29:54 -07:00 committed by Copybara-Service
parent 24e92bb04f
commit 5a84e09a0e
2 changed files with 5 additions and 1 deletions

View File

@ -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:

View File

@ -1882,7 +1882,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
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) {