Require the list returned by SubtitleParser to be sorted by timestamp

This makes it more efficient to consume (e.g. we can binary search
through it).

PiperOrigin-RevId: 539095673
This commit is contained in:
ibaker 2023-06-09 16:00:01 +00:00 committed by Tofunmi Adigun-Hameed
parent fafeafa72d
commit 3cf21bd5d5

View File

@ -56,8 +56,8 @@ public interface SubtitleParser {
* @param offset The index in {@code data} to start reading from (inclusive). * @param offset The index in {@code data} to start reading from (inclusive).
* @param length The number of bytes to read from {@code data}. * @param length The number of bytes to read from {@code data}.
* @return The {@linkplain CueGroup cue groups} parsed from {@code data} (and possibly previous * @return The {@linkplain CueGroup cue groups} parsed from {@code data} (and possibly previous
* provided samples too), or null if there is insufficient data to generate a complete {@link * provided samples too), sorted in ascending order by {@link CueGroup#presentationTimeUs}.
* CueGroup}. * Otherwise null if there is insufficient data to generate a complete {@link CueGroup}.
*/ */
@Nullable @Nullable
List<CueGroup> parse(byte[] data, int offset, int length); List<CueGroup> parse(byte[] data, int offset, int length);