Skip to content

Support encoding 8KHz source #2

Description

@katyo

Currently encoders crashes for 8 KHz with the following:

---- lc3::test::lc3_encode stdout ----
thread 'lc3::test::lc3_encode' panicked at /home/kayo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lc3-codec-0.2.0/src/encoder/bandwidth_detector.rs:36:34:
attempt to subtract with overflow
stack backtrace:
   0: rust_begin_unwind
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/panicking.rs:72:14
   2: core::panicking::panic
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/panicking.rs:145:5
   3: lc3_codec::encoder::bandwidth_detector::BandwidthDetector::new
             at /home/kayo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lc3-codec-0.2.0/src/encoder/bandwidth_detector.rs:36:34
   4: lc3_codec::encoder::lc3_encoder::Lc3Encoder::new
             at /home/kayo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lc3-codec-0.2.0/src/encoder/lc3_encoder.rs:134:38

Seems it happened because fs_idx for 8KHz is 0:

SamplingFrequency::Hz8000 => (0, 8000),

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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