]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
possible fix for MODENDP-140
authorAnthony Minessale <anthony.minessale@gmail.com>
Sat, 11 Oct 2008 16:28:05 +0000 (16:28 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Sat, 11 Oct 2008 16:28:05 +0000 (16:28 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9960 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_loopback/mod_loopback.c

index c40a721062a3133c6be52a733079e2d68c197152..34453bdbcd7ea42fb5cd064b24b4b85232afd4b6 100644 (file)
@@ -75,6 +75,7 @@ struct private_object {
        unsigned char cng_databuf[10];
        switch_timer_t timer;
        switch_caller_profile_t *caller_profile;
+       int32_t bowout_frame_count;
 };
 typedef struct private_object private_t;
 
@@ -163,6 +164,8 @@ static switch_status_t tech_init(private_t *tech_pvt, switch_core_session_t *ses
        switch_set_flag((&tech_pvt->cng_frame), SFF_CNG);
        tech_pvt->cng_frame.datalen = 2;
 
+       tech_pvt->bowout_frame_count = (tech_pvt->read_codec.implementation->actual_samples_per_second / 
+                                                        tech_pvt->read_codec.implementation->samples_per_frame) * 3;
 
        switch_core_session_set_read_codec(session, &tech_pvt->read_codec);
        switch_core_session_set_write_codec(session, &tech_pvt->write_codec);
@@ -560,7 +563,8 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
                switch_channel_test_flag(tech_pvt->channel, CF_BRIDGED) &&
                switch_channel_test_flag(tech_pvt->other_channel, CF_BRIDGED) &&
                switch_channel_test_flag(tech_pvt->channel, CF_ANSWERED) &&
-               switch_channel_test_flag(tech_pvt->other_channel, CF_ANSWERED) 
+               switch_channel_test_flag(tech_pvt->other_channel, CF_ANSWERED) &&
+               !--tech_pvt->bowout_frame_count <= 0
                ) {
                const char *a_uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE);
                const char *b_uuid = switch_channel_get_variable(tech_pvt->other_channel, SWITCH_SIGNAL_BOND_VARIABLE);