[Freeswitch-svn] [commit] r1825 - freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip
Freeswitch SVN
stkn at freeswitch.org
Mon Jul 10 21:02:17 EDT 2006
Author: stkn
Date: Mon Jul 10 21:02:17 2006
New Revision: 1825
Modified:
freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip/mod_pjsip.c
freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip/mod_pjsip.h
freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip/mod_pjsip_sdp.c
Log:
Partially revert mod_pjsip codec handling changes, we might want to traverse the list of implementations for a codec (e.g. renegotiation) in call_on_media_update()
Modified: freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip/mod_pjsip.c
==============================================================================
--- freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip/mod_pjsip.c (original)
+++ freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip/mod_pjsip.c Mon Jul 10 21:02:17 2006
@@ -864,7 +864,7 @@
struct pjsip_tech_pvt *pvt;
const pjmedia_sdp_session *remote_sdp, *local_sdp;
pj_pool_t *pool;
- const switch_codec_implementation_t *imp;
+ const switch_codec_implementation_t *codec, *imp;
switch_channel_t *channel;
switch_core_session_t *session;
switch_status_t ret;
@@ -935,7 +935,7 @@
}
/* retrieve stream (= codec) information */
- status = mod_pjsip_codec_from_sdp( pvt, pool, local_sdp, remote_sdp, 0, &imp );
+ status = mod_pjsip_codec_from_sdp( pvt, pool, local_sdp, remote_sdp, 0, &codec, &imp );
if( status != PJ_SUCCESS ) {
/* No valid codec found */
switch_log_printf( SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SDP negotation failed, codec unknown\n" );
@@ -949,10 +949,10 @@
rate = imp->bits_per_second / 8;
ms = imp->microseconds_per_frame / 1000;
- switch_log_printf( SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Codec %s, rate: %d, ms per frame: %d\n", imp->iananame, rate, ms );
+ switch_log_printf( SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Codec %s, rate: %d, ms per frame: %d\n", codec->iananame, rate, ms );
/* initialize codecs */
- ret = switch_core_codec_init(&pvt->read_codec, imp->iananame, rate, ms, 1,
+ ret = switch_core_codec_init(&pvt->read_codec, codec->iananame, rate, ms, 1,
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
NULL, switch_core_session_get_pool( session ));
@@ -962,7 +962,7 @@
return;
}
- ret = switch_core_codec_init(&pvt->write_codec, imp->iananame, rate, ms, 1,
+ ret = switch_core_codec_init(&pvt->write_codec, codec->iananame, rate, ms, 1,
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
NULL, switch_core_session_get_pool( session ));
@@ -991,7 +991,7 @@
strncpy( pvt->remote_sdp_audio_addr, pj_inet_ntoa( tmp_addr ),
sizeof(pvt->remote_sdp_audio_addr) );
}
- switch_log_printf( SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Codec %s, %s:%d\n", imp->iananame, pvt->remote_sdp_audio_addr, pvt->remote_sdp_audio_port );
+ switch_log_printf( SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Codec %s, %s:%d\n", codec->iananame, pvt->remote_sdp_audio_addr, pvt->remote_sdp_audio_port );
/* start rtp */
start_rtp( pvt );
Modified: freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip/mod_pjsip.h
==============================================================================
--- freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip/mod_pjsip.h (original)
+++ freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip/mod_pjsip.h Mon Jul 10 21:02:17 2006
@@ -42,7 +42,8 @@
const pjmedia_sdp_session *local,
const pjmedia_sdp_session *remote,
const unsigned int stream_idx,
- const switch_codec_implementation_t **codec_imp );
+ const switch_codec_implementation_t **codec,
+ const switch_codec_implementation_t **imp );
/*
* Get address from sdp
Modified: freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip/mod_pjsip_sdp.c
==============================================================================
--- freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip/mod_pjsip_sdp.c (original)
+++ freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip/mod_pjsip_sdp.c Mon Jul 10 21:02:17 2006
@@ -46,13 +46,15 @@
struct pjsip_tech_pvt *pvt,
unsigned int pt,
unsigned int clock_rate,
- const switch_codec_implementation_t **codec_imp )
+ const switch_codec_implementation_t **codec,
+ const switch_codec_implementation_t **imp )
{
const switch_codec_implementation_t *tmp_imp;
int i;
+ assert( codec != NULL );
assert( pvt != NULL );
- assert( codec_imp != NULL );
+ assert( imp != NULL );
tmp_imp = NULL;
for( i = 0; i < pvt->num_codecs; i++ ) {
@@ -62,7 +64,8 @@
while( tmp_imp != NULL ) {
if ( tmp_imp->samples_per_second == clock_rate ) {
- *codec_imp = tmp_imp;
+ *codec = pvt->codecs[i];
+ *imp = tmp_imp;
return PJ_SUCCESS;
}
@@ -80,7 +83,8 @@
const pjmedia_sdp_session *local,
const pjmedia_sdp_session *remote,
const unsigned int stream_idx,
- const switch_codec_implementation_t **codec_imp )
+ const switch_codec_implementation_t **codec,
+ const switch_codec_implementation_t **imp )
{
const pjmedia_sdp_attr *attr;
const pjmedia_sdp_media *local_m;
@@ -93,7 +97,8 @@
assert( pool != NULL );
assert( local != NULL );
assert( remote != NULL );
- assert( codec_imp != NULL );
+ assert( codec != NULL );
+ assert( imp != NULL );
assert( stream_idx < local->media_count );
assert( stream_idx < remote->media_count );
@@ -134,14 +139,14 @@
/* Build codec format info: */
if (has_rtpmap) {
- status = find_codec( pvt, pt, rtpmap->clock_rate, codec_imp );
+ status = find_codec( pvt, pt, rtpmap->clock_rate, codec, imp );
if( status != PJ_SUCCESS )
return PJ_ENOTFOUND;
} else {
/*
* No rtpmap, use default clock_rate (8000 Hz)
*/
- status = find_codec( pvt, pt, 8000, codec_imp );
+ status = find_codec( pvt, pt, 8000, codec, imp );
if( status != PJ_SUCCESS )
return PJ_ENOTFOUND;
}
More information about the Freeswitch-svn
mailing list