Skip to content

Commit

Permalink
remove unused as/from buffer_offset methods
Browse files Browse the repository at this point in the history
  • Loading branch information
haileys committed Feb 14, 2024
1 parent 8744423 commit fb6191f
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions bark-protocol/src/time.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::packet;
use crate::types::TimestampMicros;
use crate::{SAMPLE_RATE, FRAMES_PER_PACKET, CHANNELS};
use crate::{SAMPLE_RATE, FRAMES_PER_PACKET};

/// A timestamp with implicit denominator SAMPLE_RATE
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
Expand Down Expand Up @@ -81,18 +81,6 @@ impl SampleDuration {
core::time::Duration::from_micros(usecs)
}

pub fn as_buffer_offset(&self) -> usize {
let offset = self.0 * u64::from(CHANNELS);
usize::try_from(offset).unwrap()
}

pub fn from_buffer_offset(offset: usize) -> Self {
let channels = usize::from(CHANNELS);
assert!(offset % channels == 0);

SampleDuration(u64::try_from(offset / channels).unwrap())
}

pub fn add(&self, other: SampleDuration) -> Self {
SampleDuration(self.0.checked_add(other.0).unwrap())
}
Expand Down

0 comments on commit fb6191f

Please sign in to comment.