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

Live Smooth Streaming: Offset to sample data was negative. #1152

Closed
freakk82 opened this issue Jan 15, 2016 · 14 comments
Closed

Live Smooth Streaming: Offset to sample data was negative. #1152

freakk82 opened this issue Jan 15, 2016 · 14 comments

Comments

@freakk82
Copy link

Attempting to play a Live Smooth Streaming video with ExoPlayer r1.5.3 on an Android 4.4.2 STB, I am getting the following error:

com.google.android.exoplayer.ExoPlaybackException: com.google.android.exoplayer.ParserException: Offset to sample data was negative.

@ojw28
Copy link
Contributor

ojw28 commented Jan 15, 2016

Would I be correct in thinking this is a sporadic failure, rather than something that happens all of the time?

@freakk82
Copy link
Author

unfortunately it's happening with all the live streams in the app. Is there a public sample of live smooth streaming I can test to see if it works?

@ojw28
Copy link
Contributor

ojw28 commented Jan 15, 2016

There's a public sample built into the demo app that you can try (and it works as far as I know).

@freakk82
Copy link
Author

I couldn't find the live smooth streaming sample in the demo app, only the "Super Speed" sample which is not live. The weird thing is that on a very old Exoplayer version, the same stream plays with no such error.

@ojw28
Copy link
Contributor

ojw28 commented Jan 18, 2016

Ah, I didn't spot the live part of your comment. There's an Azure live stream provided by Microsoft, that works fine for me:

    new Sample("Azure live",
        "http://b028.wpc.azureedge.net/80B028/Samples/a38e6323-95e9-4f1f-9b38-75eba91704e4/"
        + "5f2ce531-d508-49fb-8152-647eba422aec.ism",
        Util.TYPE_SS),

I also have some private test streams that work fine. Please could you provide a link to an affected stream?

@ojw28
Copy link
Contributor

ojw28 commented Jan 18, 2016

NB - I just updated the link in the response above, so copy it again if you tried within the last minute!

@freakk82
Copy link
Author

Thanks, the sample you sent plays, but with the stream I have to use it fails this check from extractor/FragmentedMp4Extractor.java at line 695:

private boolean readSample(ExtractorInput input) throws IOException, InterruptedException {
    if (sampleIndex == 0) {
      int bytesToSkip = (int) (fragmentRun.dataPosition - input.getPosition());
      checkState(bytesToSkip >= 0, "Offset to sample data was negative.");
      input.skipFully(bytesToSkip);
    }
[...]

In my case bytesToSkip is always -61, and it throws the error.

@ojw28
Copy link
Contributor

ojw28 commented Jan 18, 2016

That suggests malformed media. There's nothing we can do to assist unless you can provide a test stream.

@freakk82
Copy link
Author

Since I'm not allowed to publish the live stream url, could you please send me a PM ( ffr3akk@gmail.com )?

@ojw28
Copy link
Contributor

ojw28 commented Jan 18, 2016

Please provide the stream to dev.exoplayer@gmail.com. Thanks.

@ojw28
Copy link
Contributor

ojw28 commented Jan 18, 2016

I think the data_offset field in the trun boxes is set incorrectly in the underlying fragmented mp4 streams. You'll probably need to fix this to get your samples playing in ExoPlayer.

@freakk82
Copy link
Author

That's quite unfortunate. Given that the same streams are playing on Smart TVs, STBs and an old version of the Exoplayer, an incompatibility with the new Exoplayer is not going to be enough for the content provider to work on the streams.
Thanks for the feedback anyway.

@ojw28
Copy link
Contributor

ojw28 commented Jan 19, 2016

If I've diagnosed this correctly, the only reason the streams worked previously is because we were completely ignoring the data offset. It's likely that some other platforms do this too, but it's essentially incorrect and causes parsing failures for legitimate streams that contain non-sample data at the beginning of their mdat boxes.

As a local workaround, it appears you can simply comment out the block of code where the failure occurs.

@freakk82
Copy link
Author

Commenting that block the video plays, I wasn't sure of what other side effects it might bring. I will let the content provider know about the issue.
Thank you very much for the explanation.

ojw28 added a commit that referenced this issue Jan 4, 2017
We've seen this issue reported three times now, so it's
obviously not an isolated problem. Do you think anything
bad will happen to non-SmoothStreaming playback cases if
I do this? I suspect not, but if you feel strongly I can
easily add a FLAG_WORKAROUND_X flag for it, and enable
it for SmoothStreaming only.

#2292
#2101
#1152

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=143583714
ojw28 added a commit that referenced this issue Jan 4, 2017
We've seen this issue reported three times now, so it's
obviously not an isolated problem. Do you think anything
bad will happen to non-SmoothStreaming playback cases if
I do this? I suspect not, but if you feel strongly I can
easily add a FLAG_WORKAROUND_X flag for it, and enable
it for SmoothStreaming only.

#2292
#2101
#1152

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=143583714
@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.
Projects
None yet
Development

No branches or pull requests

2 participants