Package: twinkle Version: 0.2.1-2 Severity: important Tags: patch I have found timing problems in the audio thread creations that can cause crashes.
If twinkle receives a call via Asterisk from another SIP phone and Asterisk reINVITEs the call to stay out of the audio path, there is a probability that a audio thread won't begin execution before it's deleted as a consequence of the reINVITE. But since the is_running flag haven't been set, the dtors won't wait for the thread to finish. It's solved in my patch by setting the is_running flags when the thread is created. /Mikael -- System Information: Debian Release: testing/unstable APT prefers stable APT policy: (871, 'stable'), (50, 'testing'), (30, 'unstable'), (10, 'unstable'), (1, 'experimental') Architecture: i386 (i686) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.11-vserver-k7 Locale: LANG=sv_SE.UTF-8, LC_CTYPE=sv_SE.UTF-8 (charmap=UTF-8) Versions of packages twinkle depends on: ii libc6 2.3.5-5 GNU C Library: Shared libraries an ii libccrtp1-1.3c2 1.3.4-1 Common C++ class framework for RTP ii libcommoncpp2-1.3c2 1.3.14-1 A GNU package for creating portabl ii libgcc1 1:4.0.1-6 GCC support library ii libqt3-mt 3:3.3.4-7 Qt GUI Library (Threaded runtime v ii libstdc++6 4.0.1-6 The GNU Standard C++ Library v3 ii libx11-6 6.8.2.dfsg.1-6 X Window System protocol client li ii libxext6 6.8.2.dfsg.1-6 X Window System miscellaneous exte ii libxml2 2.6.21-1 GNOME XML library ii xlibs 6.8.2.dfsg.1-6 X Window System client libraries m ii zlib1g 1:1.2.3-3 compression library - runtime twinkle recommends no packages. -- no debconf information
only in patch2: unchanged: --- twinkle-0.2.1.orig/src/audio/audio_session.cpp +++ twinkle-0.2.1/src/audio/audio_session.cpp @@ -672,11 +672,13 @@ if (audio_rx) { try { + audio_rx->set_running(true); thr_audio_rx = new t_thread(main_audio_rx, NULL); MEMMAN_NEW(thr_audio_rx); // thr_audio_rx->set_sched_fifo(90); thr_audio_rx->detach(); } catch (int) { + audio_rx->set_running(false); string msg("Failed to create audio_rx thread."); log_file->write_report(msg, "t_audio_session::run", LOG_NORMAL, LOG_CRITICAL); @@ -688,11 +690,13 @@ if (audio_tx) { try { + audio_tx->set_running(true); thr_audio_tx = new t_thread(main_audio_tx, NULL); MEMMAN_NEW(thr_audio_tx); // thr_audio_tx->set_sched_fifo(90); thr_audio_tx->detach(); } catch (int) { + audio_tx->set_running(false); string msg("Failed to create audio_tx thread."); log_file->write_report(msg, "t_audio_session::run", LOG_NORMAL, LOG_CRITICAL); only in patch2: unchanged: --- twinkle-0.2.1.orig/src/audio/audio_rx.cpp +++ twinkle-0.2.1/src/audio/audio_rx.cpp @@ -397,6 +397,10 @@ } } +void t_audio_rx::set_running(bool _is_running) { + is_running = _is_running; +} + void t_audio_rx::run(void) { int status; audio_buf_info dsp_info; only in patch2: unchanged: --- twinkle-0.2.1.orig/src/audio/audio_rx.h +++ twinkle-0.2.1/src/audio/audio_rx.h @@ -156,6 +156,8 @@ ~t_audio_rx(); + void set_running(bool is_running); + void run(void); // Set the dynamic payload type for telephone events only in patch2: unchanged: --- twinkle-0.2.1.orig/src/audio/audio_tx.h +++ twinkle-0.2.1/src/audio/audio_tx.h @@ -148,6 +148,8 @@ ~t_audio_tx(); + void set_running(bool is_running); + void run(void); // Set the dynamic payload type for telephone events only in patch2: unchanged: --- twinkle-0.2.1.orig/src/audio/audio_tx.cpp +++ twinkle-0.2.1/src/audio/audio_tx.cpp @@ -330,6 +330,10 @@ } } +void t_audio_tx::set_running(bool _is_running) { + is_running = _is_running; +} + void t_audio_tx::run(void) { const AppDataUnit* adu; struct timespec sleeptimer;