mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-26 20:25:34 +08:00
Add opus codec test
This commit is contained in:
33
tests/opus/OpusEncoderImpl.h
Normal file
33
tests/opus/OpusEncoderImpl.h
Normal file
@@ -0,0 +1,33 @@
|
||||
|
||||
#ifndef __OPUSENCODERIMPL_H
|
||||
#define __OPUSENCODERIMPL_H
|
||||
#include <mutex>
|
||||
#include <queue>
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
|
||||
#include "base_type.h"
|
||||
#include "opus/opus.h"
|
||||
|
||||
class OpusEncoderImpl {
|
||||
private:
|
||||
OpusEncoder *encoder;
|
||||
const int channel_num;
|
||||
int sample_rate;
|
||||
std::queue<StreamInfo> info_queue;
|
||||
std::queue<unsigned char> pcm_queue;
|
||||
std::mutex mutex;
|
||||
bool isRuning = true;
|
||||
std::mutex access_mutex;
|
||||
std::unique_ptr<std::thread> m_thread;
|
||||
|
||||
public:
|
||||
OpusEncoderImpl(int sampleRate, int channel);
|
||||
void Feed(unsigned char *data, int len);
|
||||
bool PopFrame(StreamInfo &info);
|
||||
void EncodeRun();
|
||||
void Stop();
|
||||
~OpusEncoderImpl();
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user