34 const std::string&
sdp,
52AudioReceiveThread::setup()
54 std::lock_guard
lk(mutex_);
55 audioDecoder_.reset(
new MediaDecoder([
this](std::shared_ptr<MediaFrame>&&
frame)
mutable {
57 ringbuffer_->put(std::static_pointer_cast<AudioFrame>(
frame));
59 audioDecoder_->setContextCallback([
this]() {
60 if (recorderCallback_)
63 audioDecoder_->setInterruptCallback(interruptCb,
this);
66 args_.
input = SDP_FILENAME;
70 if (stream_.str().empty()) {
75 audioDecoder_->setIOContext(sdpContext_.get());
76 audioDecoder_->setFEC(
true);
77 if (audioDecoder_->openInput(args_)) {
78 JAMI_ERR(
"Unable to open input \"%s\"", SDP_FILENAME);
83 audioDecoder_->setIOContext(demuxContext_.get());
84 if (audioDecoder_->setupAudio()) {
85 JAMI_ERR(
"decoder IO startup failed");
91 if (onSuccessfulSetup_)
98AudioReceiveThread::process()
100 audioDecoder_->decode();
104AudioReceiveThread::cleanup()
106 std::lock_guard
lk(mutex_);
107 audioDecoder_.reset();
108 demuxContext_.reset();
117 auto count =
is.gcount();
123AudioReceiveThread::interruptCb(
void* data)
126 return not context->loop_.isRunning();
132 demuxContext_.reset(
socketPair.createIOContext(mtu_));
139 recorderCallback_ =
cb;
141 audioDecoder_->setContextCallback([
this]() {
142 if (recorderCallback_)
152 return audioDecoder_->getStream(
"a:remote");
void addIOContext(SocketPair &socketPair)
AudioReceiveThread(const std::string &streamId, const AudioFormat &format, const std::string &sdp, const uint16_t mtu)
MediaStream getInfo() const
void setRecorderCallback(const std::function< void(const MediaStream &ms)> &cb)
static LIBJAMI_TEST_EXPORT Manager & instance()
RingBufferPool & getRingBufferPool()
Return a pointer to the instance of the RingBufferPool.
void notify(std::shared_ptr< MediaFrame > data)
std::shared_ptr< RingBuffer > createRingBuffer(const std::string &id)
Create a new ringbuffer with a default readoffset.
void emitSignal(Args... args)