]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-3829 --resolve
authorAnthony Minessale <anthm@freeswitch.org>
Fri, 20 Jan 2012 19:30:53 +0000 (13:30 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Fri, 20 Jan 2012 19:30:53 +0000 (13:30 -0600)
src/switch_core_codec.c
src/switch_core_io.c

index 6b78ed66f95ec44d2a9d674aaf40c8508e4ce8ac..fd3c5e37f4909e662613a39bbe7f59f3391a6bc8 100644 (file)
@@ -119,9 +119,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_real_read_codec(switch_c
                        }
                } else { /* replace real_read_codec */
                        switch_codec_t *cur_codec;
-                       if (session->real_read_codec == session->read_codec) {
-                               goto end;
-                       }
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Original read codec replaced with %s:%d\n",
                                                          switch_channel_get_name(session->channel), codec->implementation->iananame, codec->implementation->ianacode);
                        /* Set real_read_codec to front of the list of read_codecs */
@@ -145,6 +142,15 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_real_read_codec(switch_c
                                }
                        }
                }
+
+               /* force media bugs to copy the read codec from the next frame */
+               switch_thread_rwlock_wrlock(session->bug_rwlock);
+               if (switch_core_codec_ready(&session->bug_codec)) {
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Destroying BUG Codec %s:%d\n",
+                               session->bug_codec.implementation->iananame, session->bug_codec.implementation->ianacode);
+                       switch_core_codec_destroy(&session->bug_codec);
+               }
+               switch_thread_rwlock_unlock(session->bug_rwlock);
        } else {
                status = SWITCH_STATUS_FALSE;
                goto end;
index 6be402824e0c431f5dff44c5f50ce214ba92ff22..c55b89186424c3093325ce0f13ccc0e02e13a2ce 100644 (file)
@@ -337,6 +337,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
                                        }
 
                                        if (!switch_core_codec_ready(&session->bug_codec)) {
+                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Setting BUG Codec %s:%d\n",
+                                                       read_frame->codec->implementation->iananame, read_frame->codec->implementation->ianacode);
                                                switch_core_codec_copy(read_frame->codec, &session->bug_codec, NULL);
                                        }
                                        use_codec = &session->bug_codec;