mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-12 22:09:25 +08:00
Fixes for wrong audio device index when starting
This commit is contained in:
@ -156,6 +156,13 @@ AudioLayer::putUrgent(void* buffer, int toCopy)
|
||||
ost::MutexLock guard(_mutex);
|
||||
_urgentRingBuffer.Put(buffer, toCopy);
|
||||
}
|
||||
|
||||
void
|
||||
AudioLayer::flushMic()
|
||||
{
|
||||
_micRingBuffer.flush();
|
||||
}
|
||||
|
||||
bool
|
||||
AudioLayer::isStreamStopped (void)
|
||||
{
|
||||
|
@ -55,6 +55,7 @@ public:
|
||||
void flushMain();
|
||||
void putMain(void* buffer, int toCopy);
|
||||
void putUrgent(void* buffer, int toCopy);
|
||||
void flushMic();
|
||||
|
||||
int audioCallback (const void *, void *, unsigned long,
|
||||
const PaStreamCallbackTimeInfo*, PaStreamCallbackFlags);
|
||||
|
@ -172,6 +172,8 @@ AudioRtpRTX::initAudioRtpSession (void)
|
||||
setCancel(cancelImmediate);
|
||||
}
|
||||
}
|
||||
Manager::instance().getAudioDriver()->flushMic();
|
||||
Manager::instance().getAudioDriver()->flushMain();
|
||||
_debug("-----------------------\n");
|
||||
}
|
||||
|
||||
@ -266,7 +268,6 @@ AudioRtpRTX::receiveSessionForSpkr (int16* data_for_speakers,
|
||||
Manager::instance().notificationIncomingCall();
|
||||
}
|
||||
}
|
||||
|
||||
Manager::instance().getAudioDriver()->startStream();
|
||||
|
||||
delete adu; adu = NULL;
|
||||
|
@ -1112,7 +1112,16 @@ ManagerImpl::selectAudioDriver (void)
|
||||
#if defined(AUDIO_PORTAUDIO)
|
||||
try {
|
||||
_audiodriverPA = new AudioLayer(*this);
|
||||
_audiodriverPA->openDevice(getConfigInt(AUDIO, DRIVER_NAME));
|
||||
int noDevice = getConfigInt(AUDIO, DRIVER_NAME);
|
||||
int nbDevice = portaudio::System::instance().deviceCount();
|
||||
if (nbDevice == 0 ) {
|
||||
throw std::runtime_error("Portaudio detect no sound card.");
|
||||
} else if (noDevice >= nbDevice) {
|
||||
_debug("Portaudio auto-select device #0 because device #%d is not found\n", noDevice);
|
||||
_setupLoaded = false;
|
||||
noDevice = 0;
|
||||
}
|
||||
_audiodriverPA->openDevice(noDevice);
|
||||
} catch(...) {
|
||||
throw;
|
||||
}
|
||||
|
Reference in New Issue
Block a user