meh/rust-ffmpeg

ffmpeg::Error(1313558101: Unknown error occurred) when playing wav in rust-openal play example

Boscop opened this issue · 0 comments

I changed the build.rs script of ffmpeg-sys so that it builds on windows msvc 32bit
and I had to change this line:
https://github.com/meh/rust-ffmpeg/blob/master/src/codec/encoder/encoder.rs#L73
to:

(*self.as_mut_ptr()).bit_rate = value as int64_t;

to get rust-ffmpeg to compile. Because it's the same here:
https://github.com/meh/rust-ffmpeg-sys/blob/master/src/avcodec/codec.rs#L935
and here: https://ffmpeg.org/doxygen/3.1/structAVCodecContext.html
ffmpeg requires version 2.8 of ffmpeg-sys, but the one in git is 3.0.0.
So I changed ffmpeg so it requires ffmpeg-sys 3.0.0 but when I tried to build ffmpeg with the path override, it said:
error: no matching package named ffmpeg-sys found (required by ffmpeg)
location searched: registry https://github.com/rust-lang/crates.io-index
version required: ^3.0.0
versions found: 2.8.9, 2.8.8, 2.8.7
So then I changed the requirement back to 2.8 and in ffmpeg-sys I changed the version to 2.8.0, then both built.
Is this the wrong thing to do?

Now I tried to run the play example of rust-openal which uses ffmpeg and it crashes:

D:\3rdparty\rust-openal>cargo run --example play "D:\samples\air-horn.wav"
warning: path override for crate `ffmpeg` has altered the original list of
dependencies; the dependency on `image` was either added or
modified to not match the previously resolved version

This is currently allowed but is known to produce buggy behavior with spurious
recompiles and changes to the crate graph. Path overrides unfortunately were
never intended to support this feature, so for now this message is just a
warning. In the future, however, this message will become a hard error.

To change the dependency graph via an override it's recommended to use the
`[replace]` feature of Cargo instead of the path override feature. This is
documented online at the url below for more information.

http://doc.crates.io/specifying-dependencies.html#overriding-dependencies

    Finished debug [unoptimized + debuginfo] target(s) in 0.0 secs
     Running `target\debug\examples\play.exe D:\samples\air-horn.wav`
[SWR @ 00829b20] Input channel count and layout are unset
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: ffm
peg::Error(1313558101: Unknown error occurred)', ../src/libcore\result.rs:799
stack backtrace:
   0:    0x7b298 - std::rt::lang_start::h14cbded5fe3cd915
   1:    0x7bb0a - std::panicking::rust_panic_with_hook::hcd9d05f53fa0dafc
   2:    0x7b9a6 - std::panicking::begin_panic_fmt::hb0a7126ee57cdd27
   3:    0x7b85b - rust_begin_unwind
   4:    0x486c5 - core::result::Result<ffmpeg::software::resampling::context::C
ontext, ffmpeg::util::error::Error>::unwrap<ffmpeg::software::resampling::contex
t::Context,ffmpeg::util::error::Error>
                at C:\bot\slave\nightly-dist-rustc-win-msvc-32\build\src\libcore
\result.rs:737
   5:    0x5c733 - play::decoder::{{closure}}<&collections::string::String>
                at D:\3rdparty\rust-openal\examples\play.rs:32
   6:    0x5a8cc - std::panic::{{impl}}::call_once<(),closure>
                at C:\bot\slave\nightly-dist-rustc-win-msvc-32\build\src\libstd\
panic.rs:255
   7:    0x458ea - std::panicking::try::do_call<std::panic::AssertUnwindSafe<clo
sure>,()>
                at C:\bot\slave\nightly-dist-rustc-win-msvc-32\build\src\libstd\
panicking.rs:356
   8:    0x7ecfb - __rust_maybe_catch_panic
   9:    0x45571 - std::panicking::try<(),std::panic::AssertUnwindSafe<closure>>

                at C:\bot\slave\nightly-dist-rustc-win-msvc-32\build\src\libstd\
panicking.rs:332
  10:    0x44697 - std::panic::catch_unwind<std::panic::AssertUnwindSafe<closure
>,()>
                at C:\bot\slave\nightly-dist-rustc-win-msvc-32\build\src\libstd\
panic.rs:311
  11:    0x5c236 - std::thread::{{impl}}::spawn::{{closure}}<closure,()>
                at C:\bot\slave\nightly-dist-rustc-win-msvc-32\build\src\libstd\
thread\mod.rs:277
  12:    0x54eac - alloc::boxed::{{impl}}::call_box<(),closure>
                at C:\bot\slave\nightly-dist-rustc-win-msvc-32\build\src\liballo
c\boxed.rs:595
  13:    0x79e6c - std::sys::thread::Thread::new::hf599b376c47e7cb9
  14: 0x76e07c03 - BaseThreadInitThunk
  15: 0x775bad1e - RtlInitializeExceptionChain
error: receiving on a closed channel

When I pass a mp3 instead, I get this:

D:\3rdparty\rust-openal>cargo run --example play "R:\data\music\D-music\vaporwav
e\Ford & Lopatin- Joey Rogers.mp3"
warning: path override for crate `ffmpeg` has altered the original list of
dependencies; the dependency on `image` was either added or
modified to not match the previously resolved version

This is currently allowed but is known to produce buggy behavior with spurious
recompiles and changes to the crate graph. Path overrides unfortunately were
never intended to support this feature, so for now this message is just a
warning. In the future, however, this message will become a hard error.

To change the dependency graph via an override it's recommended to use the
`[replace]` feature of Cargo instead of the path override feature. This is
documented online at the url below for more information.

http://doc.crates.io/specifying-dependencies.html#overriding-dependencies

    Finished debug [unoptimized + debuginfo] target(s) in 0.0 secs
     Running `target\debug\examples\play.exe "R:\data\music\D-music\vaporwave\Fo
rd & Lopatin- Joey Rogers.mp3"`
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: openal::
Error(Invalid enum parameter value.)', ../src/libcore\result.rs:799
stack backtrace:
   0:  0x109b298 - std::rt::lang_start::h14cbded5fe3cd915
   1:  0x109bb0a - std::panicking::rust_panic_with_hook::hcd9d05f53fa0dafc
   2:  0x109b9a6 - std::panicking::begin_panic_fmt::hb0a7126ee57cdd27
   3:  0x109b85b - rust_begin_unwind
   4:  0x106808a - core::result::Result<(), openal::error::Error>::unwrap<(),ope
nal::error::Error>
                at C:\bot\slave\nightly-dist-rustc-win-msvc-32\build\src\libcore
\result.rs:737
   5:  0x107b892 - play::main
                at D:\3rdparty\rust-openal\examples\play.rs:98
   6:  0x109ecfb - __rust_maybe_catch_panic
   7:  0x109ad10 - std::rt::lang_start::h14cbded5fe3cd915
   8:  0x107cd80 - main
   9: 0x76e07c03 - BaseThreadInitThunk
  10: 0x775bad1e - RtlInitializeExceptionChain
error: process didn't exit successfully: `target\debug\examples\play.exe R:\data
\music\D-music\vaporwave\Ford & Lopatin- Joey Rogers.mp3` (exit code: 101)

What am I doing wrong?