diff --git a/sflphone-common/src/audio/audiorecord.cpp b/sflphone-common/src/audio/audiorecord.cpp index ab9751d9924043a6a9bbb2fee222f3a58624cbd9..343b65aa60c88998d44543da521187ed2eb5e90c 100644 --- a/sflphone-common/src/audio/audiorecord.cpp +++ b/sflphone-common/src/audio/audiorecord.cpp @@ -291,7 +291,7 @@ bool AudioRecord::setRawFile() fp = fopen (savePath_.c_str(), "wb"); if (!fp) { - _warn ("AudioRecord::setRawFile() : could not create RAW file!"); + _warn ("AudioRecord: Could not create RAW file!"); return false; } @@ -308,7 +308,7 @@ bool AudioRecord::setRawFile() bool AudioRecord::setWavFile() { - _debug ("AudioRecord: Create wave file %s", savePath_.c_str()); + _debug ("AudioRecord: Create new wave file %s, sampling rate: %d", savePath_.c_str(), sndSmplRate_); fp = fopen (savePath_.c_str(), "wb"); @@ -322,11 +322,8 @@ bool AudioRecord::setWavFile() }; hdr.riff[3] = 'F'; - hdr.wave[3] = 'E'; - hdr.fmt[3] = ' '; - hdr.data[3] = 'a'; hdr.num_chans = channels_; diff --git a/sflphone-common/src/audio/audiortp/AudioRtpRecordHandler.cpp b/sflphone-common/src/audio/audiortp/AudioRtpRecordHandler.cpp index d5514b66c0c736473322240e727bf7187b493cd9..2d9167c2586dc73d0ef419bd39ad0183e43a216b 100644 --- a/sflphone-common/src/audio/audiortp/AudioRtpRecordHandler.cpp +++ b/sflphone-common/src/audio/audiortp/AudioRtpRecordHandler.cpp @@ -158,7 +158,6 @@ void AudioRtpRecordHandler::updateRtpMedia (AudioCodec *audioCodec) _audioRtpRecord.audioCodecMutex.leave(); - // Manager::instance().getMainBuffer()->setInternalSamplingRate (_audioRtpRecord._codecSampleRate); Manager::instance().audioSamplingRateChanged(_audioRtpRecord._codecSampleRate); if (lastSamplingRate != _audioRtpRecord._codecSampleRate) diff --git a/sflphone-common/src/audio/audiortp/AudioRtpSession.cpp b/sflphone-common/src/audio/audiortp/AudioRtpSession.cpp index 6feaee062843def1a0571d43abe401eae3151a39..7ad415b7a1a38d756fe89aca6dfe0befc1a0bdf8 100644 --- a/sflphone-common/src/audio/audiortp/AudioRtpSession.cpp +++ b/sflphone-common/src/audio/audiortp/AudioRtpSession.cpp @@ -123,7 +123,6 @@ void AudioRtpSession::setSessionMedia (AudioCodec *audioCodec) } } - // Set recording sampling rate _ca->setRecordingSmplRate (getCodecSampleRate()); } @@ -164,7 +163,6 @@ void AudioRtpSession::updateSessionMedia (AudioCodec *audioCodec) } - // Set recording sampling rate _ca->setRecordingSmplRate (getCodecSampleRate()); _timestamp = getCurrentTimestamp(); diff --git a/sflphone-common/src/audio/mainbuffer.cpp b/sflphone-common/src/audio/mainbuffer.cpp index 01a5dd87a8ab9c6a07fbe2189b1ecad7b4e2b378..6bdc431d897d3bc2b6f17c061294476f8592f43e 100644 --- a/sflphone-common/src/audio/mainbuffer.cpp +++ b/sflphone-common/src/audio/mainbuffer.cpp @@ -49,10 +49,11 @@ MainBuffer::~MainBuffer() void MainBuffer::setInternalSamplingRate (int sr) { + _debug("MainBuffer: ------------------------------------- Set internal sampling rate"); if (sr > _internalSamplingRate) { - _debug ("MainBuffer: Internal sampling rate changed %d", sr); + _debug ("MainBuffer: ---------------------------------- Internal sampling rate changed %d", sr); // This call takes the mutex flushAllBuffers(); diff --git a/sflphone-common/src/audio/pulseaudio/audiostream.cpp b/sflphone-common/src/audio/pulseaudio/audiostream.cpp index 86f12f3dc7fca2cd0f511a6efd23e7253cdefddb..63e7e166d30f165cc261df5108a1e5d98b888f53 100644 --- a/sflphone-common/src/audio/pulseaudio/audiostream.cpp +++ b/sflphone-common/src/audio/pulseaudio/audiostream.cpp @@ -198,7 +198,7 @@ AudioStream::createStream (pa_context* c, std::string *deviceName) assert (pa_sample_spec_valid (&_sample_spec)); assert (pa_channel_map_valid (&channel_map)); - _info ("Audio: Create pulseaudio stream"); + _info ("Audio: Create pulseaudio stream: %d", _sample_spec.rate); pa_buffer_attr* attributes = (pa_buffer_attr*) malloc (sizeof (pa_buffer_attr)); diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp index d7c013bcf6f532d796e00432e606016d9a2ad109..5b6d84f537014e8649ac9b6df73a8f7d90b11d91 100644 --- a/sflphone-common/src/managerimpl.cpp +++ b/sflphone-common/src/managerimpl.cpp @@ -3072,22 +3072,25 @@ void ManagerImpl::audioSamplingRateChanged (int samplerate) int type, currentSamplerate, framesize, numCardIn, numCardOut, numCardRing; std::string alsaPlugin; - _debug ("Manager: Audio sampling rate changed"); - - if (!_audiodriver) + if (!_audiodriver) { + _debug("Manager: No Audio driver set"); return; + } // Only modify internal sampling rate if new sampling rate is higher currentSamplerate = _mainBuffer.getInternalSamplingRate(); - if(currentSamplerate <= samplerate) + if(currentSamplerate >= samplerate) { + _debug("Manager: No need to update audio layer sampling rate"); return; + } + else { + _debug ("Manager: Audio sampling rate changed"); + } type = _audiodriver->getLayerType(); - - // samplerate = _mainBuffer.getInternalSamplingRate(); framesize = audioPreference.getFramesize(); - _debug ("Manager: new samplerate: %d, new framesize %d", samplerate, framesize); + _debug ("Manager: New samplerate: %d, New framesize %d", samplerate, framesize); alsaPlugin = audioPreference.getPlugin(); @@ -3152,18 +3155,9 @@ void ManagerImpl::audioSamplingRateChanged (int samplerate) _dtmfKey = new DTMF (sampleRate); } - if (hasCurrentCall()) + if (hasCurrentCall()) { _audiodriver->startStream(); - - // ost::MutexLock unlock (*getAudioLayerMutex()); - // getAudioLayerMutex()->leave(); - - // need to stop audio streams if there is currently no call - // if ( (type != PULSEAUDIO) && (!hasCurrentCall())) { - // _debug("There is currently a call!!"); - // _audiodriver->stopStream(); - - // } + } } /**