mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 21:05:31 +08:00
Ref T730, stop input/output if object is destroyed
This commit is contained in:
committed by
Mat Sutcliffe
parent
5eb3dee829
commit
e560be65a6
@@ -125,11 +125,9 @@ namespace BlackCore
|
|||||||
|
|
||||||
void CInput::stop()
|
void CInput::stop()
|
||||||
{
|
{
|
||||||
if (! m_started) { return; }
|
if (!m_started) { return; }
|
||||||
|
|
||||||
m_started = false;
|
m_started = false;
|
||||||
|
if (m_audioInput) { m_audioInput->stop(); }
|
||||||
m_audioInput->stop();
|
|
||||||
m_audioInput.reset();
|
m_audioInput.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -85,6 +85,12 @@ namespace BlackCore
|
|||||||
//! Ctor
|
//! Ctor
|
||||||
CInput(int sampleRate, QObject *parent = nullptr);
|
CInput(int sampleRate, QObject *parent = nullptr);
|
||||||
|
|
||||||
|
//! Dtor
|
||||||
|
virtual ~CInput() override
|
||||||
|
{
|
||||||
|
this->stop();
|
||||||
|
}
|
||||||
|
|
||||||
int opusBytesEncoded() const { return m_opusBytesEncoded; }
|
int opusBytesEncoded() const { return m_opusBytesEncoded; }
|
||||||
void setOpusBytesEncoded(int opusBytesEncoded) { m_opusBytesEncoded = opusBytesEncoded; }
|
void setOpusBytesEncoded(int opusBytesEncoded) { m_opusBytesEncoded = opusBytesEncoded; }
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ namespace BlackCore
|
|||||||
double PeakVU = 0.0;
|
double PeakVU = 0.0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//! Output buffer
|
||||||
class CAudioOutputBuffer : public QIODevice
|
class CAudioOutputBuffer : public QIODevice
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -71,6 +72,12 @@ namespace BlackCore
|
|||||||
//! Ctor
|
//! Ctor
|
||||||
Output(QObject *parent = nullptr);
|
Output(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
//! Dtor
|
||||||
|
virtual ~Output() override
|
||||||
|
{
|
||||||
|
this->stop();
|
||||||
|
}
|
||||||
|
|
||||||
//! Start output
|
//! Start output
|
||||||
void start(const QAudioDeviceInfo &outputDevice, BlackSound::SampleProvider::ISampleProvider *sampleProvider);
|
void start(const QAudioDeviceInfo &outputDevice, BlackSound::SampleProvider::ISampleProvider *sampleProvider);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user