Ring Daemon 16.0.0
Loading...
Searching...
No Matches
jami::RingBufferPool Class Reference

#include <ringbufferpool.h>

Collaboration diagram for jami::RingBufferPool:
Collaboration graph

Public Member Functions

size_t availableForGet (const std::string &ringbufferId) const
 
void bindHalfDuplexOut (const std::string &readerBufferId, const std::string &sourceBufferId)
 Attaches a reader the specified source.
 
void bindRingBuffers (const std::string &ringbufferId1, const std::string &ringbufferId2)
 Bind two RingBuffer together (full duplex).
 
std::shared_ptr< RingBuffercreateRingBuffer (const std::string &id)
 Create a new ringbuffer with a default readoffset.
 
size_t discard (size_t toDiscard, const std::string &ringbufferId)
 
void flush (const std::string &ringbufferId)
 
void flushAllBuffers ()
 
std::shared_ptr< AudioFramegetAvailableData (const std::string &ringbufferId)
 
std::shared_ptr< AudioFramegetData (const std::string &ringbufferId)
 
AudioFormat getInternalAudioFormat () const
 
int getInternalSamplingRate () const
 
std::shared_ptr< RingBuffergetRingBuffer (const std::string &id)
 Obtain a shared pointer on a RingBuffer given by its ID.
 
std::shared_ptr< RingBuffergetRingBuffer (const std::string &id) const
 Works as non-const getRingBuffer, without the weak reference flush.
 
bool isAudioMeterActive (const std::string &id)
 
 RingBufferPool ()
 
void setAudioMeterState (const std::string &id, bool state)
 
void setInternalAudioFormat (AudioFormat format)
 
void setInternalSamplingRate (unsigned sr)
 
void unBindAll (const std::string &ringbufferId)
 
void unBindAllHalfDuplexIn (const std::string &sourceBufferId)
 Detaches a source from all its readers.
 
void unBindAllHalfDuplexOut (const std::string &ringbufferId)
 Detaches a reader from all his sources.
 
void unBindHalfDuplexOut (const std::string &readerBufferId, const std::string &sourceBufferId)
 Detaches a reader from the specified source.
 
void unbindRingBuffers (const std::string &ringbufferId1, const std::string &ringbufferId2)
 Unbind two RingBuffer (full duplex).
 
bool waitForDataAvailable (const std::string &ringbufferId, const std::chrono::microseconds &max_wait) const
 
 ~RingBufferPool ()
 

Static Public Attributes

static const char *const DEFAULT_ID = "audiolayer_id"
 

Detailed Description

Definition at line 33 of file ringbufferpool.h.

Constructor & Destructor Documentation

◆ RingBufferPool()

jami::RingBufferPool::RingBufferPool ( )

Definition at line 32 of file ringbufferpool.cpp.

◆ ~RingBufferPool()

jami::RingBufferPool::~RingBufferPool ( )

Definition at line 36 of file ringbufferpool.cpp.

References jami::emitSignal(), and JAMI_WARNING.

Here is the call graph for this function:

Member Function Documentation

◆ availableForGet()

size_t jami::RingBufferPool::availableForGet ( const std::string &  ringbufferId) const

Definition at line 366 of file ringbufferpool.cpp.

References jami::emitSignal().

Here is the call graph for this function:

◆ bindHalfDuplexOut()

void jami::RingBufferPool::bindHalfDuplexOut ( const std::string &  readerBufferId,
const std::string &  sourceBufferId 
)

Attaches a reader the specified source.

Parameters
readerBufferIdThe ID of the RingBuffer that will act as the reader of the sourceBuffer.
sourceBufferIdThe iID of the RingBuffer that will be the source (to be read from).

Definition at line 185 of file ringbufferpool.cpp.

References jami::emitSignal(), and getRingBuffer().

Referenced by jami::AudioInput::configureFilePlayback(), jami::AudioInput::setPaused(), and jami::LocalRecorder::startRecording().

Here is the call graph for this function:

◆ bindRingBuffers()

void jami::RingBufferPool::bindRingBuffers ( const std::string &  ringbufferId1,
const std::string &  ringbufferId2 
)

Bind two RingBuffer together (full duplex).

Parameters
ringbufferId1
ringbufferId2

Definition at line 162 of file ringbufferpool.cpp.

References jami::emitSignal(), getRingBuffer(), JAMI_ERROR, and JAMI_LOG.

Here is the call graph for this function:

◆ createRingBuffer()

std::shared_ptr< RingBuffer > jami::RingBufferPool::createRingBuffer ( const std::string &  id)

Create a new ringbuffer with a default readoffset.

This class keeps a weak reference on returned pointer, so the caller is responsible of the referred instance.

Definition at line 103 of file ringbufferpool.cpp.

References jami::emitSignal(), getRingBuffer(), JAMI_DEBUG, and jami::SIZEBUF.

Here is the call graph for this function:

◆ discard()

size_t jami::RingBufferPool::discard ( size_t  toDiscard,
const std::string &  ringbufferId 
)

Definition at line 391 of file ringbufferpool.cpp.

References jami::emitSignal().

Referenced by jami::AudioLayer::getToPlay().

Here is the call graph for this function:

◆ flush()

void jami::RingBufferPool::flush ( const std::string &  ringbufferId)

Definition at line 406 of file ringbufferpool.cpp.

References jami::emitSignal().

Referenced by jami::AudioInput::~AudioInput().

Here is the call graph for this function:

◆ flushAllBuffers()

void jami::RingBufferPool::flushAllBuffers ( )

Definition at line 419 of file ringbufferpool.cpp.

References jami::emitSignal().

Referenced by jami::AudioLayer::flush(), jami::AudioLayer::flushMain(), setInternalAudioFormat(), and setInternalSamplingRate().

Here is the call graph for this function:

◆ getAvailableData()

std::shared_ptr< AudioFrame > jami::RingBufferPool::getAvailableData ( const std::string &  ringbufferId)

Definition at line 331 of file ringbufferpool.cpp.

References jami::emitSignal().

Here is the call graph for this function:

◆ getData()

std::shared_ptr< AudioFrame > jami::RingBufferPool::getData ( const std::string &  ringbufferId)

Definition at line 280 of file ringbufferpool.cpp.

References jami::emitSignal().

Here is the call graph for this function:

◆ getInternalAudioFormat()

AudioFormat jami::RingBufferPool::getInternalAudioFormat ( ) const
inline

Definition at line 43 of file ringbufferpool.h.

◆ getInternalSamplingRate()

int jami::RingBufferPool::getInternalSamplingRate ( ) const
inline

Definition at line 41 of file ringbufferpool.h.

References jami::AudioFormat::sample_rate.

◆ getRingBuffer() [1/2]

std::shared_ptr< RingBuffer > jami::RingBufferPool::getRingBuffer ( const std::string &  id)

Obtain a shared pointer on a RingBuffer given by its ID.

If the ID doesn't match to any RingBuffer, the shared pointer is empty. This non-const version flushes internal weak pointers if the ID was used and the associated RingBuffer has been deleted.

Definition at line 76 of file ringbufferpool.cpp.

References jami::emitSignal().

Referenced by bindHalfDuplexOut(), bindRingBuffers(), createRingBuffer(), isAudioMeterActive(), setAudioMeterState(), unBindAll(), unBindAllHalfDuplexIn(), unBindAllHalfDuplexOut(), unBindHalfDuplexOut(), and unbindRingBuffers().

Here is the call graph for this function:

◆ getRingBuffer() [2/2]

std::shared_ptr< RingBuffer > jami::RingBufferPool::getRingBuffer ( const std::string &  id) const

Works as non-const getRingBuffer, without the weak reference flush.

Definition at line 91 of file ringbufferpool.cpp.

References jami::emitSignal().

Here is the call graph for this function:

