/// Computes the number of bytes needed to represent the given duration, for the given audio format.
/// Returns None if the duration is negative.
Computes the number of bytes needed to represent the given duration, for the given audio format.
Returns None if the duration is negative.
Computes the number of bytes needed to represent the given duration for the given audio format . Returns None if the duration is negative .
pub fn bytes_for_duration(
    duration: zx::Duration,
    stream_type: fidl_fuchsia_media::AudioStreamType,
) -> Option<usize> {
    let nsec = cast::<i64, usize>(duration.into_nanos())?;
    let fps = cast::<u32, usize>(stream_type.frames_per_second)?;
    Some(nsec * fps * bytes_per_frame(stream_type) / 1_000_000_000)
}
pub fn bytes_for_duration ( duration : zx :: Duration , stream_type : fidl_fuchsia_media :: AudioStreamType , ) -> Option < usize > { let nsec = cast :: < i64 , usize > ( duration . into_nanos ( ) ) ? ; let fps = cast :: < u32 , usize > ( stream_type . frames_per_second ) ? ; Some ( nsec * fps * bytes_per_frame ( stream_type ) / 1_000_000_000 ) }
Computes the number of bytes needed to represent the given duration, for the given audio format.
Computes the number of bytes needed to represent the given duration for the given audio format .
duration
zx::Duration
stream_type
fidl_fuchsia_media::AudioStreamType