Skip to content

MP3 decoder ignores ENC_DELAY and ENC_PADDING #402

@NekoAlosama

Description

@NekoAlosama

As an example, this file has ENC_DELAY = 576 and ENC_PADDING = 1119 according to foobar2000.
11 HYDR6C0DON$ $$$ PROD BY SIGMAR DELTA.mp3

First, Symphonia doesn't read and save the ENC_DELAY and ENC_PADDING to track.codec_params.delay and track.codec_params.padding, respectively.

Second, even if .delay and .padding has Some value, the decoder ignores these values and decodes the silence anyways, so now the decoded music is longer by ENC_DELAY + ENC_PADDING. I can't tell whether FormatOptions' .enable_gapless is or should be incorporated into whether silence is decoded or not, but changing it does nothing.

Code snippet:

// 5
// 6
let mut format_ops = FormatOptions::default();
format_ops.enable_gapless = true;

let probe_result = probe.format(
    Hint::new().with_extension("flac"),
    mss,
    &format_ops,
    &MetadataOptions::default(),
)?;
let mut format = probe_result.format;

// 7
let mut track = format
    .tracks()
    .iter()
    .find(|track| track.codec_params.codec != CODEC_TYPE_NULL)
    .expect("no supported audio tracks")
    .clone();

dbg!(track.codec_params.delay);
dbg!(track.codec_params.padding);
track.codec_params.with_delay(576);
track.codec_params.with_padding(1119);
dbg!(track.codec_params.delay);
dbg!(track.codec_params.padding);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions