Package com.vivoka.vsdk.audio
Class BufferModule
java.lang.Object
com.vivoka.vsdk.audio.ProducerModule
com.vivoka.vsdk.audio.BufferModule
- All Implemented Interfaces:
IConsumerModule
The BufferModule acts as both a consumer and a producer, enabling the forwarding of buffers
from a source pipeline to a target pipeline.
The
BufferModule supports both synchronous (Pipeline.run()) and asynchronous
(Pipeline.start()) pipeline execution modes, as well as the ability to pause and resume.
When the target pipeline is stopped or paused, incoming buffers from the source pipeline
are temporarily stored. These stored buffers are dispatched when the target pipeline
is started or resumed.
- Asynchronous mode: Buffer dispatching occurs in a dedicated thread.
- Synchronous mode: Pending buffers are dispatched in the same thread that
invokes targetPipeline.run().-
Nested Class Summary
Nested classes/interfaces inherited from class com.vivoka.vsdk.audio.ProducerModule
ProducerModule.State -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidClears all pending data in the queue.voidPauses the producer module.voidProcesses the given audio buffer.voidResumes the producer module.voidrunImpl()Runs the producer module in a blocking manner.voidStarts the producer module in a non-blocking manner.voidstopImpl()Stops the producer module.Methods inherited from class com.vivoka.vsdk.audio.ProducerModule
closeImpl, dispatchAudio, dispatchBuffer, getLastError, getState, isBusy, isClosed, isIdle, isOpened, isPaused, isRunning, isStarted, openImpl, setLastError, setState, setStateChanedCallback, subscribeFirst, subscribeLast, unsubscribe
-
Constructor Details
-
BufferModule
public BufferModule()
-
-
Method Details
-
clearPendingData
public void clearPendingData()Clears all pending data in the queue. -
startImpl
Description copied from class:ProducerModuleStarts the producer module in a non-blocking manner. The producer state must beOPENED. When calling start pipeline, this method will be called after theopenmethod. startImpl() should initiate the producer and return immediately without waiting for processing to complete and update the state to STARTED when it is done.- Overrides:
startImplin classProducerModule- Throws:
Exception- If an error occurs during starting.
-
stopImpl
public void stopImpl()Description copied from class:ProducerModuleStops the producer module. The producer state must beSTARTED. When calling stop pipeline, this method will be called. It should initiate the stopping process and return immediately without waiting for it to complete. It should make sure that the state is updated to OPENED when it is done.- Overrides:
stopImplin classProducerModule
-
pauseImpl
public void pauseImpl()Description copied from class:ProducerModulePauses the producer module. The producer state must beSTARTED. When calling pause pipeline, this method will be called. It should initiate the pausing process and return immediately without waiting for it to complete. It should make sure that the state is updated to PAUSED when it is done.- Overrides:
pauseImplin classProducerModule
-
resumeImpl
public void resumeImpl()Description copied from class:ProducerModuleResumes the producer module. The producer state must bePAUSED. When the producer is resumed, the child class needs to update the state to STARTED. When calling resume pipeline, this method will be called. It should initiate the resuming process and return immediately without waiting for it to complete. It should make sure that the state is updated to OPENED when it is done.- Overrides:
resumeImplin classProducerModule
-
runImpl
Description copied from class:ProducerModuleRuns the producer module in a blocking manner. The producer state must beOPENED. When calling run pipeline, this method will be called after theopenmethod. The state remains RUNNING until the end and then becomes OPENED.- Overrides:
runImplin classProducerModule- Throws:
Exception- If the producer is not opened or an error occurs during running.
-
process
Description copied from interface:IConsumerModuleProcesses the given audio buffer.- Specified by:
processin interfaceIConsumerModule- Parameters:
buffer- The audio buffer to process.last- Indicates if this is the last buffer in the stream.- Throws:
Exception- If an error occurs during processing.
-