Closed Bug 868954 Opened 11 years ago Closed 11 years ago

[follow-up bug 842243] Handle padding in header of Opus encoder

Categories

(Core :: Audio/Video, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 868962

People

(Reporter: shelly, Assigned: shelly)

References

Details

According to bug 842243, comment 71
https://bugzilla.mozilla.org/show_bug.cgi?id=842243#c71

We should take care the padding when creating the id header of Opus encoder.

Original comment from :derf

@@ +330,5 @@
> +{
> +  switch (mEncoderStateInternal) {
> +  case ID_HEADER:
> +  {
> +    OpusIdHeader header(1, 0, kOpusSamplingRate, 0);

You should fill in the pre-skip using the OPUS_GET_LOOKAHEAD ctl instead of hard-coding it to 0 (see http://www.opus-codec.org/docs/html_api-1.0.2/group__opus__encoderctls.htmllook/), e.g.,

int lookahead;
int ret;
ret=opus_encoder_ctl(mEncoder, OPUS_GET_LOOKAHEAD(&lookahead));
if (ret != OPUS_OK) {
    lookahead = 0;
}

You should also be padding the input by this many samples at the start of encoding, or the original data will be lost.

See setup_padder() (and the associated read_padder) from opus-tools for an example of a good way to do this: <https://git.xiph.org/?p=opus-tools.git;a=blob;f=src/audio-in.c;hb=HEAD#l868>. I think it's okay to do the padding in a follow-up bug.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → DUPLICATE
Depends on: MediaEncoder
No longer depends on: MediaEncoder
You need to log in before you can comment on or make changes to this bug.