FSCORE-349 add flag to denote if a codec is init or not

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12961 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale committed 2009-04-09 17:17:12 +00:00
1 parent 2840f826f0
commit 68b0359cfb
25 files changed
+90 -78

No files matched your search

+7 -6
View File
@@ -379,11 +379,11 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
sofia_clear_flag(tech_pvt, TFLAG_IO);
if (tech_pvt->read_codec.implementation) {
if (switch_core_codec_ready(&tech_pvt->read_codec)) {
switch_core_codec_destroy(&tech_pvt->read_codec);
}
if (tech_pvt->write_codec.implementation) {
if (switch_core_codec_ready(&tech_pvt->write_codec)) {
switch_core_codec_destroy(&tech_pvt->write_codec);
}
@@ -665,7 +665,8 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f
tech_pvt->read_frame.datalen = 0;
sofia_set_flag_locked(tech_pvt, TFLAG_READING);
if (sofia_test_flag(tech_pvt, TFLAG_HUP) || sofia_test_flag(tech_pvt, TFLAG_BYE) || !tech_pvt->read_codec.implementation) {
if (sofia_test_flag(tech_pvt, TFLAG_HUP) || sofia_test_flag(tech_pvt, TFLAG_BYE) || !tech_pvt->read_codec.implementation ||
!switch_core_codec_ready(&tech_pvt->read_codec)) {
return SWITCH_STATUS_FALSE;
}
@@ -711,7 +712,7 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f
int frames = 1;
if (!switch_test_flag((&tech_pvt->read_frame), SFF_CNG)) {
if (!tech_pvt->read_codec.implementation) {
if (!tech_pvt->read_codec.implementation || !switch_core_codec_ready(&tech_pvt->read_codec)) {
*frame = NULL;
return SWITCH_STATUS_GENERR;
}
@@ -872,7 +873,7 @@ static switch_status_t sofia_write_frame(switch_core_session_t *session, switch_
}
}
if (!tech_pvt->read_codec.implementation) {
if (!tech_pvt->read_codec.implementation || !switch_core_codec_ready(&tech_pvt->read_codec)) {
return SWITCH_STATUS_GENERR;
}
@@ -888,7 +889,7 @@ static switch_status_t sofia_write_frame(switch_core_session_t *session, switch_
return SWITCH_STATUS_SUCCESS;
}
if (sofia_test_flag(tech_pvt, TFLAG_BYE) || !tech_pvt->read_codec.implementation) {
if (sofia_test_flag(tech_pvt, TFLAG_BYE) || !tech_pvt->read_codec.implementation || !switch_core_codec_ready(&tech_pvt->read_codec)) {
return SWITCH_STATUS_FALSE;
}
+3 -3
View File
@@ -1752,7 +1752,7 @@ void sofia_glue_deactivate_rtp(private_object_t *tech_pvt)
switch_status_t sofia_glue_tech_set_video_codec(private_object_t *tech_pvt, int force)
{
if (tech_pvt->video_read_codec.implementation) {
if (tech_pvt->video_read_codec.implementation && switch_core_codec_ready(&tech_pvt->video_read_codec)) {
if (!force) {
return SWITCH_STATUS_SUCCESS;
}
@@ -1825,7 +1825,7 @@ switch_status_t sofia_glue_tech_set_codec(private_object_t *tech_pvt, int force)
switch_goto_status(SWITCH_STATUS_FALSE, end);
}
if (tech_pvt->read_codec.implementation) {
if (tech_pvt->read_codec.implementation && switch_core_codec_ready(&tech_pvt->read_codec)) {
if (!force) {
switch_goto_status(SWITCH_STATUS_SUCCESS, end);
}
@@ -1885,7 +1885,7 @@ switch_status_t sofia_glue_tech_set_codec(private_object_t *tech_pvt, int force)
tech_pvt->read_frame.rate = tech_pvt->rm_rate;
ms = tech_pvt->write_codec.implementation->microseconds_per_packet / 1000;
if (!tech_pvt->read_codec.implementation) {
if (!switch_core_codec_ready(&tech_pvt->read_codec)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
switch_goto_status(SWITCH_STATUS_FALSE, end);
}