-
Notifications
You must be signed in to change notification settings - Fork 4
opus: Handle large comment headers #1
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
Conversation
|
LMS had problems scanning many of my opus files without this fix. I think this should fix andygrundman#7. |
133c495 to
856f1c2
Compare
|
@robho RFC 7845 does not actually specify this, as far as I can see. It only requires that the first and last (if different) comment page(s) set a zero granule position, and is silent about the intermediate pages. So it is “legal” for an opus file to have “intermediate” comment pages with a zero granule position. In such cases Thoughts ? |
|
RFC 7845 says:
So, a zero granule position for intermediate pages shouldn't exist, IMHO. (The opus file attached to this PR has granule position == -1 in the intermediate pages. It's encoded by |
After reading the RFC again, I agree. I had initially thought that that paragraph applied only to audio packets. In which case one would have needed to resort to examining "lacing values" in the stream to detect intermediate pages. Perfectly do-able, but rather more complicated. Your proposal is much more straightforward.
The only other encoder I have tried is I think this is a worthwhile change. Scanning issues will inevitably arise if/when LMS users start to make use of ogg/opus, unless Perhaps it should be offered up to https://github.com/andygrundman/Audio-Scan. |
|
Can't say about the change itself... but would you mind adding a line to the change log (https://github.com/LMS-Community/Audio-Scan/blob/master/Changes)? |
A comment header may span multiple pages and in such situations we need to delay parsing until we have read all pages which belong to the comment header packet. The final page in the comment header packet is marked by setting "granule position" to zero. It's common to have comment headers spanning multiple pages when album art is embedded in an opus file. A single page can contain 65025 bytes so if tags + picture needs more space then additional pages are needed.
856f1c2 to
4053bce
Compare
There's a reference to this fix in andygrundman#7 so they can take a look at this fix if/when they want to work on the issue.
Done. |
Here it is: andygrundman#13 |
A comment header may span multiple pages and in such situations we need to delay parsing until we have read all pages which belong to the comment header packet. The final page in the comment header packet is marked by setting "granule position" to zero.
It's common to have comment headers spanning multiple pages when album art is embedded in an opus file. A single page can contain 65025 bytes so if tags + picture needs more space then additional pages are needed.