Skip to content

Print Error Message for Bad AVC Profile - #106

Open
dukesook wants to merge 2 commits into
gpac:masterfrom
dukesook:avc-profile
Open

Print Error Message for Bad AVC Profile#106
dukesook wants to merge 2 commits into
gpac:masterfrom
dukesook:avc-profile

Conversation

@dukesook

Copy link
Copy Markdown
Contributor

A common error for the avcC box is providing profile values despite AVCProfileIndication variable saying there shouldn't be.

This PR prints an additional message informing the user of the issue.

@rbouqueau

Copy link
Copy Markdown
Member

I'm not sure this test belongs here. Parsing may fail e.g. with truncated boxes. I'm ok to stop parsing with some exception - and why not find a mecanism to display the message from the exception.

What do you think?

PS: typo: AVCProfileIndiciation should be AVCProfileIndication

@dukesook

Copy link
Copy Markdown
Contributor Author

I originally changed

    } catch(...) {
      fprintf(stderr, "Failed to parse box: '%s'\n", toString(subReader.myBox.fourcc).c_str());
      exit(1);
    }

to

    } catch(const std::exception &e) {
      fprintf(stderr, "%s\n", e.what());
      fprintf(stderr, "Failed to parse box: '%s'\n", toString(subReader.myBox.fourcc).c_str());
      exit(1);
    }

But this changed the output for many .ref test files, so running check failed.

@rbouqueau

Copy link
Copy Markdown
Member

Changing a lot of .ref files is not an issue. But I feel the rationale for this change is something else: an ISOBMFF box is truncated and CW keeps on processing without any warning. Is that correct?

If so, we could evaluate a bunch of options:

  • Display error inside br->sym(); calls when there are not enough bits left in the bitstream (maybe injecting some context inside the bitstream reader to improve the error message?).
  • Add option parsing errors fatal (but only once parsing is completed). I think CW should be liberal in what it accepts by default.

What do you think?

@dukesook

Copy link
Copy Markdown
Contributor Author

an ISOBMFF box is truncated and CW keeps on processing without any warning

No, the bit reader immediately throws an error:

  if(AVCProfileIndication != 66 && AVCProfileIndication != 77 && AVCProfileIndication != 88) {
    br->sym("reserved9", 6); // Throws Error!
  ENSURE(byteOffset < size, "BitReader::bit() overflow");

The CW stops processing and prints:
Failed to parse box: accC

Sample File: bad-avcC.box

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants