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

#include <ringbufferpool.h>

Collaboration diagram for jami::RingBufferPool:
Collaboration graph

Public Types

using clock = std::chrono::steady_clock
 
using duration = clock::duration
 
using time_point = clock::time_point
 

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 duration &max_wait) const
 
bool waitForDataAvailable (const std::string &ringbufferId, const time_point &deadline) const
 
 ~RingBufferPool ()
 

Static Public Attributes

static const char *const DEFAULT_ID = "audiolayer_id"
 

Detailed Description

Definition at line 33 of file ringbufferpool.h.

Member Typedef Documentation

◆ clock

using jami::RingBufferPool::clock = std::chrono::steady_clock

Definition at line 36 of file ringbufferpool.h.

◆ duration

Definition at line 38 of file ringbufferpool.h.

◆ time_point

Definition at line 37 of file ringbufferpool.h.

Constructor & Destructor Documentation

◆ RingBufferPool()

jami::RingBufferPool::RingBufferPool ( )

Definition at line 28 of file ringbufferpool.cpp.

◆ ~RingBufferPool()

jami::RingBufferPool::~RingBufferPool ( )

Definition at line 32 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 384 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 192 of file ringbufferpool.cpp.

References jami::emitSignal().

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

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 169 of file ringbufferpool.cpp.

References jami::emitSignal(), 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 109 of file ringbufferpool.cpp.

References jami::emitSignal(), and JAMI_DEBUG.

Referenced by jami::PulseLayer::startCaptureStream().

Here is the call graph for this function:

◆ discard()

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

Definition at line 409 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 424 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 451 of file ringbufferpool.cpp.

References jami::emitSignal().

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

Here is the call graph for this function:

◆ getAvailableData()

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

Definition at line 349 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 298 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 46 of file ringbufferpool.h.

◆ getInternalSamplingRate()

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

Definition at line 44 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 95 of file ringbufferpool.cpp.

References jami::emitSignal().

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 102 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 458 of file ringbufferpool.cpp.

References jami::emitSignal().

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 478 of file ringbufferpool.cpp.

References jami::emitSignal().

Referenced by libjami::setAudioMeterState().

Here is the call graph for this function:

◆ setInternalAudioFormat()

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

Definition at line 58 of file ringbufferpool.cpp.

References jami::emitSignal().

Here is the call graph for this function:

◆ setInternalSamplingRate()

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

Definition at line 47 of file ringbufferpool.cpp.

References jami::emitSignal(), 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 274 of file ringbufferpool.cpp.

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

Referenced by jami::PulseLayer::stopCaptureStream().

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 257 of file ringbufferpool.cpp.

References jami::emitSignal(), and JAMI_ERROR.

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 237 of file ringbufferpool.cpp.

References jami::emitSignal(), 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 228 of file ringbufferpool.cpp.

References jami::emitSignal().

Referenced by jami::AudioInput::setPaused(), jami::AudioRtpSession::stop(), 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 205 of file ringbufferpool.cpp.

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

Here is the call graph for this function:

◆ waitForDataAvailable() [1/2]

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

Definition at line 326 of file ringbufferpool.cpp.

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

Referenced by waitForDataAvailable().

Here is the call graph for this function:

◆ waitForDataAvailable() [2/2]

bool jami::RingBufferPool::waitForDataAvailable ( const std::string &  ringbufferId,
const time_point deadline 
) const

Definition at line 332 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: