Commit ee33dbad authored by Alexandre Savard's avatar Alexandre Savard

[#4857] Fix audio codec negotiation problem

parent ad5b79d7
......@@ -183,7 +183,7 @@ search_phone_home_cb (GtkWidget *widget)
{
addressbook_config->search_phone_home = (guint) gtk_toggle_button_get_active (
GTK_TOGGLE_BUTTON (widget));
GTK_TOGGLE_BUTTON (widget));
}
static void
......
......@@ -166,8 +166,8 @@ static void search_all (GtkWidget *item UNUSED, GtkEntry *entry)
gtk_entry_set_icon_from_stock (entry, GTK_ENTRY_ICON_PRIMARY, GTK_STOCK_FIND);
gtk_entry_set_icon_tooltip_text (entry, GTK_ENTRY_ICON_PRIMARY,
g_markup_printf_escaped ("%s\n%s",
_ ("Search all"),
_ ("Click here to change the search type")));
_ ("Search all"),
_ ("Click here to change the search type")));
history_search (HistorySearchType);
}
......@@ -179,8 +179,8 @@ static void search_by_missed (GtkWidget *item UNUSED, GtkEntry *entry)
gtk_entry_set_icon_from_pixbuf (entry, GTK_ENTRY_ICON_PRIMARY, missed_pixbuf);
gtk_entry_set_icon_tooltip_text (entry, GTK_ENTRY_ICON_PRIMARY,
g_markup_printf_escaped ("%s\n%s",
_ ("Search by missed call"),
_ ("Click here to change the search type")));
_ ("Search by missed call"),
_ ("Click here to change the search type")));
history_search (HistorySearchType);
}
......@@ -191,8 +191,8 @@ static void search_by_incoming (GtkWidget *item UNUSED, GtkEntry *entry)
gtk_entry_set_icon_from_pixbuf (entry, GTK_ENTRY_ICON_PRIMARY, incoming_pixbuf);
gtk_entry_set_icon_tooltip_text (entry, GTK_ENTRY_ICON_PRIMARY,
g_markup_printf_escaped ("%s\n%s",
_ ("Search by incoming call"),
_ ("Click here to change the search type")));
_ ("Search by incoming call"),
_ ("Click here to change the search type")));
history_search (HistorySearchType);
}
......@@ -203,8 +203,8 @@ static void search_by_outgoing (GtkWidget *item UNUSED, GtkEntry *entry)
gtk_entry_set_icon_from_pixbuf (entry, GTK_ENTRY_ICON_PRIMARY, outgoing_pixbuf);
gtk_entry_set_icon_tooltip_text (entry, GTK_ENTRY_ICON_PRIMARY,
g_markup_printf_escaped ("%s\n%s",
_ ("Search by outgoing call"),
_ ("Click here to change the search type")));
_ ("Search by outgoing call"),
_ ("Click here to change the search type")));
history_search (HistorySearchType);
}
......
......@@ -1629,7 +1629,7 @@ create_waiting_icon()
waiting_icon = gtk_image_menu_item_new_with_label ("");
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (waiting_icon),
gtk_image_new_from_animation (gdk_pixbuf_animation_new_from_file (
ICONS_DIR "/wait-on.gif", NULL)));
ICONS_DIR "/wait-on.gif", NULL)));
gtk_menu_item_set_right_justified (GTK_MENU_ITEM (waiting_icon), TRUE);
return waiting_icon;
......
......@@ -37,21 +37,21 @@ int framesPerBufferAlsa = 2048;
// Constructor
AlsaLayer::AlsaLayer (ManagerImpl* manager)
: AudioLayer (manager , ALSA)
, _PlaybackHandle (NULL)
, _RingtoneHandle (NULL)
, _CaptureHandle (NULL)
, _periodSize (160)
, _audioPlugin ("default")
, IDSoundCards()
, _is_prepared_playback (false)
, _is_prepared_capture (false)
, _is_running_playback (false)
, _is_running_capture (false)
, _is_open_playback (false)
, _is_open_capture (false)
, _trigger_request (false)
, _audioThread (NULL)
: AudioLayer (manager , ALSA)
, _PlaybackHandle (NULL)
, _RingtoneHandle (NULL)
, _CaptureHandle (NULL)
, _periodSize (160)
, _audioPlugin ("default")
, IDSoundCards()
, _is_prepared_playback (false)
, _is_prepared_capture (false)
, _is_running_playback (false)
, _is_running_capture (false)
, _is_open_playback (false)
, _is_open_capture (false)
, _trigger_request (false)
, _audioThread (NULL)
{
_debug ("Audio: Build ALSA layer");
......
......@@ -34,7 +34,7 @@
const double AudioDevice::DEFAULT_RATE = 8000.0;
AudioDevice::AudioDevice (int id, const std::string& name) :
_id (id), _name (name), _rate (DEFAULT_RATE)
_id (id), _name (name), _rate (DEFAULT_RATE)
{
_rate = DEFAULT_RATE;
}
......
......@@ -68,18 +68,18 @@ class AudioLayer
* @param manager An instance of managerimpl
*/
AudioLayer (ManagerImpl* manager , int type)
: _defaultVolume (100)
, _layerType (type)
, _manager (manager)
, _urgentRingBuffer (SIZEBUF, default_id)
, _indexIn (0)
, _indexOut (0)
, _audioSampleRate (0)
, _frameSize (0)
, _inChannel (1)
, _outChannel (1)
, _errorMessage (0)
, _mutex () {
: _defaultVolume (100)
, _layerType (type)
, _manager (manager)
, _urgentRingBuffer (SIZEBUF, default_id)
, _indexIn (0)
, _indexOut (0)
, _audioSampleRate (0)
, _frameSize (0)
, _inChannel (1)
, _outChannel (1)
, _errorMessage (0)
, _mutex () {
}
......
......@@ -50,16 +50,16 @@ struct wavhdr {
AudioRecord::AudioRecord() : fp (NULL)
, channels_ (1)
, byteCounter_ (0)
, sndSmplRate_ (8000)
, nbSamplesMic_ (0)
, nbSamplesSpk_ (0)
, nbSamplesMax_ (3000)
, recordingEnabled_ (false)
, mixBuffer_ (NULL)
, micBuffer_ (NULL)
, spkBuffer_ (NULL)
, channels_ (1)
, byteCounter_ (0)
, sndSmplRate_ (8000)
, nbSamplesMic_ (0)
, nbSamplesSpk_ (0)
, nbSamplesMax_ (3000)
, recordingEnabled_ (false)
, mixBuffer_ (NULL)
, micBuffer_ (NULL)
, spkBuffer_ (NULL)
{
mixBuffer_ = new SFLDataFormat[nbSamplesMax_];
......
......@@ -38,21 +38,21 @@ namespace sfl
static const SFLDataFormat initFadeinFactor = 32000;
AudioRtpRecord::AudioRtpRecord () : _audioCodec (NULL)
, _hasDynamicPayloadType (false)
, _micData (NULL)
, _micDataConverted (NULL)
, _micDataEncoded (NULL)
, _spkrDataDecoded (NULL)
, _spkrDataConverted (NULL)
, _converter (NULL)
, _codecSampleRate (0)
, _codecFrameSize (0)
, _micFadeInComplete (false)
, _spkrFadeInComplete (false)
, _micAmplFactor (initFadeinFactor)
, _spkrAmplFactor (initFadeinFactor)
, _audioProcess (NULL)
, _noiseSuppress (NULL)
, _hasDynamicPayloadType (false)
, _micData (NULL)
, _micDataConverted (NULL)
, _micDataEncoded (NULL)
, _spkrDataDecoded (NULL)
, _spkrDataConverted (NULL)
, _converter (NULL)
, _codecSampleRate (0)
, _codecFrameSize (0)
, _micFadeInComplete (false)
, _spkrFadeInComplete (false)
, _micAmplFactor (initFadeinFactor)
, _spkrAmplFactor (initFadeinFactor)
, _audioProcess (NULL)
, _noiseSuppress (NULL)
{
}
......
......@@ -42,22 +42,22 @@ namespace sfl
{
AudioRtpSession::AudioRtpSession (ManagerImpl * manager, SIPCall * sipcall) :
// ost::SymmetricRTPSession (ost::InetHostAddress (sipcall->getLocalIp().c_str()), sipcall->getLocalAudioPort()),
AudioRtpRecordHandler (manager, sipcall),
ost::TRTPSessionBase<ost::SymmetricRTPChannel,ost::SymmetricRTPChannel,ost::AVPQueue> (ost::InetHostAddress (sipcall->getLocalIp().c_str()),
sipcall->getLocalAudioPort(),
0,
ost::MembershipBookkeeping::defaultMembersHashSize,
ost::defaultApplication())
, _time (new ost::Time())
, _mainloopSemaphore (0)
, _manager (manager)
, _timestamp (0)
, _timestampIncrement (0)
, _timestampCount (0)
, _countNotificationTime (0)
, _ca (sipcall)
, _isStarted (false)
// ost::SymmetricRTPSession (ost::InetHostAddress (sipcall->getLocalIp().c_str()), sipcall->getLocalAudioPort()),
AudioRtpRecordHandler (manager, sipcall),
ost::TRTPSessionBase<ost::SymmetricRTPChannel,ost::SymmetricRTPChannel,ost::AVPQueue> (ost::InetHostAddress (sipcall->getLocalIp().c_str()),
sipcall->getLocalAudioPort(),
0,
ost::MembershipBookkeeping::defaultMembersHashSize,
ost::defaultApplication())
, _time (new ost::Time())
, _mainloopSemaphore (0)
, _manager (manager)
, _timestamp (0)
, _timestampIncrement (0)
, _timestampCount (0)
, _countNotificationTime (0)
, _ca (sipcall)
, _isStarted (false)
{
ost::Thread::setCancel (cancelDefault);
......
......@@ -50,16 +50,16 @@ namespace sfl
{
AudioSrtpSession::AudioSrtpSession (ManagerImpl * manager, SIPCall * sipcall) :
AudioRtpSession (manager, sipcall),
_localCryptoSuite (0),
_remoteCryptoSuite (0),
_localMasterKeyLength (0),
_localMasterSaltLength (0),
_remoteMasterKeyLength (0),
_remoteMasterSaltLength (0),
_remoteCryptoCtx (NULL),
_localCryptoCtx (NULL),
_remoteOfferIsSet (false)
AudioRtpSession (manager, sipcall),
_localCryptoSuite (0),
_remoteCryptoSuite (0),
_localMasterKeyLength (0),
_localMasterSaltLength (0),
_remoteMasterKeyLength (0),
_remoteMasterSaltLength (0),
_remoteCryptoCtx (NULL),
_localCryptoCtx (NULL),
_remoteOfferIsSet (false)
{
}
......
......@@ -50,22 +50,22 @@ namespace sfl
{
AudioZrtpSession::AudioZrtpSession (ManagerImpl * manager, SIPCall * sipcall, const std::string& zidFilename) :
// ost::SymmetricZRTPSession (ost::InetHostAddress (sipcall->getLocalIp().c_str()), sipcall->getLocalAudioPort()),
AudioRtpRecordHandler (manager, sipcall),
ost::TRTPSessionBase<ost::SymmetricRTPChannel, ost::SymmetricRTPChannel, ost::ZrtpQueue> (ost::InetHostAddress (sipcall->getLocalIp().c_str()),
sipcall->getLocalAudioPort(),
0,
ost::MembershipBookkeeping::defaultMembersHashSize,
ost::defaultApplication())
, _zidFilename (zidFilename)
, _time (new ost::Time())
, _mainloopSemaphore (0)
, _manager (manager)
, _timestamp (0)
, _timestampIncrement (0)
, _timestampCount (0)
, _countNotificationTime (0)
, _ca (sipcall)
// ost::SymmetricZRTPSession (ost::InetHostAddress (sipcall->getLocalIp().c_str()), sipcall->getLocalAudioPort()),
AudioRtpRecordHandler (manager, sipcall),
ost::TRTPSessionBase<ost::SymmetricRTPChannel, ost::SymmetricRTPChannel, ost::ZrtpQueue> (ost::InetHostAddress (sipcall->getLocalIp().c_str()),
sipcall->getLocalAudioPort(),
0,
ost::MembershipBookkeeping::defaultMembersHashSize,
ost::defaultApplication())
, _zidFilename (zidFilename)
, _time (new ost::Time())
, _mainloopSemaphore (0)
, _manager (manager)
, _timestamp (0)
, _timestampIncrement (0)
, _timestampCount (0)
, _countNotificationTime (0)
, _ca (sipcall)
{
_debug ("AudioZrtpSession initialized");
initializeZid();
......
......@@ -48,7 +48,7 @@ namespace sfl
{
ZrtpSessionCallback::ZrtpSessionCallback (SIPCall *sipcall) :
_sipcall (sipcall)
_sipcall (sipcall)
{
if (_mapInitialized) {
......
......@@ -38,7 +38,7 @@ class Alaw : public AudioCodec
public:
// 8 PCMA A 8000 1 [RFC3551]
Alaw (int payload=0)
: AudioCodec (payload, "PCMA") {
: AudioCodec (payload, "PCMA") {
_clockRate = 8000;
_frameSize = 160; // samples, 20 ms at 8kHz
_channel = 1;
......
......@@ -64,7 +64,7 @@ class AudioCodec
public:
AudioCodec (int payload, const std::string &codecName)
: _codecName (codecName), _clockRate (8000), _channel (1), _bitrate (0.0),_bandwidth (0),_payload (payload), _hasDynamicPayload (false),_state (true) {
: _codecName (codecName), _clockRate (8000), _channel (1), _bitrate (0.0),_bandwidth (0),_payload (payload), _hasDynamicPayload (false),_state (true) {
_hasDynamicPayload = (_payload >= 96 && _payload <= 127) ? true : false;
......@@ -78,7 +78,7 @@ class AudioCodec
}
AudioCodec (const AudioCodec& codec)
: _codecName (codec._codecName), _clockRate (codec._clockRate), _channel (codec._channel), _bitrate (codec._bitrate),_bandwidth (codec._bandwidth),_payload (codec._payload), _hasDynamicPayload (false),_state (true) {
: _codecName (codec._codecName), _clockRate (codec._clockRate), _channel (codec._channel), _bitrate (codec._bitrate),_bandwidth (codec._bandwidth),_payload (codec._payload), _hasDynamicPayload (false),_state (true) {
_hasDynamicPayload = (_payload >= 96 && _payload <= 127) ? true : false;
......
......@@ -49,7 +49,7 @@ class G722 : public AudioCodec
public:
G722 (int payload=9)
: AudioCodec (payload, "G722") {
: AudioCodec (payload, "G722") {
_clockRate = 16000;
_frameSize = 320; // samples, 20 ms at 16kHz
_channel = 1;
......
......@@ -39,13 +39,13 @@ class Speex : public AudioCodec
public:
Speex (int payload=0)
: AudioCodec (payload, "speex"),
_speexModePtr (NULL),
_speex_dec_bits(),
_speex_enc_bits(),
_speex_dec_state(),
_speex_enc_state(),
_speex_frame_size() {
: AudioCodec (payload, "speex"),
_speexModePtr (NULL),
_speex_dec_bits(),
_speex_enc_bits(),
_speex_dec_state(),
_speex_enc_state(),
_speex_frame_size() {
_clockRate = 8000;
_frameSize = 160; // samples, 20 ms at 8kHz
_channel = 1;
......
......@@ -38,13 +38,13 @@ class Speex : public AudioCodec
public:
Speex (int payload=0)
: AudioCodec (payload, "speex"),
_speexModePtr (NULL),
_speex_dec_bits(),
_speex_enc_bits(),
_speex_dec_state(),
_speex_enc_state(),
_speex_frame_size() {
: AudioCodec (payload, "speex"),
_speexModePtr (NULL),
_speex_dec_bits(),
_speex_enc_bits(),
_speex_dec_state(),
_speex_enc_state(),
_speex_frame_size() {
_clockRate = 32000;
_frameSize = 640; // 20 ms at 32 kHz
_channel = 1;
......
......@@ -38,13 +38,13 @@ class Speex : public AudioCodec
public:
Speex (int payload=0)
: AudioCodec (payload, "speex"),
_speexModePtr (NULL),
_speex_dec_bits(),
_speex_enc_bits(),
_speex_dec_state(),
_speex_enc_state(),
_speex_frame_size() {
: AudioCodec (payload, "speex"),
_speexModePtr (NULL),
_speex_dec_bits(),
_speex_enc_bits(),
_speex_dec_state(),
_speex_enc_state(),
_speex_frame_size() {
_clockRate = 16000;
_frameSize = 320; // 20 ms at 16 kHz
_channel = 1;
......
......@@ -40,7 +40,7 @@ class Ulaw : public AudioCodec
public:
// 0 PCMU A 8000 1 [RFC3551]
Ulaw (int payload=0)
: AudioCodec (payload, "PCMU") {
: AudioCodec (payload, "PCMU") {
_clockRate = 8000;
_frameSize = 160; // samples, 20 ms at 8kHz
_channel = 1;
......
......@@ -61,8 +61,8 @@ std::vector<double> irb (bandpassCoefs, bandpassCoefs + sizeof (bandpassCoefs) /
FirFilter::FirFilter (std::vector<double> ir) : _length (ir.size()),
_impulseResponse (ir),
_count (0)
_impulseResponse (ir),
_count (0)
{
memset (_taps, 0, sizeof (double) *MAXFILTERSIZE);
}
......
......@@ -33,34 +33,34 @@
#include <cmath>
EchoCancel::EchoCancel (int smplRate, int frameLength) : _samplingRate (smplRate),
_frameLength (frameLength),
_smplPerFrame (0),
_smplPerSeg (0),
_nbSegmentPerFrame (0),
_micHistoryLength (0),
_spkrHistoryLength (0),
_alpha (0.01),
_spkrLevelMem (0),
_micLevelMem (0),
_spkrLevel (0),
_micLevel (0),
_spkrHistCnt (0),
_micHistCnt (0),
_amplFactor (0.0),
_lastAmplFactor (0.0),
_amplDelayIndexIn (0),
_amplDelayIndexOut (0),
_adaptDone (false),
_adaptStarted (false),
_adaptCnt (0),
_spkrAdaptCnt (0),
_micAdaptCnt (0),
_spkrAdaptSize (SPKR_ADAPT_SIZE),
_micAdaptSize (MIC_ADAPT_SIZE),
_correlationSize (0),
_processedByte (0),
_echoActive (true),
_noiseActive (true)
_frameLength (frameLength),
_smplPerFrame (0),
_smplPerSeg (0),
_nbSegmentPerFrame (0),
_micHistoryLength (0),
_spkrHistoryLength (0),
_alpha (0.01),
_spkrLevelMem (0),
_micLevelMem (0),
_spkrLevel (0),
_micLevel (0),
_spkrHistCnt (0),
_micHistCnt (0),
_amplFactor (0.0),
_lastAmplFactor (0.0),
_amplDelayIndexIn (0),
_amplDelayIndexOut (0),
_adaptDone (false),
_adaptStarted (false),
_adaptCnt (0),
_spkrAdaptCnt (0),
_micAdaptCnt (0),
_spkrAdaptSize (SPKR_ADAPT_SIZE),
_micAdaptSize (MIC_ADAPT_SIZE),
_correlationSize (0),
_processedByte (0),
_echoActive (true),
_noiseActive (true)
{
_debug ("EchoCancel: Instantiate echo canceller");
......
......@@ -31,8 +31,8 @@
#include "noisesuppress.h"
NoiseSuppress::NoiseSuppress (int smplPerFrame, int samplingRate) : _noiseState (NULL)
, _smplPerFrame (smplPerFrame)
, _samplingRate (samplingRate)
, _smplPerFrame (smplPerFrame)
, _samplingRate (samplingRate)
{
initNewNoiseSuppressor (_smplPerFrame, _samplingRate);
}
......
......@@ -36,14 +36,14 @@ static pa_channel_map channel_map;
AudioStream::AudioStream (PulseLayerType * driver, int smplrate)
: _audiostream (NULL),
_context (driver->context),
_streamType (driver->type),
_streamDescription (driver->description),
_volume(),
_flag (PA_STREAM_AUTO_TIMING_UPDATE),
_sample_spec(),
_mainloop (driver->mainloop)
: _audiostream (NULL),
_context (driver->context),
_streamType (driver->type),
_streamDescription (driver->description),
_volume(),
_flag (PA_STREAM_AUTO_TIMING_UPDATE),
_sample_spec(),
_mainloop (driver->mainloop)
{
_sample_spec.format = PA_SAMPLE_S16LE; // PA_SAMPLE_FLOAT32LE;
_sample_spec.rate = smplrate;
......
......@@ -234,12 +234,12 @@ static void playback_overflow_callback (pa_stream* s UNUSED, void* userdata UNUS
PulseLayer::PulseLayer (ManagerImpl* manager)
: AudioLayer (manager , PULSEAUDIO)
, context (NULL)
, m (NULL)
, playback (NULL)
, record (NULL)
, ringtone (NULL)
: AudioLayer (manager , PULSEAUDIO)
, context (NULL)
, m (NULL)
, playback (NULL)
, record (NULL)
, ringtone (NULL)
{