-
Notifications
You must be signed in to change notification settings - Fork 139
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
Add frameDuration attribute to OpusEncoderConfig #551
Add frameDuration attribute to OpusEncoderConfig #551
Conversation
@@ -131,6 +131,7 @@ | |||
<xmp> | |||
dictionary OpusEncoderConfig { | |||
OpusBitstreamFormat format = "opus"; | |||
[EnforceRange] unsigned long frameDuration; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably be "long long" and in microseconds like all other time fields in WebCodecs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we do find duration in audioData is in microseconds,
as described in #371 ,
frameSize = numberOfChannels*sampleRate * frameDuration / 1000
most audio encoder use millseconds as frame duration(opus ptime for example), we can change it to micoseconds, then ,the frameSize Calculation will be:
frameSize = numberOfChannels*sampleRate * frameDuration / 1000/1000
Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dalecurtis Do you see the new commit according to your comments? This is my first PR that need some modifications, I'm afraid of missing an important action.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can see the new commits. This issue will be discussed at TPAC next week, so we might hold off on merging this PR until those discussions happen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I defer to Thomas for the final decision, I was just driving by.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you say, Opus ptimes have a limited set of values, are expressed in ms and are rounded up. So if you're willing to make the lowest frameDuration
3 instead of 2.5, you don't really need microseconds.
…ng, and meaning of it to microseconds as well
We probably want to have something to do the error checking/validation/rounding to nearest here. Only a very small set of numbers is valid. What happens if you pass something that Opus can't work with? |
if we want add error checking, it should be run in audioencoder configure method, by checking the validation of AudioEncodeConfig, Add one more check step like this: |
I think the allowable values are a bit broader. From RFC 7587 Section 6.1: " ptime: the preferred duration of media represented by a packet |
I think we are trying to avoid codec-specific steps in the main spec. We could instead add a generic validation step referring to the registries, along the lines of "If the current There is probably better wording though. |
I agree with @tguilbert-google. |
…g; add validation checking steps to it
We add a new commit according to the disscussion above, please take a review. @tguilbert-google |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Latest commit looks good % comments.
FYI, I will be generally unavailable in the next week and a half.
index.src.html
Outdated
2. Return `true`. | ||
2. If the current codec's registry defines a codec-specific additional configuration | ||
validation steps, run the algorithm defined in the registry. If the return | ||
value is `false`, return it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about:
2. If the {{AudioEncoderConfig}} has a codec-specific extension and the corresponding
registration in the [[WEBCODECS-CODEC-REGISTRY]] defines steps to check whether the
the extension is a valid extension, return the result of running those steps.
3. Return `true`.
opus_codec_registration.src.html
Outdated
To check if an {{OpusEncoderConfig}} is a valid OpusEncoderConfig, | ||
run these steps: | ||
1. If {{OpusEncoderConfig/frameDuration}} is not a valid ptime value, | ||
which is described in section 6.1 of [[RFC6381]], return `false`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this is the right RFC/section. Should this be Section 6.1 of rfc7587?
Defer to @aboba.
I also don't know if there's a way to directly link to a section from the [[RFC...]]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, It's a wrong reference. It should be rfc7587.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, RFC 7587 Section 6.1 makes more sense. We typically link to the RFC and include the Section # but not link to it.
opus_codec_registration.src.html
Outdated
}; | ||
</xmp> | ||
</pre> | ||
|
||
To check if an {{OpusEncoderConfig}} is a valid OpusEncoderConfig, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: <dfn>valid OpusEncoderConfig</dfn>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cause there is not a more detail dfn about "valid OpusEncoderConfig", maybe a clever desc is:
To check if an {{OpusEncoderConfig}} is valid,
......
another commit, please review it. |
opus_codec_registration.src.html
Outdated
}; | ||
</xmp> | ||
</pre> | ||
|
||
To check if an {{OpusEncoderConfig}} is valid, run these steps: | ||
1. If {{OpusEncoderConfig/frameDuration}} is not a valid ptime value, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: should ptime be ptime
? (wrapped with backticks?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it should be.
Assuming no objections from @padenot, I am merging this change. Chromium implementation work will be tracked in crbug.com/1372152 |
Thanks for the PR! |
…der-config SHA: eab6c4d Reason: push, by @tguilbert-google Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…der-config SHA: eab6c4d Reason: push, by @tguilbert-google Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…der-config SHA: eab6c4d Reason: push, by @tguilbert-google Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…der-config SHA: eab6c4d Reason: push, by @tguilbert-google Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…der-config SHA: eab6c4d Reason: push, by @tguilbert-google Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…der-config SHA: eab6c4d Reason: push, by @tguilbert-google Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…der-config SHA: eab6c4d Reason: push, by @tguilbert-google Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…der-config SHA: eab6c4d Reason: push, by @tguilbert-google Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…der-config SHA: eab6c4d Reason: push, by @tguilbert-google Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…der-config SHA: eab6c4d Reason: push, by @tguilbert-google Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…der-config SHA: eab6c4d Reason: push, by @tguilbert-google Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…der-config SHA: eab6c4d Reason: push, by @tguilbert-google Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…der-config SHA: eab6c4d Reason: push, by @tguilbert-google Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…der-config SHA: eab6c4d Reason: push, by @tguilbert-google Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…der-config SHA: eab6c4d Reason: push, by @tguilbert-google Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This fixes #371
Preview | Diff