mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge pull request #3788
Keegan Drake H.P (2): fix(audio): keep the data pointed to by tmpDevName in scope style(audio): remove redundant checks in src/audio/audio.cpp
This commit is contained in:
commit
86a9c5fe26
|
@ -352,9 +352,10 @@ bool Audio::initInput(const QString& deviceName)
|
|||
const uint32_t chnls = AUDIO_CHANNELS;
|
||||
const ALCsizei bufSize = (frameDuration * sampleRate * 4) / 1000 * chnls;
|
||||
|
||||
const ALchar* tmpDevName = deviceName.isEmpty()
|
||||
const QByteArray qDevName = deviceName.toUtf8();
|
||||
const ALchar* tmpDevName = qDevName.isEmpty()
|
||||
? nullptr
|
||||
: deviceName.toUtf8().constData();
|
||||
: qDevName.constData();
|
||||
alInDev = alcCaptureOpenDevice(tmpDevName, sampleRate, stereoFlag, bufSize);
|
||||
|
||||
// Restart the capture if necessary
|
||||
|
@ -386,9 +387,10 @@ bool Audio::initOutput(const QString& deviceName)
|
|||
qDebug() << "Opening audio output" << deviceName;
|
||||
assert(!alOutDev);
|
||||
|
||||
const ALchar* tmpDevName = deviceName.isEmpty()
|
||||
const QByteArray qDevName = deviceName.toUtf8();
|
||||
const ALchar* tmpDevName = qDevName.isEmpty()
|
||||
? nullptr
|
||||
: deviceName.toUtf8().constData();
|
||||
: qDevName.constData();
|
||||
alOutDev = alcOpenDevice(tmpDevName);
|
||||
|
||||
if (!alOutDev)
|
||||
|
|
Loading…
Reference in New Issue
Block a user