[ekiga/gnome-2-26] Fixed possible threading issue in the PTLIB audio input code
- From: Eugen Dedu <ededu src gnome org>
- To: svn-commits-list gnome org
- Subject: [ekiga/gnome-2-26] Fixed possible threading issue in the PTLIB audio input code
- Date: Mon, 27 Apr 2009 12:34:53 -0400 (EDT)
commit f865c52ea48477955d5c9a7e70b1ff44bf76fee3
Author: Julien Puydt <jpuydt noether localdomain>
Date: Tue Apr 21 16:55:21 2009 +0200
Fixed possible threading issue in the PTLIB audio input code
Don't use make_slot in threads
---
.../components/ptlib/audioinput-manager-ptlib.cpp | 28 +++++++++++++++++---
.../components/ptlib/audioinput-manager-ptlib.h | 7 +++++
2 files changed, 31 insertions(+), 4 deletions(-)
diff --git a/lib/engine/components/ptlib/audioinput-manager-ptlib.cpp b/lib/engine/components/ptlib/audioinput-manager-ptlib.cpp
index e76f021..0d70fc0 100644
--- a/lib/engine/components/ptlib/audioinput-manager-ptlib.cpp
+++ b/lib/engine/components/ptlib/audioinput-manager-ptlib.cpp
@@ -129,7 +129,7 @@ bool GMAudioInputManager_ptlib::open (unsigned channels, unsigned samplerate, un
if (error_code != Ekiga::AI_ERROR_NONE) {
PTRACE(1, "GMAudioInputManager_ptlib\tEncountered error " << error_code << " while opening device ");
- Ekiga::Runtime::run_in_main (sigc::bind (device_error.make_slot (), current_state.device, error_code));
+ Ekiga::Runtime::run_in_main (sigc::bind (sigc::mem_fun (this, &GMAudioInputManager_ptlib::device_error_in_main), current_state.device, error_code));
return false;
}
@@ -140,7 +140,7 @@ bool GMAudioInputManager_ptlib::open (unsigned channels, unsigned samplerate, un
Ekiga::AudioInputSettings settings;
settings.volume = volume;
settings.modifyable = true;
- Ekiga::Runtime::run_in_main (sigc::bind (device_opened.make_slot (), current_state.device, settings));
+ Ekiga::Runtime::run_in_main (sigc::bind (sigc::mem_fun (this, &GMAudioInputManager_ptlib::device_opened_in_main), current_state.device, settings));
return true;
}
@@ -153,7 +153,7 @@ void GMAudioInputManager_ptlib::close()
input_device = NULL;
}
current_state.opened = false;
- Ekiga::Runtime::run_in_main (sigc::bind (device_closed.make_slot (), current_state.device));
+ Ekiga::Runtime::run_in_main (sigc::bind (sigc::mem_fun (this, &GMAudioInputManager_ptlib::device_closed_in_main), current_state.device));
}
void GMAudioInputManager_ptlib::set_buffer_size (unsigned buffer_size, unsigned num_buffers)
@@ -184,7 +184,7 @@ bool GMAudioInputManager_ptlib::get_frame_data (char *data,
}
if (bytes_read != size) {
PTRACE(1, "GMAudioInputManager_ptlib\tEncountered error while trying to read data");
- Ekiga::Runtime::run_in_main (sigc::bind (device_error.make_slot (), current_state.device, Ekiga::AI_ERROR_READ));
+ Ekiga::Runtime::run_in_main (sigc::bind (sigc::mem_fun (this, &GMAudioInputManager_ptlib::device_error_in_main), current_state.device, Ekiga::AI_ERROR_READ));
}
}
@@ -214,3 +214,23 @@ bool GMAudioInputManager_ptlib::has_device(const std::string & source, const std
}*/
return false;
}
+
+void
+GMAudioInputManager_ptlib::device_error_in_main (Ekiga::AudioInputDevice device,
+ Ekiga::AudioInputErrorCodes code)
+{
+ device_error.emit (device, code);
+}
+
+void
+GMAudioInputManager_ptlib::device_opened_in_main (Ekiga::AudioInputDevice device,
+ Ekiga::AudioInputSettings settings)
+{
+ device_opened.emit (device, settings);
+}
+
+void
+GMAudioInputManager_ptlib::device_closed_in_main (Ekiga::AudioInputDevice device)
+{
+ device_closed.emit (device);
+}
diff --git a/lib/engine/components/ptlib/audioinput-manager-ptlib.h b/lib/engine/components/ptlib/audioinput-manager-ptlib.h
index 4f525b2..a23d11f 100644
--- a/lib/engine/components/ptlib/audioinput-manager-ptlib.h
+++ b/lib/engine/components/ptlib/audioinput-manager-ptlib.h
@@ -81,6 +81,13 @@
unsigned expectedFrameSize;
PSoundChannel *input_device;
+
+ private:
+ void device_error_in_main (Ekiga::AudioInputDevice device,
+ Ekiga::AudioInputErrorCodes code);
+ void device_opened_in_main (Ekiga::AudioInputDevice device,
+ Ekiga::AudioInputSettings settings);
+ void device_closed_in_main (Ekiga::AudioInputDevice device);
};
/**
* @}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]