orottier / web-audio-api-rs

A Rust implementation of the Web Audio API, for use in non-browser contexts
https://docs.rs/web-audio-api/
MIT License
293 stars 16 forks source link

Improve error messages in decode_audio_data #89

Open orottier opened 2 years ago

orottier commented 2 years ago

One small thing is that the error messages are a bit confusing, nothing really important but maybe it would be better to override them with some generic message (at contrary it would possibly make further debugging more complicated, don't really know)

> --------------------------------
> Error decoding audio file: "samples/empty_2c.wav"
> IoError(Custom { kind: UnexpectedEof, error: "end of stream" })
> --------------------------------
> --------------------------------
> Error decoding audio file: "samples/corrupt.wav"
> IoError(Custom { kind: UnexpectedEof, error: "end of stream" })
> --------------------------------
> --------------------------------
> Error decoding audio file: "samples/sample.aiff"
> DecodeError("mp3: invalid mpeg audio layer")
> --------------------------------
> --------------------------------
> Error decoding audio file: "samples/sample.webm"
> DecodeError("mp3: invalid main_data_begin")
> --------------------------------

Originally posted by @b-ma in https://github.com/orottier/web-audio-api-rs/issues/87#issuecomment-1009168174

orottier commented 2 years ago

Tangential discussion at https://github.com/WebAudio/web-audio-api/issues/2321 Suggesting occasional decoding errors should be ignored but logged.

orottier commented 2 years ago

Notice we have upgraded the symphonia lib since creating this ticket. Situation may already be better now

b-ma commented 2 years ago

Actually the webm message changed... but not much more clear :)

> --------------------------------
> Error decoding audio file: "samples/sample.webm"
> IoError(Custom { kind: UnexpectedEof, error: "end of stream" })
> --------------------------------

it easy to check with cargo run --example decoding the failing formats are at the end