diff --git a/daemon/src/audio/alsa/alsalayer.cpp b/daemon/src/audio/alsa/alsalayer.cpp index 57e68e28e5a7774819560a5265e8fd1da6816ee9..3201c117da7aee480ae6877556237e648878cb47 100644 --- a/daemon/src/audio/alsa/alsalayer.cpp +++ b/daemon/src/audio/alsa/alsalayer.cpp @@ -133,7 +133,7 @@ AlsaLayer::closeLayer() } void -AlsaLayer::openDevice (int indexIn, int indexOut, int indexRing, int sampleRate, int frameSize, int stream , const std::string &plugin) +AlsaLayer::openDevice (int indexIn, int indexOut, int indexRing, int sampleRate, int stream , const std::string &plugin) { /* Close the devices before open it */ if (stream == SFL_PCM_BOTH and is_capture_open_ and is_playback_open_) { @@ -149,13 +149,11 @@ AlsaLayer::openDevice (int indexIn, int indexOut, int indexRing, int sampleRate, indexRing_ = indexRing; audioSampleRate_ = sampleRate; - frameSize_ = frameSize; audioPlugin_ = plugin; _debug (" Setting AlsaLayer: device in=%2d, out=%2d, ring=%2d", indexIn_, indexOut_, indexRing_); _debug (" : alsa plugin=%s", audioPlugin_.c_str()); - _debug (" : nb channel in=%2d, out=%2d", inChannel_, outChannel_); _debug (" : sample rate=%5d, format=%s", audioSampleRate_, SFLDataFormatString); audioThread_ = NULL; diff --git a/daemon/src/audio/alsa/alsalayer.h b/daemon/src/audio/alsa/alsalayer.h index 57c8a514041012547edb409b3bb89570432da20a..49d2382bf14a5bfe9a1789ed96acc66846dc3c8c 100644 --- a/daemon/src/audio/alsa/alsalayer.h +++ b/daemon/src/audio/alsa/alsalayer.h @@ -64,14 +64,13 @@ class AlsaLayer : public AudioLayer * @param indexIn The number of the card chosen for capture * @param indexOut The number of the card chosen for playback * @param sampleRate The sample rate - * @param frameSize The frame size * @param stream To indicate which kind of stream you want to open * SFL_PCM_CAPTURE * SFL_PCM_PLAYBACK * SFL_PCM_BOTH * @param plugin The alsa plugin ( dmix , default , front , surround , ...) */ - void openDevice (int indexIn, int indexOut, int indexRing, int sampleRate, int frameSize, int stream, const std::string &plugin); + void openDevice (int indexIn, int indexOut, int indexRing, int sampleRate, int stream, const std::string &plugin); /** * Start the capture stream and prepare the playback stream. diff --git a/daemon/src/audio/audiolayer.cpp b/daemon/src/audio/audiolayer.cpp index 89a822b6e0b13f89d555d68370da054b4e416be2..1edee1a967967bddd388e7cd4b96e564342316f5 100644 --- a/daemon/src/audio/audiolayer.cpp +++ b/daemon/src/audio/audiolayer.cpp @@ -42,9 +42,6 @@ AudioLayer::AudioLayer (int type) , indexOut_ (0) , indexRing_ (0) , audioSampleRate_ (0) - , frameSize_ (0) - , inChannel_ (1) - , outChannel_ (1) , mutex_ () , audioPref(Manager::instance().audioPreference) , layerType_ (type) diff --git a/daemon/src/audio/audiolayer.h b/daemon/src/audio/audiolayer.h index caf2f20709827a6018165c6c5a7e84c1fa313add..27a2cdedb11747bd2216b4faea405aeadd40956c 100644 --- a/daemon/src/audio/audiolayer.h +++ b/daemon/src/audio/audiolayer.h @@ -78,14 +78,13 @@ class AudioLayer * @param indexIn The number of the card chosen for capture * @param indexOut The number of the card chosen for playback * @param sampleRate The sample rate - * @param frameSize The frame size * @param stream To indicate which kind of stream you want to open * SFL_PCM_CAPTURE * SFL_PCM_PLAYBACK * SFL_PCM_BOTH * @param plugin The alsa plugin ( dmix , default , front , surround , ...) */ - virtual void openDevice (int indexIn, int indexOut, int indexRing, int sampleRate, int frameSize, int stream , const std::string &plugin) = 0; + virtual void openDevice (int indexIn, int indexOut, int indexRing, int sampleRate, int stream , const std::string &plugin) = 0; /** * Start the capture stream and prepare the playback stream. @@ -151,15 +150,6 @@ class AudioLayer return audioSampleRate_; } - /** - * Get the frame size of the audio layer - * @return unsigned int The frame size - * default: 20 ms - */ - unsigned int getFrameSize() const { - return frameSize_; - } - /** * Get the layer type for this instance (either Alsa or PulseAudio) * @return unsigned int The layer type @@ -252,22 +242,6 @@ class AudioLayer */ unsigned int audioSampleRate_; - /** - * Length of the sound frame we capture or read in ms - * The value can be set in the user config file - now: 20ms - */ - unsigned int frameSize_; - - /** - * Input channel (mic) should be 1 mono - */ - unsigned int inChannel_; - - /** - * Output channel (stereo) should be 1 mono - */ - unsigned int outChannel_; - /** * Lock for the entire audio layer */ diff --git a/daemon/src/audio/pulseaudio/pulselayer.cpp b/daemon/src/audio/pulseaudio/pulselayer.cpp index fa0f1ff9176c17e7d5172a0179bfbdec6953e06c..cbdff8273f6ced56128ea61741dd47ff1ce83f61 100644 --- a/daemon/src/audio/pulseaudio/pulselayer.cpp +++ b/daemon/src/audio/pulseaudio/pulselayer.cpp @@ -370,12 +370,9 @@ void PulseLayer::context_state_callback (pa_context* c, void* user_data) } } -void PulseLayer::openDevice (int indexIn UNUSED, int indexOut UNUSED, int indexRing UNUSED, int sampleRate, int frameSize , int stream UNUSED, const std::string &plugin UNUSED) +void PulseLayer::openDevice (int indexIn UNUSED, int indexOut UNUSED, int indexRing UNUSED, int sampleRate, int stream UNUSED, const std::string &plugin UNUSED) { - _debug ("Audio: Open device sampling rate %d, frame size %d", audioSampleRate_, frameSize_); - audioSampleRate_ = sampleRate; - frameSize_ = frameSize; flushUrgent(); diff --git a/daemon/src/audio/pulseaudio/pulselayer.h b/daemon/src/audio/pulseaudio/pulselayer.h index 878cf9bfee96282574b6be06fd08800b0188c104..290f6b8c7ec056ec0bc419468437f7afe4dc1f58 100644 --- a/daemon/src/audio/pulseaudio/pulselayer.h +++ b/daemon/src/audio/pulseaudio/pulselayer.h @@ -62,14 +62,13 @@ class PulseLayer : public AudioLayer * @param indexIn The number of the card chosen for capture * @param indexOut The number of the card chosen for playback * @param sampleRate The sample rate - * @param frameSize The frame size * @param stream To indicate which kind of stream you want to open * SFL_PCM_CAPTURE * SFL_PCM_PLAYBACK * SFL_PCM_BOTH * @param plugin The alsa plugin ( dmix , default , front , surround , ...) */ - void openDevice (int indexIn, int indexOut, int indexRing, int sampleRate, int frameSize , int stream, const std::string &plugin) ; + void openDevice (int indexIn, int indexOut, int indexRing, int sampleRate, int stream, const std::string &plugin) ; DeviceList* getSinkList (void) { return &sinkList_; diff --git a/daemon/src/iax/iaxvoiplink.cpp b/daemon/src/iax/iaxvoiplink.cpp index d3404fc44a6c7b0a8a55506013b420c602703b5c..9c6e4dd5cd220bde8c02c9f9c64ee72260b4c4b0 100644 --- a/daemon/src/iax/iaxvoiplink.cpp +++ b/daemon/src/iax/iaxvoiplink.cpp @@ -713,7 +713,7 @@ IAXVoIPLink::iaxHandleVoiceEvent (iax_event* event, IAXCall* call) unsigned int size = event->datalen; // Decode data with relevant codec - unsigned int max = audioCodec->getClockRate() * audiolayer_->getFrameSize() / 1000; + unsigned int max = audioCodec->getClockRate() * 20 / 1000; if (size > max) { _debug ("The size %d is bigger than expected %d. Packet cropped. Ouch!", size, max); diff --git a/daemon/src/managerimpl.cpp b/daemon/src/managerimpl.cpp index 678633ff0dd2d74407e8453eaa0f2045739b8492..e6ed18e229f158867280af7fd06a7880b95a1325 100644 --- a/daemon/src/managerimpl.cpp +++ b/daemon/src/managerimpl.cpp @@ -2056,7 +2056,7 @@ void ManagerImpl::setAudioPlugin (const std::string& audioPlugin) if (_audiodriver -> getLayerType() == ALSA) { _audiodriver -> openDevice (_audiodriver->getIndexIn(), _audiodriver->getIndexOut(), _audiodriver->getIndexRing(), _audiodriver -> getSampleRate(), - _audiodriver -> getFrameSize(), SFL_PCM_BOTH, audioPlugin); + SFL_PCM_BOTH, audioPlugin); } audioLayerMutexUnlock(); } @@ -2089,22 +2089,19 @@ void ManagerImpl::setAudioDevice (const int index, int streamType) case SFL_PCM_PLAYBACK: _debug ("Manager: Set output device"); _audiodriver->openDevice (_audiodriver->getIndexIn(), index, _audiodriver->getIndexRing(), - _audiodriver->getSampleRate(), _audiodriver->getFrameSize(), - SFL_PCM_PLAYBACK, alsaplugin); + _audiodriver->getSampleRate(), SFL_PCM_PLAYBACK, alsaplugin); audioPreference.setCardout (index); break; case SFL_PCM_CAPTURE: _debug ("Manager: Set input device"); _audiodriver->openDevice (index, _audiodriver->getIndexOut(), _audiodriver->getIndexRing(), - _audiodriver->getSampleRate(), _audiodriver->getFrameSize(), - SFL_PCM_CAPTURE, alsaplugin); + _audiodriver->getSampleRate(), SFL_PCM_CAPTURE, alsaplugin); audioPreference.setCardin (index); break; case SFL_PCM_RINGTONE: _debug ("Manager: Set ringtone device"); _audiodriver->openDevice (_audiodriver->getIndexOut(), _audiodriver->getIndexOut(), index, - _audiodriver->getSampleRate(), _audiodriver->getFrameSize(), - SFL_PCM_RINGTONE, alsaplugin); + _audiodriver->getSampleRate(), SFL_PCM_RINGTONE, alsaplugin); audioPreference.setCardring (index); break; default: @@ -2491,7 +2488,6 @@ void ManagerImpl::selectAudioDriver (void) int numCardRing = audioPreference.getCardring(); int sampleRate = getMainBuffer()->getInternalSamplingRate(); - int frameSize = audioPreference.getFramesize(); /* Only for the ALSA layer, we check the sound card information */ @@ -2518,8 +2514,7 @@ void ManagerImpl::selectAudioDriver (void) } /* Open the audio devices */ - _audiodriver->openDevice (numCardIn, numCardOut, numCardRing, sampleRate, frameSize, - SFL_PCM_BOTH, alsaPlugin); + _audiodriver->openDevice (numCardIn, numCardOut, numCardRing, sampleRate, SFL_PCM_BOTH, alsaPlugin); audioLayerMutexUnlock(); } @@ -2540,9 +2535,6 @@ void ManagerImpl::switchAudioManager (void) int type = _audiodriver->getLayerType(); int samplerate = _mainBuffer.getInternalSamplingRate(); - int framesize = audioPreference.getFramesize(); - - _debug ("Manager: samplerate: %d, framesize %d", samplerate, framesize); std::string alsaPlugin(audioPreference.getPlugin()); @@ -2558,8 +2550,7 @@ void ManagerImpl::switchAudioManager (void) else _audiodriver = new AlsaLayer(); - _audiodriver->openDevice (numCardIn, numCardOut, numCardRing, samplerate, framesize, - SFL_PCM_BOTH, alsaPlugin); + _audiodriver->openDevice (numCardIn, numCardOut, numCardRing, samplerate, SFL_PCM_BOTH, alsaPlugin); _debug ("Manager: Current device: %d ", type); @@ -2591,9 +2582,8 @@ void ManagerImpl::audioSamplingRateChanged (int samplerate) _debug ("Manager: Audio sampling rate changed"); int type = _audiodriver->getLayerType(); - int framesize = audioPreference.getFramesize(); - _debug ("Manager: New samplerate: %d, New framesize %d", samplerate, framesize); + _debug ("Manager: New samplerate: %d", samplerate); std::string alsaPlugin(audioPreference.getPlugin()); @@ -2611,8 +2601,7 @@ void ManagerImpl::audioSamplingRateChanged (int samplerate) else _audiodriver = new PulseLayer; - _audiodriver->openDevice (numCardIn, numCardOut, numCardRing, samplerate, framesize, - SFL_PCM_BOTH, alsaPlugin); + _audiodriver->openDevice (numCardIn, numCardOut, numCardRing, samplerate, SFL_PCM_BOTH, alsaPlugin); _debug ("Manager: Current device: %d ", type); diff --git a/daemon/src/preferences.cpp b/daemon/src/preferences.cpp index b629f832314f52eaf02ccd655f30427676d572c3..f9bbfeddbbcd3801e794fb65b402455ba027a96c 100644 --- a/daemon/src/preferences.cpp +++ b/daemon/src/preferences.cpp @@ -39,7 +39,6 @@ namespace { static const char * const DFT_PULSE_LENGTH_STR ="250"; /** Default DTMF lenght */ static const char * const ZRTP_ZIDFILE = "zidFile"; /** The filename used for storing ZIDs */ static const char * const ALSA_DFT_CARD = "0"; /** Default sound card index */ - static const char * const DFT_FRAME_SIZE = "20"; /** Default frame size in millisecond */ static const char * const DFT_VOL_SPKR_STR = "100"; /** Default speaker volume */ static const char * const DFT_VOL_MICRO_STR = "100"; /** Default mic volume */ } // end anonymous namespace @@ -282,7 +281,6 @@ void HookPreference::unserialize (Conf::MappingNode *map) AudioPreference::AudioPreference() : _cardin (atoi (ALSA_DFT_CARD)) // ALSA_DFT_CARD , _cardout (atoi (ALSA_DFT_CARD)) // ALSA_DFT_CARD , _cardring (atoi (ALSA_DFT_CARD)) // ALSA_DFT_CARD - , _framesize (atoi (DFT_FRAME_SIZE)) // DFT_FRAME_SIZE , _plugin ("default") // PCM_DEFAULT , _smplrate (44100) // DFT_SAMPLE_RATE , _devicePlayback ("") @@ -318,9 +316,6 @@ void AudioPreference::serialize (Conf::YamlEmitter *emitter) std::stringstream ringstr; ringstr << _cardring; Conf::ScalarNode cardring (ringstr.str());// 0 - std::stringstream framestr; - framestr << _framesize; - Conf::ScalarNode framesize (framestr.str()); // 20 Conf::ScalarNode plugin (_plugin); // default std::stringstream ratestr; @@ -361,7 +356,6 @@ void AudioPreference::serialize (Conf::YamlEmitter *emitter) alsapreferencemap.setKeyValue (cardinKey, &cardin); alsapreferencemap.setKeyValue (cardoutKey, &cardout); alsapreferencemap.setKeyValue (cardringKey, &cardring); - alsapreferencemap.setKeyValue (framesizeKey, &framesize); alsapreferencemap.setKeyValue (pluginKey, &plugin); alsapreferencemap.setKeyValue (smplrateKey, &smplrate); @@ -395,7 +389,6 @@ void AudioPreference::unserialize (Conf::MappingNode *map) alsamap->getValue (cardinKey, &_cardin); alsamap->getValue (cardoutKey, &_cardout); alsamap->getValue (cardringKey, &_cardring); - alsamap->getValue (framesizeKey, &_framesize); alsamap->getValue (smplrateKey, &_smplrate); alsamap->getValue (pluginKey, &_plugin); } diff --git a/daemon/src/preferences.h b/daemon/src/preferences.h index e875a31a695750f6261e80a658e8b51e49ce6401..7e5c9833aa41d365eb18bb5b7260bd8e9c7b6856 100644 --- a/daemon/src/preferences.h +++ b/daemon/src/preferences.h @@ -76,7 +76,6 @@ const std::string pulsemapKey ("pulse"); const std::string cardinKey ("cardIn");// : 0 const std::string cardoutKey ("cardOut");// 0 const std::string cardringKey ("cardRing");// : 0 -const std::string framesizeKey ("frameSize");// : 20 const std::string pluginKey ("plugin"); //: default const std::string smplrateKey ("smplRate");//: 44100 const std::string devicePlaybackKey ("devicePlayback");//: @@ -444,13 +443,6 @@ class AudioPreference : public Serializable _cardring = c; } - int getFramesize (void) const { - return _framesize; - } - void setFramesize (int f) { - _framesize = f; - } - std::string getPlugin (void) const { return _plugin; } @@ -555,7 +547,6 @@ class AudioPreference : public Serializable int _cardin; // 0 int _cardout; // 0 int _cardring;// 0 - int _framesize; // 20 std::string _plugin; // default int _smplrate;// 44100 diff --git a/daemon/test/audiolayertest.cpp b/daemon/test/audiolayertest.cpp index 7e43246b4fe501f0085bf473b1873c3f44b7d211..ca177d06e635c94501d00fd922cc821337e22ed0 100644 --- a/daemon/test/audiolayertest.cpp +++ b/daemon/test/audiolayertest.cpp @@ -44,7 +44,6 @@ void AudioLayerTest::testAudioLayerConfig() _debug ("-------------------- AudioLayerTest::testAudioLayerConfig --------------------\n"); CPPUNIT_ASSERT( Manager::instance().audioPreference.getSmplrate() == 44100); - CPPUNIT_ASSERT( Manager::instance().audioPreference.getFramesize() == 20); // alsa preferences CPPUNIT_ASSERT( Manager::instance().audioPreference.getCardin() == 0); @@ -62,8 +61,6 @@ void AudioLayerTest::testAudioLayerConfig() // TODO: Fix tests //CPPUNIT_ASSERT ( (int) Manager::instance().getAudioDriver()->getSampleRate() == sampling_rate); - - //CPPPUNIT_ASSERT ( (int) Manager::instance().getAudioDriver()->getFrameSize() == frame_size); } void AudioLayerTest::testAudioLayerSwitch() @@ -104,21 +101,15 @@ void AudioLayerTest::testPulseConnect() CPPUNIT_ASSERT (_pulselayer->getLayerType() == PULSEAUDIO); - std::string alsaPlugin; - int numCardIn, numCardOut, numCardRing, sampleRate, frameSize; + int sampleRate; - alsaPlugin = manager->audioPreference.getPlugin(); - numCardIn = manager->audioPreference.getCardin(); - numCardOut = manager->audioPreference.getCardout(); - numCardRing = manager->audioPreference.getCardring(); sampleRate = manager->audioPreference.getSmplrate(); - frameSize = manager->audioPreference.getFramesize(); CPPUNIT_ASSERT (_pulselayer->getPlaybackStream() == NULL); CPPUNIT_ASSERT (_pulselayer->getRecordStream() == NULL); try { - _pulselayer->openDevice (numCardIn, numCardOut, numCardRing, sampleRate, frameSize, SFL_PCM_BOTH, alsaPlugin); + _pulselayer->openDevice (sampleRate); } catch (...) { _debug ("Exception occured wile opening device! "); } diff --git a/daemon/test/configurationtest.cpp b/daemon/test/configurationtest.cpp index feecb45197024f3a03685566c1e92b13b53d75e1..13c394aea945ed8ee8f6c03d9049305da10f1ff5 100644 --- a/daemon/test/configurationtest.cpp +++ b/daemon/test/configurationtest.cpp @@ -44,7 +44,6 @@ void ConfigurationTest::testDefaultValueAudio() CPPUNIT_ASSERT (Manager::instance().audioPreference.getCardin() == 0); // ALSA_DFT_CARD); CPPUNIT_ASSERT (Manager::instance().audioPreference.getCardout() == 0); // ALSA_DFT_CARD); CPPUNIT_ASSERT (Manager::instance().audioPreference.getSmplrate() == 44100); // DFT_SAMPLE_RATE); - CPPUNIT_ASSERT (Manager::instance().audioPreference.getFramesize() == 20); // DFT_FRAME_SIZE); CPPUNIT_ASSERT (Manager::instance().audioPreference.getPlugin() == PCM_DEFAULT); CPPUNIT_ASSERT (Manager::instance().audioPreference.getVolumespkr() == 100); CPPUNIT_ASSERT (Manager::instance().audioPreference.getVolumemic() == 100);