mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-16 18:35:35 +08:00
Decouple QAudioDevice buffer size from AFV 20 ms frame size
Different QAudioDevice plugins have different default buffer sizes. In order to cope with bigger buffer sizes than the expected 20 ms, let the buffer be filled and push from it every 20 ms via timer.
This commit is contained in:
committed by
Mat Sutcliffe
parent
1deaf1ca8b
commit
cf6d60348e
@@ -32,7 +32,7 @@ namespace BlackCore
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AudioInputBuffer() {}
|
||||
AudioInputBuffer(QObject *parent = nullptr);
|
||||
|
||||
void start();
|
||||
void stop();
|
||||
@@ -43,9 +43,13 @@ namespace BlackCore
|
||||
signals:
|
||||
void frameAvailable(const QByteArray &frame);
|
||||
|
||||
protected:
|
||||
void timerEvent(QTimerEvent *event) override;
|
||||
|
||||
private:
|
||||
static constexpr qint64 frameSize = 960;
|
||||
QByteArray m_buffer;
|
||||
int m_timerId = 0;
|
||||
};
|
||||
|
||||
struct OpusDataAvailableArgs
|
||||
@@ -97,7 +101,7 @@ namespace BlackCore
|
||||
int m_opusBytesEncoded = 0;
|
||||
double m_volume = 1.0;
|
||||
int m_sampleCount = 0;
|
||||
qint16 m_maxSampleInput = 0;
|
||||
qint16 m_maxSampleInput = 0.0;
|
||||
|
||||
const int c_sampleCountPerEvent = 4800;
|
||||
const float maxDb = 0;
|
||||
|
||||
Reference in New Issue
Block a user