32 const std::string&
sdp,
50AudioReceiveThread::setup()
52 std::lock_guard
lk(mutex_);
53 audioDecoder_.reset(
new MediaDecoder([
this](std::shared_ptr<MediaFrame>&&
frame)
mutable {
55 ringbuffer_->put(std::static_pointer_cast<AudioFrame>(
frame));
57 audioDecoder_->setContextCallback([
this]() {
58 if (recorderCallback_)
61 audioDecoder_->setInterruptCallback(interruptCb,
this);
64 args_.
input = SDP_FILENAME;
68 if (stream_.str().empty()) {
73 audioDecoder_->setIOContext(sdpContext_.get());
74 audioDecoder_->setFEC(
true);
75 if (audioDecoder_->openInput(args_)) {
76 JAMI_ERR(
"Unable to open input \"%s\"", SDP_FILENAME);
81 audioDecoder_->setIOContext(demuxContext_.get());
82 if (audioDecoder_->setupAudio()) {
83 JAMI_ERR(
"decoder IO startup failed");
89 if (onSuccessfulSetup_)
96AudioReceiveThread::process()
98 audioDecoder_->decode();
102AudioReceiveThread::cleanup()
104 std::lock_guard
lk(mutex_);
105 audioDecoder_.reset();
106 demuxContext_.reset();
115 auto count =
is.gcount();
116 return count ?
static_cast<int>(count) :
AVERROR_EOF;
121AudioReceiveThread::interruptCb(
void* data)
124 return not context->loop_.isRunning();
130 demuxContext_.reset(
socketPair.createIOContext(mtu_));
136 recorderCallback_ =
cb;
138 audioDecoder_->setContextCallback([
this]() {
139 if (recorderCallback_)
149 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)