◆ isAudioMeterActive()

bool jami::RingBufferPool::isAudioMeterActive ( const std::string &  id)

Definition at line 435 of file ringbufferpool.cpp.

References jami::emitSignal(), and getRingBuffer().

Referenced by libjami::isAudioMeterActive().

Here is the call graph for this function:

◆ setAudioMeterState()

void jami::RingBufferPool::setAudioMeterState ( const std::string &  id,
bool  state 
)

Definition at line 455 of file ringbufferpool.cpp.

References jami::emitSignal(), and getRingBuffer().

Referenced by libjami::setAudioMeterState().

Here is the call graph for this function:

◆ setInternalAudioFormat()

void jami::RingBufferPool::setInternalAudioFormat ( AudioFormat  format)

Definition at line 62 of file ringbufferpool.cpp.

References jami::emitSignal(), and flushAllBuffers().

Here is the call graph for this function:

◆ setInternalSamplingRate()

void jami::RingBufferPool::setInternalSamplingRate ( unsigned  sr)

Definition at line 51 of file ringbufferpool.cpp.

References jami::emitSignal(), flushAllBuffers(), and jami::AudioFormat::sample_rate.

Here is the call graph for this function:

◆ unBindAll()

void jami::RingBufferPool::unBindAll ( const std::string &  ringbufferId)

Definition at line 257 of file ringbufferpool.cpp.

References jami::emitSignal(), getRingBuffer(), JAMI_ERROR, and JAMI_LOG.

Here is the call graph for this function:

◆ unBindAllHalfDuplexIn()

void jami::RingBufferPool::unBindAllHalfDuplexIn ( const std::string &  sourceBufferId)

Detaches a source from all its readers.

Parameters
sourceBufferIdThe ID of the RingBuffer that serves as the source (being read from).

Definition at line 247 of file ringbufferpool.cpp.

References jami::emitSignal(), and getRingBuffer().

Here is the call graph for this function:

◆ unBindAllHalfDuplexOut()

void jami::RingBufferPool::unBindAllHalfDuplexOut ( const std::string &  ringbufferId)

Detaches a reader from all his sources.

Parameters
readerBufferIdThe ID of the RingBuffer that acts as the reader to be detached from the sources.

Definition at line 230 of file ringbufferpool.cpp.

References jami::emitSignal(), getRingBuffer(), and JAMI_ERROR.

Here is the call graph for this function:

◆ unBindHalfDuplexOut()

void jami::RingBufferPool::unBindHalfDuplexOut ( const std::string &  readerBufferId,
const std::string &  sourceBufferId 
)

Detaches a reader from the specified source.

Parameters
readerBufferIdThe ID of the RingBuffer that acts as the reader to be detached from the sourceBuffer.
sourceBufferIdThe RingBuffer that serves as the source (being read from).

Definition at line 221 of file ringbufferpool.cpp.

References jami::emitSignal(), and getRingBuffer().

Referenced by jami::AudioInput::setPaused(), jami::LocalRecorder::stopRecording(), jami::AudioInput::switchInput(), and jami::AudioInput::~AudioInput().

Here is the call graph for this function:

◆ unbindRingBuffers()

void jami::RingBufferPool::unbindRingBuffers ( const std::string &  ringbufferId1,
const std::string &  ringbufferId2 
)

Unbind two RingBuffer (full duplex).

Definition at line 198 of file ringbufferpool.cpp.

References jami::emitSignal(), getRingBuffer(), JAMI_ERROR, and JAMI_LOG.

Here is the call graph for this function:

◆ waitForDataAvailable()

bool jami::RingBufferPool::waitForDataAvailable ( const std::string &  ringbufferId,
const std::chrono::microseconds &  max_wait 
) const

Definition at line 308 of file ringbufferpool.cpp.

References jami::emitSignal().

Here is the call graph for this function:

Member Data Documentation

◆ DEFAULT_ID


The documentation for this class was generated from the following files: