Interface LocalAudioFrameListener

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Constructor Detail

    • Method Detail

      • onAudioRecordingStarted

         Unit onAudioRecordingStarted(AudioRecordInfo record)

        Called when audio recording has started, before the first onAudioFrame call.

        Optional — override to initialise per-session state that depends on the recording parameters (e.g. pre-computing per-sample phase increments for DSP, allocating format-specific buffers). A single listener may observe several recording sessions; this is invoked at the start of each one.

        Parameters:
        record - Recording configuration in use.
      • onAudioFrame

         abstract Boolean onAudioFrame(AudioRecordInfo record, Integer bytesRead, ByteBuffer byteBuffer)

        Called for every 10 ms audio buffer captured from the microphone, before it is handed to the WebRTC engine.

        The byteBuffer may be modified in-place to transform the audio before it reaches WebRTC (e.g. gain adjustment, filtering, ring modulation).

        The buffer contains interleaved PCM samples in the format and sample rate described by record. For android.media.AudioFormat.ENCODING_PCM_16BIT, each sample is a little-endian Short; use byteBuffer.order(ByteOrder.nativeOrder()).asShortBuffer() to iterate samples conveniently.

        Parameters:
        record - Recording configuration in use.
        bytesRead - Number of bytes populated in byteBuffer.
        byteBuffer - Buffer containing the raw PCM samples.
        Returns:

        true to pass the buffer contents (as-is or modified) to WebRTC; false to discard the buffer and send silence for this frame instead.