Fixes for wrong audio device index when starting

This commit is contained in:
yanmorin
2005-10-19 14:57:20 +00:00
parent bdd15b3710
commit 98d8cecd9b
4 changed files with 20 additions and 2 deletions

View File

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

View File

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

View File

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

View File

@ -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;
}