Package: android.hardware.audio@2.0

IStreamIn

interface IStreamIn extends IStream

Properties

Result

typedef android.hardware.audio@2.0::Result Result

ReadCommand

enum ReadCommand: int32_t

Commands that can be executed on the driver reader thread.

Details
Members
READ
GET_CAPTURE_POSITION

ReadParameters

struct ReadParameters {ReadCommand command; union Params params}

Data structure passed to the driver for executing commands on the driver reader thread.

Details
Members
command
params

ReadStatus

struct ReadStatus {Result retval; ReadCommand replyTo; union Reply reply}

Data structure passed back to the client via status message queue of 'read' operation.

Possible values of 'retval' field:- OK, read operation was successful;- INVALID_ARGUMENTS, stream was not configured properly;- INVALID_STATE, stream is in a state that doesn't allow reads.

Details
Members
retval
replyTo
reply

Methods

getAudioSource

getAudioSource ()
generates (Result retval, AudioSource source)

Returns the source descriptor of the input stream.Calling this method is equivalent to getting AUDIO_PARAMETER_STREAM_INPUT_SOURCE on the legacy HAL.

Details
Generates
retval
operation completion status.
source
audio source.

setGain

setGain (float gain)
generates (Result retval)

Set the input gain for the audio driver.

Details
Parameters
gain
1.0f is unity, 0.0f is zero .@result retval operation completion status.
Generates
retval

prepareForReading

prepareForReading (uint32_t frameSize, uint32_t framesCount)
generates (Result retval, fmq_sync<ReadParameters> commandMQ, fmq_sync<uint8_t> dataMQ, fmq_sync<ReadStatus> statusMQ, ThreadInfo threadInfo)

Set up required transports for receiving audio buffers from the driver.

The transport consists of three message queues:-- command queue is used to instruct the reader thread what operation to perform;-- data queue is used for passing audio data from the driver to the client;-- status queue is used for reporting operation status(e.g.amount of bytes actually read or error code).

The driver operates on a dedicated thread.The client must ensure that the thread is given an appropriate priority and assigned to correct scheduler and cgroup.For this purpose, the method returns identifiers of the driver thread.

Details
Parameters
frameSize
the size of a single frame, in bytes.
framesCount
the number of frames in a buffer.
Generates
retval
OK if both message queues were created successfully.INVALID_STATE if the method was already called.INVALID_ARGUMENTS if there was a problem setting up the queues.
commandMQ
a message queue used for passing commands.
dataMQ
a message queue used for passing audio data in the format specified at the stream opening.
statusMQ
a message queue used for passing status from the driver using ReadStatus structures.
threadInfo
identifiers of the driver's dedicated thread.

getInputFramesLost

getInputFramesLost ()
generates (uint32_t framesLost)

Return the amount of input frames lost in the audio driver since the last call of this function.

Audio driver is expected to reset the value to 0 and restart counting upon returning the current value by this function call.Such loss typically occurs when the user space process is blocked longer than the capacity of audio driver buffers.

Details
Generates
framesLost
the number of input audio frames lost.

getCapturePosition

getCapturePosition ()
generates (Result retval, uint64_t frames, uint64_t time)

Return a recent count of the number of audio frames received and the clock time associated with that frame count.

Details
Generates
retval
INVALID_STATE if the device is not ready/available, NOT_SUPPORTED if the command is not supported, OK otherwise.
frames
the total frame count received.This must be as early in the capture pipeline as possible.In general, frames must be non-negative and must not go "backwards".
time
is the clock monotonic time when frames was measured.In general, time must be a positive quantity and must not go "backwards".