Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EXT-X-START:TIME-OFFSET regEx implemented incorrectly #2507

Closed
will-work opened this issue Feb 27, 2017 · 1 comment
Closed

EXT-X-START:TIME-OFFSET regEx implemented incorrectly #2507

will-work opened this issue Feb 27, 2017 · 1 comment

Comments

@will-work
Copy link

#1544 implements support for the EXT-X-START:TIME-OFFSET tag, however the regular expression defined in HlsPlaylistParser is incorrect because it does not recognise negative offsets. However, the code in HlsMediaPlaylist that sets the offset is correctly implemented because it does take into account negative numbers.

The fix is therefore a simple one: in com/google/android/exoplayer2/source/hls/playlist/HlsPlaylistParser the string REGEX_TIME_OFFSET should be changed from

private static final Pattern REGEX_TIME_OFFSET = Pattern.compile("TIME-OFFSET=([\\d\\.]+)\\b");
to

private static final Pattern REGEX_TIME_OFFSET = Pattern.compile("TIME-OFFSET=([-\\d\\.]+)\\b");

To reproduce, set the offset value in a media playlist to a negative number and run the demo app.

Reproduced on version 2.2 release using Samsung GT-I9295 (Android 5.0.1 API21)

Logcat snippet:

               com.google.android.exoplayer2.ParserException: Couldn't match TIME-OFFSET=([\d\.]+)\b in #EXT-X-START:TIME-OFFSET=-20
                   at com.google.android.exoplayer2.source.hls.playlist.HlsPlaylistParser.parseStringAttr(HlsPlaylistParser.java:375)
                   at com.google.android.exoplayer2.source.hls.playlist.HlsPlaylistParser.parseDoubleAttr(HlsPlaylistParser.java:383)
                   at com.google.android.exoplayer2.source.hls.playlist.HlsPlaylistParser.parseMediaPlaylist(HlsPlaylistParser.java:287)
                   at com.google.android.exoplayer2.source.hls.playlist.HlsPlaylistParser.parse(HlsPlaylistParser.java:128)
                   at com.google.android.exoplayer2.source.hls.playlist.HlsPlaylistParser.parse(HlsPlaylistParser.java:41)
                   at com.google.android.exoplayer2.upstream.ParsingLoadable.load(ParsingLoadable.java:115)
                   at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:295)
                   at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
                   at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                   at java.lang.Thread.run(Thread.java:818)
@AquilesCanta
Copy link
Contributor

This is a duplicate of #2495. A fix will be available soon.

@google google locked and limited conversation to collaborators Jun 28, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants