diff --git a/CHANGELOG.md b/CHANGELOG.md index b18fd84..16ba5b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ #Changelog +## bliss 5.2.3 +* Fix a bug with some broken MP3 files +* Bump ffmpeg to 5.1.0 + ## bliss 0.5.0 * Add support for CUE files. * Add `album_artist` and `duration` to `Song`. diff --git a/Cargo.lock b/Cargo.lock index 1a00d18..9222bab 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -85,7 +85,7 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bliss-audio" -version = "0.5.2" +version = "0.5.3" dependencies = [ "anyhow", "bliss-audio-aubio-rs", diff --git a/Cargo.toml b/Cargo.toml index ddaa763..af16130 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bliss-audio" -version = "0.5.2" +version = "0.5.3" authors = ["Polochon-street "] edition = "2018" license = "GPL-3.0-only" diff --git a/src/song.rs b/src/song.rs index 374125b..a6044a5 100644 --- a/src/song.rs +++ b/src/song.rs @@ -664,7 +664,16 @@ fn resample_frame( )) })?; let mut resampled = ffmpeg::frame::Audio::empty(); + let mut something_happened = false; for decoded in rx.iter() { + if in_codec_format != decoded.format() + || in_channel_layout != decoded.channel_layout() + || in_rate != decoded.rate() + { + warn!("received decoded packet with wrong format; file might be corrupted."); + continue; + } + something_happened = true; resampled = ffmpeg::frame::Audio::empty(); resample_context .run(&decoded, &mut resampled) @@ -673,6 +682,9 @@ fn resample_frame( })?; push_to_sample_array(&resampled, &mut sample_array); } + if !something_happened { + return Ok(sample_array); + } // TODO when ffmpeg-next will be active again: shouldn't we allocate // `resampled` again? loop {