1
0
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:
sudden6 2016-10-07 23:48:53 +02:00
commit 86a9c5fe26
No known key found for this signature in database
GPG Key ID: 279509B499E032B9

View File

@ -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)