mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-15 12:51:49 -05:00
AudioDeviceManager: make sure a negative or null sample rate is never returned
This commit is contained in:
parent
da06bc30cc
commit
0260c3aefc
@ -503,7 +503,15 @@ int AudioDeviceManager::getInputSampleRate(int inputDeviceIndex)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return deviceInfo.sampleRate;
|
if (deviceInfo.sampleRate > 0)
|
||||||
|
{
|
||||||
|
return deviceInfo.sampleRate;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qDebug("AudioDeviceManager::getInputSampleRate: device %s has invalid sample rate", qPrintable(deviceName));
|
||||||
|
return m_defaultAudioSampleRate;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -526,7 +534,15 @@ int AudioDeviceManager::getOutputSampleRate(int outputDeviceIndex)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return deviceInfo.sampleRate;
|
if (deviceInfo.sampleRate > 0)
|
||||||
|
{
|
||||||
|
return deviceInfo.sampleRate;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qDebug("AudioDeviceManager::getOutputSampleRate: device %s has invalid sample rate", qPrintable(deviceName));
|
||||||
|
return m_defaultAudioSampleRate;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ public:
|
|||||||
sampleRate = m_defaultAudioSampleRate;
|
sampleRate = m_defaultAudioSampleRate;
|
||||||
volume = m_defaultAudioInputVolume;
|
volume = m_defaultAudioInputVolume;
|
||||||
}
|
}
|
||||||
unsigned int sampleRate;
|
int sampleRate;
|
||||||
float volume;
|
float volume;
|
||||||
friend QDataStream& operator<<(QDataStream& ds, const InputDeviceInfo& info);
|
friend QDataStream& operator<<(QDataStream& ds, const InputDeviceInfo& info);
|
||||||
friend QDataStream& operator>>(QDataStream& ds, InputDeviceInfo& info);
|
friend QDataStream& operator>>(QDataStream& ds, InputDeviceInfo& info);
|
||||||
@ -74,7 +74,7 @@ public:
|
|||||||
udpChannelCodec = AudioOutput::UDPCodecL16;
|
udpChannelCodec = AudioOutput::UDPCodecL16;
|
||||||
udpDecimationFactor = 1;
|
udpDecimationFactor = 1;
|
||||||
}
|
}
|
||||||
unsigned int sampleRate;
|
int sampleRate;
|
||||||
QString udpAddress;
|
QString udpAddress;
|
||||||
quint16 udpPort;
|
quint16 udpPort;
|
||||||
bool copyToUDP;
|
bool copyToUDP;
|
||||||
@ -114,7 +114,7 @@ public:
|
|||||||
void inputInfosCleanup(); //!< Remove input info from map for input devices not present
|
void inputInfosCleanup(); //!< Remove input info from map for input devices not present
|
||||||
void outputInfosCleanup(); //!< Remove output info from map for output devices not present
|
void outputInfosCleanup(); //!< Remove output info from map for output devices not present
|
||||||
|
|
||||||
static const unsigned int m_defaultAudioSampleRate = 48000;
|
static const int m_defaultAudioSampleRate = 48000;
|
||||||
static const float m_defaultAudioInputVolume;
|
static const float m_defaultAudioInputVolume;
|
||||||
static const QString m_defaultUDPAddress;
|
static const QString m_defaultUDPAddress;
|
||||||
static const quint16 m_defaultUDPPort = 9998;
|
static const quint16 m_defaultUDPPort = 9998;
|
||||||
|
Loading…
Reference in New Issue
Block a user