Commit 3ddc5dbd authored by Rafaël Carré's avatar Rafaël Carré
Browse files

* #6629 : remove unused error message from audio layer

inline error signaling in the one alsa function using them
parent c5d8c3a9
......@@ -34,6 +34,7 @@
#include "eventthread.h"
#include "audio/samplerateconverter.h"
#include "managerimpl.h"
#include "dbus/configurationmanager.h"
class AlsaThread : public ost::Thread
{
......@@ -505,7 +506,7 @@ AlsaLayer::open_device (std::string pcm_p, std::string pcm_c, std::string pcm_r,
int err;
if ((err = snd_pcm_open (&playbackHandle_, pcm_p.c_str(), SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
_warn ("Audio: Error while opening playback device %s", pcm_p.c_str());
setErrorMessage (ALSA_PLAYBACK_DEVICE);
Manager::instance().getDbusManager()->getConfigurationManager()->errorAlert(ALSA_PLAYBACK_DEVICE);
is_playback_open_ = false;
return false;
}
......@@ -538,7 +539,7 @@ AlsaLayer::open_device (std::string pcm_p, std::string pcm_c, std::string pcm_r,
if (snd_pcm_open (&captureHandle_, pcm_c.c_str(), SND_PCM_STREAM_CAPTURE, 0) < 0) {
_warn ("Audio: Error: Opening capture device %s", pcm_c.c_str());
setErrorMessage (ALSA_CAPTURE_DEVICE);
Manager::instance().getDbusManager()->getConfigurationManager()->errorAlert(ALSA_CAPTURE_DEVICE);
is_capture_open_ = false;
return false;
}
......
......@@ -45,7 +45,6 @@ AudioLayer::AudioLayer (int type)
, frameSize_ (0)
, inChannel_ (1)
, outChannel_ (1)
, errorMessage_ (0)
, mutex_ ()
, audioPref(Manager::instance().audioPreference)
, layerType_ (type)
......
......@@ -115,24 +115,6 @@ class AudioLayer
void flushUrgent (void);
/**
* Write accessor to the error state
* @param error The error code
* Could be: ALSA_PLAYBACK_DEVICE
* ALSA_CAPTURE_DEVICE
*/
void setErrorMessage (int error) {
errorMessage_ = error;
}
/**
* Read accessor to the error state
* @return int The error code
*/
int getErrorMessage() const {
return errorMessage_;
}
/**
* Get the index of the audio card for capture
* @return int The index of the card used for capture
......@@ -286,9 +268,6 @@ class AudioLayer
*/
unsigned int outChannel_;
/** Contains the current error code */
int errorMessage_;
/**
* Lock for the entire audio layer
*/
......
......@@ -120,7 +120,6 @@ static const SOUND_FORMAT INT32 = 0x8;
#define ALSA 0
#define PULSEAUDIO 1
#define CHECK_INTERFACE( layer , api ) (layer == api)
#define UNUSED __attribute__((__unused__))
......
......@@ -2050,18 +2050,13 @@ std::string ManagerImpl::getCurrentCodecName (const std::string& id)
void ManagerImpl::setAudioPlugin (const std::string& audioPlugin)
{
audioLayerMutexLock();
int layerType = _audiodriver -> getLayerType();
audioPreference.setPlugin (audioPlugin);
if (CHECK_INTERFACE (layerType , ALSA)) {
_debug ("Set input audio plugin");
if (_audiodriver -> getLayerType() == ALSA) {
_audiodriver -> openDevice (_audiodriver->getIndexIn(), _audiodriver->getIndexOut(),
_audiodriver->getIndexRing(), _audiodriver -> getSampleRate(),
_audiodriver -> getFrameSize(), SFL_PCM_BOTH, audioPlugin);
if (_audiodriver -> getErrorMessage())
notifyErrClient (_audiodriver -> getErrorMessage());
}
audioLayerMutexUnlock();
}
......@@ -2116,9 +2111,6 @@ void ManagerImpl::setAudioDevice (const int index, int streamType)
_warn ("Unknown stream type");
}
if (_audiodriver -> getErrorMessage())
notifyErrClient (_audiodriver -> getErrorMessage());
audioLayerMutexUnlock();
}
......@@ -2391,7 +2383,6 @@ int32_t ManagerImpl::getAudioManager (void) const
void ManagerImpl::notifyErrClient (int32_t errCode)
{
_debug ("Manager: NOTIFY ERR NUMBER %d" , errCode);
_dbus.getConfigurationManager()->errorAlert(errCode);
}
......@@ -2477,10 +2468,6 @@ void ManagerImpl::initAudioDriver (void)
_audiodriver = new AlsaLayer;
}
int error = _audiodriver->getErrorMessage();
if (error)
_error("Audio driver init: %d", error);
audioLayerMutexUnlock();
}
......@@ -2534,11 +2521,6 @@ void ManagerImpl::selectAudioDriver (void)
_audiodriver->openDevice (numCardIn, numCardOut, numCardRing, sampleRate, frameSize,
SFL_PCM_BOTH, alsaPlugin);
/* Notify the error if there is one */
if (_audiodriver-> getErrorMessage())
notifyErrClient (_audiodriver -> getErrorMessage());
audioLayerMutexUnlock();
}
......@@ -2579,9 +2561,6 @@ void ManagerImpl::switchAudioManager (void)
_audiodriver->openDevice (numCardIn, numCardOut, numCardRing, samplerate, framesize,
SFL_PCM_BOTH, alsaPlugin);
if (_audiodriver->getErrorMessage())
notifyErrClient (_audiodriver -> getErrorMessage());
_debug ("Manager: Current device: %d ", type);
if (wasStarted)
......@@ -2635,9 +2614,6 @@ void ManagerImpl::audioSamplingRateChanged (int samplerate)
_audiodriver->openDevice (numCardIn, numCardOut, numCardRing, samplerate, framesize,
SFL_PCM_BOTH, alsaPlugin);
if (_audiodriver -> getErrorMessage())
notifyErrClient (_audiodriver -> getErrorMessage());
_debug ("Manager: Current device: %d ", type);
_mainBuffer.setInternalSamplingRate(samplerate);
......
......@@ -58,13 +58,6 @@ ManagerImpl::registerAccounts()
iter->second->registerVoIPLink();
}
}
audioLayerMutexLock();
if (_audiodriver->getErrorMessage() != -1)
notifyErrClient (_audiodriver->getErrorMessage());
audioLayerMutexUnlock();
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment