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

Packaging fails if input content contains SampleGroupDescriptionBox with 0 entries #812

Closed
ghost opened this issue Aug 5, 2020 · 3 comments
Labels
status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Milestone

Comments

@ghost
Copy link

ghost commented Aug 5, 2020

Operating System: <e.g. kALI LINUX 2019.4>
Shaka Packager Version: <e.g. v2.4.3>
I used the "built from source" method to build the packager on my kali machine. No errors. It seemed like it will work fine.

Issue and steps to reproduce the problem

Then i run this simple command to test
./packager in=/root/video.mp4 --dump_stream_info
Packager Command:
./packager in=/root/video.mp4 --dump_stream_info
Extra steps to reproduce the problem?
(1)Just follow the third method which is "built from source" and build the packager.
(2)then just run a simple command and it is not working

What is the expected result?
It should dump the stream_info for the media file.
What happens instead?
It rather shows this error

[0806/022106:INFO:demuxer.cc(88)] Demuxer::Run() on file 'video.mp4'.
[0806/022106:INFO:demuxer.cc(160)] Initialize Demuxer for file 'video.mp4'.
[0806/022107:ERROR:box_definitions.cc(1062)] Failure while processing: count != 0
[0806/022107:ERROR:box_reader.h(146)] Failure while processing: child_itr->Parse(itr->second.get())
[0806/022107:ERROR:box_definitions.cc(1185)] Failure while processing: buffer->reader()->TryReadChildren(&sample_group_descriptions) && buffer->reader()->TryReadChildren(&sample_to_groups)
[0806/022107:ERROR:box_reader.cc(97)] Failure while processing: child->Parse(itr->second.get())
[0806/022107:ERROR:box_definitions.cc(2167)] Failure while processing: ReadWriteHeaderInternal(buffer) && buffer->PrepareChildren() && buffer->ReadWriteChild(&dinf) && buffer->ReadWriteChild(&sample_table)
[0806/022107:ERROR:box_reader.cc(97)] Failure while processing: child->Parse(itr->second.get())
[0806/022107:ERROR:box_definitions.cc(2230)] Failure while processing: buffer->ReadWriteChild(&information)
[0806/022107:ERROR:box_reader.cc(97)] Failure while processing: child->Parse(itr->second.get())
[0806/022107:ERROR:box_definitions.cc(2252)] Failure while processing: ReadWriteHeaderInternal(buffer) && buffer->PrepareChildren() && buffer->ReadWriteChild(&header) && buffer->ReadWriteChild(&media) && buffer->TryReadWriteChild(&edit) && buffer->TryReadWriteChild(&sample_encryption)
[0806/022107:ERROR:box_reader.h(146)] Failure while processing: child_itr->Parse(itr->second.get())
[0806/022107:ERROR:box_reader.h(129)] Failure while processing: TryReadChildren(children) && !children->empty()
[0806/022107:ERROR:box_definitions.cc(2351)] Failure while processing: reader->ReadChildren(&tracks) && reader->TryReadChild(&extends) && reader->TryReadChildren(&pssh)
[0806/022107:ERROR:mp4_media_parser.cc(377)] Failure while processing: moov_->Parse(reader)
[0806/022107:ERROR:packager_main.cc(552)] Packaging Error: 8 (PARSER_FAILURE): Cannot parse media file video.mp4

<Please attach the input files or email to shaka-packager-issues@google.com.>
shakaaaa

@kqyang
Copy link
Collaborator

kqyang commented Aug 5, 2020

@Akata01 Thanks for the bug report.

The code fails at https://github.com/google/shaka-packager/blob/540c0aaffbb2c55e156991f6c1717da44ace5ba1/packager/media/formats/mp4/box_definitions.cc#L1062.

A SampleGroupDescriptionBox (sgpd) with 0 number of entries is meaningless, but we shouldn't error out.

A possible fix is to change the code to:

if (buffer->Reading()) {
  if (count == 0)
    return true;
} else {
  RCHECK(count != 0);
}

Are you interested in sending a PR to us to fix it?

@kqyang kqyang added type: bug Something isn't working correctly and removed needs triage labels Aug 5, 2020
@kqyang kqyang changed the title cannot parse media file Packaging fails if input content contains SampleGroupDescriptionBox with 0 entries Aug 5, 2020
@shaka-bot shaka-bot added this to the v2.5 milestone Aug 5, 2020
@ghost
Copy link
Author

ghost commented Aug 6, 2020

@kqyang i made the changes you suggested in box_defentions.cc and rebulit it and it worked.
Yes i am interested in making the PR.
Here is the result
finalcheck

@kqyang kqyang added the flag: seeking PR We are actively seeking PRs for this; we do not currently expect the core team will resolve this label Aug 6, 2020
@kqyang kqyang assigned ghost Aug 6, 2020
@kqyang kqyang removed the flag: seeking PR We are actively seeking PRs for this; we do not currently expect the core team will resolve this label Aug 6, 2020
@kqyang
Copy link
Collaborator

kqyang commented Aug 6, 2020

Cool. Thanks. Looking forward to your PR!

@kqyang kqyang closed this as completed in 6298f49 Aug 10, 2020
@shaka-bot shaka-bot added the status: archived Archived and locked; will not be updated label Oct 9, 2020
@shaka-project shaka-project locked and limited conversation to collaborators Oct 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Projects
None yet
Development

No branches or pull requests

2 participants