From 5dea3b42f09c3eb3b023a55a844c475576906bd6 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 9 Sep 2013 17:51:29 +0200 Subject: [PATCH] avoid crashing when no soundcard is present. update ms2 --- coreapi/bellesip_sal/sal_op_publish.c | 4 ++-- coreapi/linphonecore.c | 16 ++++++++++------ mediastreamer2 | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/coreapi/bellesip_sal/sal_op_publish.c b/coreapi/bellesip_sal/sal_op_publish.c index 9f23b849d..ec4ecc324 100644 --- a/coreapi/bellesip_sal/sal_op_publish.c +++ b/coreapi/bellesip_sal/sal_op_publish.c @@ -68,14 +68,14 @@ int sal_publish(SalOp *op, const char *from, const char *to, const char *eventna op->type=SalOpPublish; req=sal_op_build_request(op,"PUBLISH"); belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),belle_sip_header_create("Event",eventname)); - if (body) sal_op_add_body(op,BELLE_SIP_MESSAGE(req),body); + sal_op_add_body(op,BELLE_SIP_MESSAGE(req),body); return sal_op_send_and_create_refresher(op,req,expires,publish_refresher_listener); } else { /*update status*/ const belle_sip_client_transaction_t* last_publish_trans=belle_sip_refresher_get_transaction(op->refresher); belle_sip_request_t* last_publish=belle_sip_transaction_get_request(BELLE_SIP_TRANSACTION(last_publish_trans)); /*update body*/ - if (body) sal_op_add_body(op,BELLE_SIP_MESSAGE(last_publish),body); + sal_op_add_body(op,BELLE_SIP_MESSAGE(last_publish),body); return belle_sip_refresher_refresh(op->refresher,BELLE_SIP_REFRESHER_REUSE_EXPIRES); } } diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 3ba4a5d54..4c501c6fa 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2487,11 +2487,13 @@ int linphone_core_start_invite(LinphoneCore *lc, LinphoneCall *call){ linphone_call_make_local_media_description(lc,call); if (lc->ringstream==NULL) { - /*give a chance a set card prefered sampling frequency*/ - if (call->localdesc->streams[0].max_rate>0) { - ms_snd_card_set_preferred_sample_rate(lc->sound_conf.play_sndcard, call->localdesc->streams[0].max_rate); + if (lc->sound_conf.play_sndcard && lc->sound_conf.capt_sndcard){ + /*give a chance a set card prefered sampling frequency*/ + if (call->localdesc->streams[0].max_rate>0) { + ms_snd_card_set_preferred_sample_rate(lc->sound_conf.play_sndcard, call->localdesc->streams[0].max_rate); + } + audio_stream_prepare_sound(call->audiostream,lc->sound_conf.play_sndcard,lc->sound_conf.capt_sndcard); } - audio_stream_prepare_sound(call->audiostream,lc->sound_conf.play_sndcard,lc->sound_conf.capt_sndcard); } if (!lc->sip_conf.sdp_200_ack){ @@ -3241,8 +3243,10 @@ int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call, /*give a chance a set card prefered sampling frequency*/ if (call->localdesc->streams[0].max_rate>0) { ms_message ("configuring prefered card sampling rate to [%i]",call->localdesc->streams[0].max_rate); - ms_snd_card_set_preferred_sample_rate(lc->sound_conf.play_sndcard, call->localdesc->streams[0].max_rate); - ms_snd_card_set_preferred_sample_rate(lc->sound_conf.capt_sndcard, call->localdesc->streams[0].max_rate); + if (lc->sound_conf.play_sndcard) + ms_snd_card_set_preferred_sample_rate(lc->sound_conf.play_sndcard, call->localdesc->streams[0].max_rate); + if (lc->sound_conf.capt_sndcard) + ms_snd_card_set_preferred_sample_rate(lc->sound_conf.capt_sndcard, call->localdesc->streams[0].max_rate); } if (!was_ringing && call->audiostream->ms.ticker==NULL){ diff --git a/mediastreamer2 b/mediastreamer2 index c516f225b..ec2d04150 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit c516f225bea6ac2132f3468235138e2dde6cfcda +Subproject commit ec2d04150521197905bf5812991b54bab97fbdf8