]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
media_bug: Fix for rare race condition. More work required to make media bug safe.
authorMarc Olivier Chouinard <mochouinard@moctel.com>
Sun, 27 Mar 2011 04:34:07 +0000 (00:34 -0400)
committerMarc Olivier Chouinard <mochouinard@moctel.com>
Sun, 27 Mar 2011 04:34:07 +0000 (00:34 -0400)
src/switch_core_io.c

index 14cec65808828451d02218c626ed00124e3ff4f7..31c8d5fb25d507d90d06b6a39967f2000621a3c8 100644 (file)
@@ -346,13 +346,16 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
                                        memset(session->raw_read_frame.data, 255, session->raw_read_frame.datalen);
                                        status = SWITCH_STATUS_SUCCESS;
                                } else {
-                                       status = switch_core_codec_decode(use_codec,
+                                       switch_thread_rwlock_rdlock(session->bug_rwlock);
+                                       status = switch_core_codec_decode(use_codec->implementation?use_codec:read_frame->codec,
                                                                                                          session->read_codec,
                                                                                                          read_frame->data,
                                                                                                          read_frame->datalen,
                                                                                                          session->read_impl.actual_samples_per_second,
                                                                                                          session->raw_read_frame.data, &session->raw_read_frame.datalen, &session->raw_read_frame.rate, 
                                                                                                          &read_frame->flags);
+                                       switch_thread_rwlock_unlock(session->bug_rwlock);
+
                                }
                                
                                if (status == SWITCH_STATUS_SUCCESS) {