Add frameDuration attribute to OpusEncoderConfig - #551
Conversation
| <xmp> | ||
| dictionary OpusEncoderConfig { | ||
| OpusBitstreamFormat format = "opus"; | ||
| [EnforceRange] unsigned long frameDuration; |
There was a problem hiding this comment.
Should probably be "long long" and in microseconds like all other time fields in WebCodecs.
There was a problem hiding this comment.
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.
@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.
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.
I defer to Thomas for the final decision, I was just driving by.
There was a problem hiding this comment.
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 |
tguilbert-google
left a comment
There was a problem hiding this comment.
Latest commit looks good % comments.
FYI, I will be generally unavailable in the next week and a half.
| 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.
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`.
| 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.
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.
Yes, It's a wrong reference. It should be rfc7587.
There was a problem hiding this comment.
Yes, RFC 7587 Section 6.1 makes more sense. We typically link to the RFC and include the Section # but not link to it.
| </xmp> | ||
| </pre> | ||
|
|
||
| To check if an {{OpusEncoderConfig}} is a valid OpusEncoderConfig, |
There was a problem hiding this comment.
NIT: <dfn>valid OpusEncoderConfig</dfn>
There was a problem hiding this comment.
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. |
| </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.
NIT: should ptime be ptime? (wrapped with backticks?)
|
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