-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Subsample offset and cue timestamp parsing for WebVTT fails when PTS wraps. #7462
Comments
@icbaker @AquilesCanta Please could you take a look? |
I thought ExoPlayer already supported this case, actually. I can take a quick look. |
@AquilesCanta and I have taken a look at this. I'm not convinced the source media is valid/correct in this case. There's 2 (quite different) questions:
WebVTT header parsingThe WebVTT file parsing spec reads the
So it seems that WebVTT headers like The value of
|
Thanks @icbaker ! The Pantos spec is unclear how the TIMESTAMP-MAP should be placed in the file (of course, spec is vague on many things). The w3c spec states pretty clearly the WEBVTT string can be followed by space or tab (https://www.w3.org/TR/webvtt1/#file-structure. It is this that the origin vendor claims its ok to do it this way. My last checkin of the As for the timestamps, I'm working on a test case for the change that detects PTS wrap. Probably a good idea to add the same change check to the LOCAL timestamp as well. Reading the paragraph again, it is possible that the LOCAL value could be monotonic increasing as well. If you look at my code and the test case, you can see it will arrive at the same values no matter which timestamps they do or do not allow to wrap. I'm finishing up a test case for the Please do review my code, I'll add some notes, and let us know if you have other streams you want tested. |
I agree We'll see what they say.
OK - I'm getting a better understanding now. I don't think this is about the LOCAL timestamp wrapping necessarily, whether it wraps or not is irrelevant. What we're doing wrong in the current code is not correctly respecting 33-bit wrapping when applying the X-TIMESTAMP-MAP calculation. I did some maths on the sample file you provided to try and explain the reasoning of the existing code. The first PTS timestamp I found in the MPEG stream was 494878907. I calculated things like this:
The existing code does it like this:
The two algorithms are equivalent apart from step 6, I just found it easier to reason in PTS while the code decides to do most of its logic in microseconds. If we fix step 6 to wrap:
If I think your PR makes some incorrect assumptions - I've added some comments. I also don't think it should be needed once we've pushed the wrapping change I've described. |
Issue: #7462 PiperOrigin-RevId: 314919210
This is now pushed to dev-v2. Can you try it out and see what you think? (you'll need to keep your header parsing changes locally) |
I did some digging through the WebVTT history and found that 'WebVTT header' was clearly defined when the HLS spec was written, and they were defined as appearing on their own lines directly underneath So the HLS spec is arguably relying on an old version of the WebVTT spec, but it seems pretty clear the intention is to use this definition of 'WebVTT header'. |
Yeah thanks for this Ian, and all your thoughtful analysis here.. It's great. As a player vendor, there is no real benefit to being pedantic to the spec (unless you want to use it to display a warning log when you see things that are non-compliant). The player's job is to make every reasonable attempt to gather the actual intent from input sources that are less then perfectly compliant. So, we should accept the tab or the |
@ojw28 the Bright Cove folks obviously experienced this as well: https://sdks.support.brightcove.com/features/synchronizing-webvtt-captions.html Note the big warning:
Next push I'll take out commit 5e7d22a and commit 2108c6a from the pull branch. We'll keep these ourselves locally until the origin vendor agrees or convinces us all this is a spec bug. |
Ian, thanks so much. I'll look at the sample and put in the expected PTS for all of the cues in at least the first 5 or 6 cues in the example, we can make a test case for it then (it would need to be on the render side, as the final calculation with offset is done there. |
This also gives some general test coverage for HLS' WebvttExtractor Issue: #7462 PiperOrigin-RevId: 315257252
I'm going to close this since I believe we've resolved the timestamp problem, and we're not going to change the WebVTT parsing. I'll leave the PR open while you're looking into testing. |
Yep, thanks for your help with the fix!
From Steve's iPhone
… On Jun 10, 2020, at 7:42 AM, Ian Baker ***@***.***> wrote:
I'm going to close this since I believe we've resolved the timestamp problem, and we're not going to change the WebVTT parsing.
I'll leave the PR open while you're looking into testing.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Issue description
ExoPlayer does not handle PTS wrap that is not propagated to the Cue timestamps, that is the timestamps continue in time past the max representable as a PTS value. This is allowed by the Pantos spec as:
Note this commit to fix Issue #2928 does not fix this issue, as all the cue timestamps have values that are monotonically increasing after the PTS wrap, not just the first cue timestamp.
Reproduction steps
The demo app reproduces this, I've sent an S3 bucket with a snap shot of a live stream that has run long enough for PTS to wrap.
Link to test content
I will email the link to dev.exoplayer@gmail.com.
Pull Request
I've submitted a request that fixes the issue, we of course needed this quickly for a customer. We are more then happy to add more unit tests around this change and help regress other bugs that may or may not be related or affected by this [Bug 609].
[REQUIRED] A full bug report captured from the device
There is nothing relevant in the logs. The captions simply are queue to the sample queue with values so out of scope that playback quickly goes to hell.
[REQUIRED] Version of ExoPlayer being used
2.11.4
[REQUIRED] Device(s) and version(s) of Android being used
Reproduced on an Arris STB on Android Pie
The text was updated successfully, but these errors were encountered: