mirror of
https://github.com/celisej567/abaddon.git
synced 2026-09-19 20:11:59 +03:00
handle multiple speakers properly
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include <deque>
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
#include <miniaudio.h>
|
||||
#include <opus.h>
|
||||
@@ -13,25 +14,20 @@ public:
|
||||
AudioManager();
|
||||
~AudioManager();
|
||||
|
||||
void FeedMeOpus(const std::vector<uint8_t> &data);
|
||||
void FeedMeOpus(uint32_t ssrc, const std::vector<uint8_t> &data);
|
||||
|
||||
[[nodiscard]] bool OK() const;
|
||||
|
||||
private:
|
||||
friend void data_callback(ma_device *, void *, const void *, ma_uint32);
|
||||
|
||||
std::atomic<bool> m_active;
|
||||
std::thread m_thread;
|
||||
|
||||
bool m_ok;
|
||||
|
||||
ma_engine m_engine;
|
||||
ma_device m_device;
|
||||
ma_device_config m_device_config;
|
||||
|
||||
std::mutex m_dumb_mutex;
|
||||
std::deque<int16_t> m_dumb;
|
||||
std::deque<int16_t> m_buffer;
|
||||
|
||||
OpusDecoder *m_opus_decoder;
|
||||
std::mutex m_mutex;
|
||||
std::unordered_map<uint32_t, std::pair<std::deque<int16_t>, OpusDecoder *>> m_sources;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user