Skip to content

Panic when calling loudness_range #43

Closed
@overdrivenpotato

Description

Hello, thanks for making this library :-)

There seems to be a bug when calling loudness_range that occasionally triggers a panic. I've attached a stack trace with the relevant calls below. I've tried unsuccessfully to build a repro case but in my application the error is somewhat rare. Even with the same input data every time, it will fail spuriously about 1% of the time. For some context, I'm testing with a ~40 second 96kHz stereo clip buffered in as f32 samples.

panicked at 'called `Option::unwrap()` on a `None` value', /Users/marko/.cargo/registry/src/github.com-1ecc6299db9ec823/ebur128-0.1.5/src/history.rs:433:67
stack backtrace:
   0:        0x1001d1d44 - std::backtrace_rs::backtrace::libunwind::trace::h3440e89bdeed3ddf
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:        0x1001d1d44 - std::backtrace_rs::backtrace::trace_unsynchronized::hfa68bcc7baf06ad7
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:        0x1001d1d44 - std::sys_common::backtrace::_print_fmt::h483e161a2ffbfba4
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/sys_common/backtrace.rs:67:5
   3:        0x1001d1d44 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h34f76b2ca42fab41
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/sys_common/backtrace.rs:46:22
   4:        0x1001ef37d - core::fmt::write::h8f13d857463c51c1
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/core/src/fmt/mod.rs:1078:17
   5:        0x1001ce326 - std::io::Write::write_fmt::h013bead77842bdd6
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/io/mod.rs:1517:15
   6:        0x1001d3db9 - std::sys_common::backtrace::_print::h7f3525175df798e8
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/sys_common/backtrace.rs:49:5
   7:        0x1001d3db9 - std::sys_common::backtrace::print::hf68eec1a3c535c32
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/sys_common/backtrace.rs:36:9
   8:        0x1001d3db9 - std::panicking::default_hook::{{closure}}::hb14d90e928578cc7
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/panicking.rs:208:50
   9:        0x1001d3976 - std::panicking::default_hook::h460969f1dc8f738d
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/panicking.rs:222:9
  10:        0x1001d443b - std::panicking::rust_panic_with_hook::h28bf9d6c3916221e
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/panicking.rs:591:17
  11:        0x1001d3f39 - std::panicking::begin_panic_handler::{{closure}}::h99569328be4adae9
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/panicking.rs:495:13
  12:        0x1001d21e8 - std::sys_common::backtrace::__rust_end_short_backtrace::h9a7e5cc6475b496b
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/sys_common/backtrace.rs:141:18
  13:        0x1001d3eca - rust_begin_unwind
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/panicking.rs:493:5
  14:        0x1001fb3af - core::panicking::panic_fmt::h65997884a2662b8c
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/core/src/panicking.rs:92:14
  15:        0x1001fb307 - core::panicking::panic::h2ca2e9d2b0a1f2bf
                               at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/core/src/panicking.rs:50:5
  16:        0x100189cad - core::option::Option<T>::unwrap::hdeee087517023990
                               at /Users/marko/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/option.rs:386:21
  17:        0x100189cad - ebur128::history::History::loudness_range_multiple::{{closure}}::h1a0ff08728c0cb3b
                               at /Users/marko/.cargo/registry/src/github.com-1ecc6299db9ec823/ebur128-0.1.5/src/history.rs:433:50
  18:        0x100189cad - core::slice::<impl [T]>::sort_unstable_by::{{closure}}::hc07c59363457d04f
                               at /Users/marko/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/slice/mod.rs:2066:38
  19:        0x100189cad - core::slice::sort::shift_tail::h7ec07b4e8c340c30
                               at /Users/marko/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/slice/sort.rs:100:24
  20:        0x100189dae - core::slice::sort::insertion_sort::h74c03aa25773ab0d
                               at /Users/marko/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/slice/sort.rs:177:9
  21:        0x100189dae - core::slice::sort::recurse::h16dae32c7768ff6f
                               at /Users/marko/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/slice/sort.rs:687:13
  22:        0x10018b5f4 - core::slice::sort::quicksort::h89c7abc843bf1a67
                               at /Users/marko/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/slice/sort.rs:768:5
  23:        0x10018b5f4 - core::slice::<impl [T]>::sort_unstable_by::hd97a30f3bafd244c
                               at /Users/marko/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/slice/mod.rs:2066:9
  24:        0x10018b5f4 - ebur128::history::History::loudness_range_multiple::hc7e4bb112053e86c
                               at /Users/marko/.cargo/registry/src/github.com-1ecc6299db9ec823/ebur128-0.1.5/src/history.rs:433:17
  25:        0x10018698d - ebur128::history::History::loudness_range::h10766b0a6c5a0aa1
                               at /Users/marko/.cargo/registry/src/github.com-1ecc6299db9ec823/ebur128-0.1.5/src/history.rs:377:9
  26:        0x10018698d - ebur128::ebur128::EbuR128::loudness_range::h4efb27ac08702281
                               at /Users/marko/.cargo/registry/src/github.com-1ecc6299db9ec823/ebur128-0.1.5/src/ebur128.rs:831:12
...[snip]...

Activity

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

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions