Ring Daemon 16.0.0
|
#include <ringbufferpool.h>
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< RingBuffer > | createRingBuffer (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< AudioFrame > | getAvailableData (const std::string &ringbufferId) |
std::shared_ptr< AudioFrame > | getData (const std::string &ringbufferId) |
AudioFormat | getInternalAudioFormat () const |
int | getInternalSamplingRate () const |
std::shared_ptr< RingBuffer > | getRingBuffer (const std::string &id) |
Obtain a shared pointer on a RingBuffer given by its ID. | |
std::shared_ptr< RingBuffer > | getRingBuffer (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" |
Definition at line 33 of file ringbufferpool.h.
jami::RingBufferPool::RingBufferPool | ( | ) |
Definition at line 32 of file ringbufferpool.cpp.
jami::RingBufferPool::~RingBufferPool | ( | ) |
Definition at line 36 of file ringbufferpool.cpp.
References jami::emitSignal(), and JAMI_WARNING.
Definition at line 366 of file ringbufferpool.cpp.
References jami::emitSignal().
void jami::RingBufferPool::bindHalfDuplexOut | ( | const std::string & | readerBufferId, |
const std::string & | sourceBufferId | ||
) |
Attaches a reader the specified source.
readerBufferId | The ID of the RingBuffer that will act as the reader of the sourceBuffer. |
sourceBufferId | The 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().
void jami::RingBufferPool::bindRingBuffers | ( | const std::string & | ringbufferId1, |
const std::string & | ringbufferId2 | ||
) |
Bind two RingBuffer together (full duplex).
ringbufferId1 | |
ringbufferId2 |
Definition at line 162 of file ringbufferpool.cpp.
References jami::emitSignal(), getRingBuffer(), JAMI_ERROR, and JAMI_LOG.
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.
Definition at line 391 of file ringbufferpool.cpp.
References jami::emitSignal().
Referenced by jami::AudioLayer::getToPlay().
Definition at line 406 of file ringbufferpool.cpp.
References jami::emitSignal().
Referenced by jami::AudioInput::~AudioInput().
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().
std::shared_ptr< AudioFrame > jami::RingBufferPool::getAvailableData | ( | const std::string & | ringbufferId | ) |
Definition at line 331 of file ringbufferpool.cpp.
References jami::emitSignal().
std::shared_ptr< AudioFrame > jami::RingBufferPool::getData | ( | const std::string & | ringbufferId | ) |
Definition at line 280 of file ringbufferpool.cpp.
References jami::emitSignal().
|
inline |
Definition at line 43 of file ringbufferpool.h.
|
inline |
Definition at line 41 of file ringbufferpool.h.
References jami::AudioFormat::sample_rate.
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().
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().
Definition at line 435 of file ringbufferpool.cpp.
References jami::emitSignal(), and getRingBuffer().
Referenced by libjami::isAudioMeterActive().
Definition at line 455 of file ringbufferpool.cpp.
References jami::emitSignal(), and getRingBuffer().
Referenced by libjami::setAudioMeterState().
void jami::RingBufferPool::setInternalAudioFormat | ( | AudioFormat | format | ) |
Definition at line 62 of file ringbufferpool.cpp.
References jami::emitSignal(), and flushAllBuffers().
Definition at line 51 of file ringbufferpool.cpp.
References jami::emitSignal(), flushAllBuffers(), and jami::AudioFormat::sample_rate.
Definition at line 257 of file ringbufferpool.cpp.
References jami::emitSignal(), getRingBuffer(), JAMI_ERROR, and JAMI_LOG.
Detaches a source from all its readers.
sourceBufferId | The 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().
Detaches a reader from all his sources.
readerBufferId | The 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.
void jami::RingBufferPool::unBindHalfDuplexOut | ( | const std::string & | readerBufferId, |
const std::string & | sourceBufferId | ||
) |
Detaches a reader from the specified source.
readerBufferId | The ID of the RingBuffer that acts as the reader to be detached from the sourceBuffer. |
sourceBufferId | The 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().
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.
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().
Definition at line 36 of file ringbufferpool.h.
Referenced by jami::AudioLayer::AudioLayer(), jami::AudioInput::configureFilePlayback(), jami::AudioLayer::getToPlay(), jami::Manager::ManagerPimpl::processRemainingParticipants(), jami::AudioInput::setPaused(), libjami::startAudioDevice(), jami::LocalRecorder::startRecording(), jami::LocalRecorder::stopRecording(), jami::AudioInput::switchInput(), and jami::AudioInput::~AudioInput().