via: 1341a75ad899d35f9003e4514cb5c8f724e0e7da (commit)
from: 04bb74fcaeb72683754ed4b4d6df197a898887b7 (commit)
= COMMIT LOG ===========================================================
committer: Anthony Minessale
comments:
fix race with media bug exiting from write frame while read frame is trying to use it
diff --git a/src/switch_core_io.c b/src/switch_core_io.c
index decb587..4e1c707 100644
--- a/src/switch_core_io.c
+++ b/src/switch_core_io.c
@@ -318,11 +318,24 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
switch_codec_t *use_codec = read_frame->codec;
if (do_bugs) {
switch_thread_rwlock_wrlock(session->bug_rwlock);
+ if (!session->bugs) {
+ do_bugs = 0;
+ switch_thread_rwlock_unlock(session->bug_rwlock);
+ goto done;
+ }
+
if (!switch_core_codec_ready(&session->bug_codec)) {
switch_core_codec_copy(read_frame->codec, &session->bug_codec, NULL);
}
use_codec = &session->bug_codec;
switch_thread_rwlock_unlock(session->bug_rwlock);
+
+ switch_thread_rwlock_wrlock(session->bug_rwlock);
+ if (!session->bugs) {
+ do_bugs = 0;
+ }
+ switch_thread_rwlock_unlock(session->bug_rwlock);
+ if (!do_bugs) goto done;
}
if (switch_test_flag(read_frame, SFF_PLC)) {
Summary of changes: src/switch_core_io.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-)
this email was generated because of /git/your-repo.git/hooks/post-receive by the file /git-core/contrib/hooks/post-receive-email
For more info, see http://blog.chomperstomp.com/?p=630
--
FreeSWITCH Source