From: Kostya Shishkov Date: Fri, 30 Jun 2023 16:22:40 +0000 (+0200) Subject: sndplay: support playing AAC with SBR X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=7b7b426d726457b8cd48baefb6242cbda0fd7f01;p=nihav-player.git sndplay: support playing AAC with SBR --- diff --git a/sndplay/src/main.rs b/sndplay/src/main.rs index c368651..4741853 100644 --- a/sndplay/src/main.rs +++ b/sndplay/src/main.rs @@ -303,8 +303,16 @@ impl Player { } let (dsupp, decoder) = dec.unwrap(); - let ainfo = ainfo.unwrap().get_properties().get_audio_info().unwrap(); - let arate = if ainfo.sample_rate > 0 { ainfo.sample_rate } else { 44100 }; + let info = ainfo.unwrap(); + let ainfo = info.get_properties().get_audio_info().unwrap(); + let sbr_hack = info.get_name() == "aac" && ainfo.sample_rate < 32000; + let arate = if ainfo.sample_rate > 0 { + if !sbr_hack { + ainfo.sample_rate + } else { + ainfo.sample_rate * 2 + } + } else { 44100 }; let ch = ainfo.channels; println!("Playing {} [{}Hz {}ch]", name, arate, ch);