Skip to content
New issue

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

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

Already on GitHub? # to your account

fail to parse invalid init segment #90

Open
rillian opened this issue Apr 13, 2017 · 10 comments
Open

fail to parse invalid init segment #90

rillian opened this issue Apr 13, 2017 · 10 comments

Comments

@rillian
Copy link
Contributor

rillian commented Apr 13, 2017

From this gecko bug we fail to parse the init segment from http://dash.edgesuite.net/envivio/Envivio-dash2/v4_258-Header.m4s with "unexpected EOF".

This is invalid, but stagefright appears to handle it.

@alfredoyang
Copy link
Contributor

Something happens in read_es_descriptor(), checking now.

@alfredoyang
Copy link
Contributor

Ok, I think I found the problem, followings are its esds data:

000001d0: 00bb 8000 0000 0000 2a65 7364 7300 0000 ........*esds...
000001e0: 0003 801b 0000 0004 8012 4015 0006 0000 ..........@.....
000001f0: 01fe f000 0000 0005 8002 1190 0601 0200 ................
00000200: 0000 1073 7474 7300 0000 0000 0000 0000 ...stts.........

The es_descriptor data is 0003 801b 0000 00, 80 is the optional extended descriptor type tag.

The optional extended descriptor type should be three bytes 80 80 80; however, there is only one byte in this sample. So it causes a problem in https://github.com/mozilla/mp4parse-rust/blob/master/mp4parse/src/lib.rs#L1331.

I can't find spec mention about this [1] but stagefright just ignores the 80 regardless how many bytes it has. So here I'll file a PR which just ignores the 80 up to three bytes.

[1] 14496-1 7.3.3.2

@jyavenard
Copy link
Contributor

if we make no use of that box content, why not skip it entirely?

@alfredoyang
Copy link
Contributor

That's what we do, but we need to calculate the length of es_descriptor to skip it. In this case, the one byte 80 optional extended descriptor causes wrong length calculation.

@alfredoyang
Copy link
Contributor

#91

@jyavenard
Copy link
Contributor

I don't understand why you would need to read the content to calculate it size. The size that followed the box type is all that needed no?

Unless the box size is wrong, but if that was the case stage fright wouldn't read this file either..

@alfredoyang
Copy link
Contributor

alfredoyang commented Apr 15, 2017

Because dc_descriptor is inside es_descriptor, you can't know dc_descriptor location without parsing es_descriptor.
Skip the whole es_descriptor content means skipping dc_descriptor too. And we need dc_descriptor to get codec specific data.

@jyavenard
Copy link
Contributor

Sure. But do we care about dc_descriptor?

@alfredoyang
Copy link
Contributor

Yes, you need dc_descriptor to get object_profile and ds_descriptor is also inside dc_descriptor.
You need ds_descriptor to get sample rate, channel count ...etc.

@rillian
Copy link
Contributor Author

rillian commented Apr 18, 2017

@jyavenard is this the same alternate aac struct you had to work around stagefright not reporting?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants