Skip to content

Commit

Permalink
proper formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
dedobbin committed Oct 9, 2023
1 parent d2fb79b commit 8c807be
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions symphonia-codec-aac/src/adts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,27 +272,27 @@ fn aproximate_frame_count(mut source: &mut MediaSourceStream) -> Option<u64> {
const MAX_FRAMES: u32 = 20;
const MAX_BYTES: usize = 8000;
let original_pos = source.pos();

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

source.ensure_seekback_buffer(MAX_BYTES);

macro_rules! calculate_n_frames {
($n_bytes:expr, $parsed_n_frames:expr, $total_len:expr) => {
{
let parsed_n_frames_value = $parsed_n_frames as u64;
if parsed_n_frames_value == 0 {
None
} else {
Some($total_len / ($n_bytes as u64 / parsed_n_frames_value) as u64 * SAMPLES_PER_AAC_PACKET)
}
($n_bytes:expr, $parsed_n_frames:expr, $total_len:expr) => {{
let parsed_n_frames_value = $parsed_n_frames as u64;
if parsed_n_frames_value == 0 {
None
}
};
else {
Some(
$total_len / ($n_bytes as u64 / parsed_n_frames_value) as u64
* SAMPLES_PER_AAC_PACKET,
)
}
}};
}

let mut parsed_n_frames = 0;
Expand All @@ -310,7 +310,7 @@ fn aproximate_frame_count(mut source: &mut MediaSourceStream) -> Option<u64> {
};
n_bytes += AdtsHeader::SIZE;

if n_bytes + header.frame_len >= MAX_BYTES{
if n_bytes + header.frame_len >= MAX_BYTES {
break calculate_n_frames!(n_bytes, parsed_n_frames, total_len);
}

Expand Down

0 comments on commit 8c807be

Please sign in to comment.