pub trait ShmStreamSource<E: Error>: Send {
    // Required method
    fn new_stream(
        &mut self,
        direction: StreamDirection,
        num_channels: usize,
        format: SampleFormat,
        frame_rate: u32,
        buffer_size: usize,
        effects: &[StreamEffect],
        client_shm: &dyn SharedMemory<Error = E>,
        buffer_offsets: [u64; 2]
    ) -> Result<Box<dyn ShmStream>, BoxError>;

    // Provided method
    fn keep_fds(&self) -> Vec<RawFd> { ... }
}
Expand description

ShmStreamSource creates streams for playback or capture of audio.

Required Methods§

source

fn new_stream( &mut self, direction: StreamDirection, num_channels: usize, format: SampleFormat, frame_rate: u32, buffer_size: usize, effects: &[StreamEffect], client_shm: &dyn SharedMemory<Error = E>, buffer_offsets: [u64; 2] ) -> Result<Box<dyn ShmStream>, BoxError>

Creates a new ShmStream

Creates a new ShmStream object, which allows:

  • Waiting until the server has communicated that data is ready or requested that we make more data available.
  • Setting the location and length of buffers for reading/writing audio data.
§Arguments
  • direction - The direction of the stream, either Playback or Capture.
  • num_channels - The number of audio channels for the stream.
  • format - The audio format to use for audio samples.
  • frame_rate - The stream’s frame rate in Hz.
  • buffer_size - The maximum size of an audio buffer. This will be the size used for transfers of audio data between client and server.
  • effects - Audio effects to use for the stream, such as echo-cancellation.
  • client_shm - The shared memory area that will contain samples.
  • buffer_offsets - The two initial values to use as buffer offsets for streams. This way, the server will not write audio data to an arbitrary offset in client_shm if the client fails to update offsets in time.
§Errors
  • If sending the connect stream message to the server fails.

Provided Methods§

source

fn keep_fds(&self) -> Vec<RawFd>

Get a list of file descriptors used by the implementation.

Returns any open file descriptors needed by the implementation. This list helps users of the ShmStreamSource enter Linux jails without closing needed file descriptors.

Implementors§