diff --git a/configure.ac b/configure.ac index c23ab188173e75374f496a7efd6183eafe70d707..d9b4ed6dd946e89a73809b67d9bf1b53b14214aa 100644 --- a/configure.ac +++ b/configure.ac @@ -202,7 +202,7 @@ AC_ARG_WITH([gsm], LIBGSM= AS_IF([test "x$with_gsm" != xno], - [AC_CHECK_HEADER([gsm.h], , AC_MSG_FAILURE([Unable to find the libgsm1 headers (you may need to install the dev package). You may use --without-gsm to compile without gsm codec support.]))] + [AC_CHECK_HEADER([gsm/gsm.h], , AC_MSG_FAILURE([Unable to find the libgsm1 headers (you may need to install the dev package). You may use --without-gsm to compile without gsm codec support.]))] [AC_CHECK_LIB([gsm], [gsm_decode], [], [AC_MSG_FAILURE( diff --git a/sflphone-gtk/src/audioconf.c b/sflphone-gtk/src/audioconf.c index d7b20f282fcfab2da6a407aaaa9fc9a2ff1e570a..e8d0a71ac10c2f142f1f1a3a5573eef8161ff17f 100644 --- a/sflphone-gtk/src/audioconf.c +++ b/sflphone-gtk/src/audioconf.c @@ -90,15 +90,18 @@ config_window_fill_output_audio_plugin_list() // Call dbus to retreive list list = dbus_get_output_audio_plugin_list(); - // For each API name included in list int c = 0; - for(managerName = list[c]; managerName != NULL; managerName = list[c]) - { - c++; - gtk_list_store_append(pluginlist, &iter); - gtk_list_store_set(pluginlist, &iter, 0 , managerName, -1); - } + + if (list != NULL){ + for(managerName = list[c]; managerName != NULL; managerName = list[c]) + { + c++; + gtk_list_store_append(pluginlist, &iter); + gtk_list_store_set(pluginlist, &iter, 0 , managerName, -1); + } + } + list = NULL; } /** diff --git a/sflphone-gtk/src/dbus.c b/sflphone-gtk/src/dbus.c index 859e11333290c116c8d17ac631355932a57ea792..9430a5a8caed103b79e54da6034056d40be2d1f2 100644 --- a/sflphone-gtk/src/dbus.c +++ b/sflphone-gtk/src/dbus.c @@ -824,22 +824,22 @@ dbus_get_input_audio_plugin_list() gchar** dbus_get_output_audio_plugin_list() { - g_print("Before get output audio plugin list"); gchar** array; GError* error = NULL; - org_sflphone_SFLphone_ConfigurationManager_get_output_audio_plugin_list( - configurationManagerProxy, - &array, - &error); - g_print("After"); - if(error) + + if(!org_sflphone_SFLphone_ConfigurationManager_get_output_audio_plugin_list( configurationManagerProxy, &array, &error)) { - g_printerr("Failed to call get_output_audio_plugin_list() on ConfigurationManager: %s\n", error->message); - g_error_free(error); + if(error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION) + g_printerr ("Caught remote method (get_output_audio_plugin_list) exception %s: %s\n", dbus_g_error_get_name(error), error->message); + else + g_printerr("Error while calling get_out_audio_plugin_list: %s\n", error->message); + g_error_free (error); + return NULL; } - else + else{ g_print("DBus called get_output_audio_plugin_list() on ConfigurationManager\n"); - return array; + return array; + } } void diff --git a/src/audio/audiostream.cpp b/src/audio/audiostream.cpp index 01d94f1de1dae25b0ddbcff473859d9f128d1562..5e4d295871dc2f614f2bf0b1266aac706f3e044b 100644 --- a/src/audio/audiostream.cpp +++ b/src/audio/audiostream.cpp @@ -18,9 +18,11 @@ */ #include <audiostream.h> +#include "pulselayer.h" static pa_channel_map channel_map ; + AudioStream::AudioStream( pa_context* context, int type, std::string desc, double vol UNUSED ) : _audiostream(NULL), _streamType(type), _streamDescription(desc), flag(PA_STREAM_AUTO_TIMING_UPDATE), sample_spec(), _volume() { @@ -48,19 +50,25 @@ AudioStream::disconnect( void ) pa_stream_unref( pulseStream() ); } - void +void AudioStream::stream_state_callback( pa_stream* s, void* user_data UNUSED ) { _debug("The state of the stream changed\n"); assert(s); switch(pa_stream_get_state(s)){ case PA_STREAM_CREATING: - case PA_STREAM_TERMINATED: _debug("Stream is creating...\n"); break; + case PA_STREAM_TERMINATED: + _debug("Stream is terminating...\n" ); + PulseLayer::streamState++; + break; case PA_STREAM_READY: _debug("Stream successfully created, connected to %s\n", pa_stream_get_device_name( s )); break; + case PA_STREAM_UNCONNECTED: + _debug("Stream unconnected\n"); + break; case PA_STREAM_FAILED: default: _debug("Stream error - Sink/Source doesn't exists: %s\n" , pa_strerror(pa_context_errno(pa_stream_get_context(s)))); diff --git a/src/audio/codecs/gsmcodec.cpp b/src/audio/codecs/gsmcodec.cpp index 4fc94e30ed3a62e5ad951f9183be3a24aabc7a96..1ab85f23886324ae5a05523e6144c88ffd04c58f 100644 --- a/src/audio/codecs/gsmcodec.cpp +++ b/src/audio/codecs/gsmcodec.cpp @@ -21,7 +21,7 @@ #include "audiocodec.h" extern "C"{ -#include <gsm.h> +#include <gsm/gsm.h> } /** diff --git a/src/audio/pulselayer.cpp b/src/audio/pulselayer.cpp index ef6e6a52b52ae7af2ec6ddc2b756a631911a42e3..98a6cd6aa54fcf9e3a25a0ae50eb1e263a9f53c5 100644 --- a/src/audio/pulselayer.cpp +++ b/src/audio/pulselayer.cpp @@ -21,6 +21,8 @@ int framesPerBuffer = 2048; +int PulseLayer::streamState; + static void audioCallback ( pa_stream* s, size_t bytes, void* userdata ) { assert( s && bytes ); @@ -39,6 +41,7 @@ static void audioCallback ( pa_stream* s, size_t bytes, void* userdata ) , record() , cache() { + PulseLayer::streamState = 0; _debug("Pulse audio constructor: Create context\n"); } @@ -54,10 +57,14 @@ PulseLayer::~PulseLayer (void) void PulseLayer::closeLayer( void ) -{ +{ playback->disconnect(); record->disconnect(); - pa_context_disconnect( context ); + + while(PulseLayer::streamState != 2) + ; + PulseLayer::streamState = 0; + pa_context_disconnect( context ); pa_context_unref( context ); sleep(2); } diff --git a/src/audio/pulselayer.h b/src/audio/pulselayer.h index 2a055c81c67290309dfa96d87ef491d20bbecb67..dc22bfaedd968324b232946770ff06b7d08b5428 100644 --- a/src/audio/pulselayer.h +++ b/src/audio/pulselayer.h @@ -255,6 +255,8 @@ class PulseLayer : public AudioLayer { int spkrVolume; int micVolume; +public: + static int streamState; }; #endif // _PULSE_LAYER_H_