Skip to content

Commit

Permalink
adts: moved ensure_seekback_buffer so when obtaining total_len fails,…
Browse files Browse the repository at this point in the history
… it's not executed
  • Loading branch information
dedobbin committed Oct 9, 2023
1 parent 51447ca commit d2fb79b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions symphonia-codec-aac/src/adts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,16 +271,17 @@ fn aproximate_frame_count(mut source: &mut MediaSourceStream) -> Option<u64> {
// TODO: make dynamic?
const MAX_FRAMES: u32 = 20;
const MAX_BYTES: usize = 8000;
source.ensure_seekback_buffer(MAX_BYTES);
let original_pos = source.pos();

let total_len = match source.byte_len() {
Some(len) => len - original_pos,
_ => return {
None
},
};


source.ensure_seekback_buffer(MAX_BYTES);

macro_rules! calculate_n_frames {
($n_bytes:expr, $parsed_n_frames:expr, $total_len:expr) => {
{
Expand Down

0 comments on commit d2fb79b

Please sign in to comment.