diff --git a/coreapi/event.c b/coreapi/event.c index 372e0a953..ac2a8db3d 100644 --- a/coreapi/event.c +++ b/coreapi/event.c @@ -106,7 +106,8 @@ void linphone_event_set_publish_state(LinphoneEvent *lev, LinphonePublishState s linphone_core_notify_publish_state_changed(lev->lc,lev,state); switch(state){ case LinphonePublishCleared: - linphone_event_unref(lev); + if (lev->expires!=-1) + linphone_event_unref(lev); break; case LinphonePublishOk: case LinphonePublishError: diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index d3766c174..44d64929c 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -340,6 +340,16 @@ static MSList * create_telephone_events(LinphoneCore *lc, const MSList *codecs){ return ret; } +static MSList *create_special_payload_types(LinphoneCore *lc, const MSList *codecs){ + MSList *ret=create_telephone_events(lc, codecs); + if (linphone_core_generic_confort_noise_enabled(lc)){ + PayloadType *cn=payload_type_clone(&payload_type_cn); + payload_type_set_number(cn, 13); + ret=ms_list_append(ret, cn); + } + return ret; +} + typedef struct _CodecConstraints{ int bandwidth_limit; int max_codecs; @@ -348,7 +358,7 @@ typedef struct _CodecConstraints{ static MSList *make_codec_list(LinphoneCore *lc, CodecConstraints * hints, const MSList *codecs){ MSList *l=NULL; - MSList *tevs=NULL; + MSList *specials=NULL; const MSList *it; int nb = 0; @@ -379,8 +389,8 @@ static MSList *make_codec_list(LinphoneCore *lc, CodecConstraints * hints, const nb++; if ((hints->max_codecs > 0) && (nb >= hints->max_codecs)) break; } - tevs=create_telephone_events(lc,l); - l=ms_list_concat(l,tevs); + specials=create_special_payload_types(lc,l); + l=ms_list_concat(l,specials); linphone_core_assign_payload_type_numbers(lc, l); return l; } diff --git a/mediastreamer2 b/mediastreamer2 index adbdf050e..02d311ca6 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit adbdf050e08933859bdc424026adb24fa4b3f951 +Subproject commit 02d311ca6158ad707edadcd20121de57182e8972 diff --git a/oRTP b/oRTP index 0917823b9..753a2d67e 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 0917823b9b56cb2710da7ce22979804119adef8c +Subproject commit 753a2d67ee0e4e9a8c2f64f92b598ac11187378a diff --git a/tester/call_tester.c b/tester/call_tester.c index 50d0032f6..96b90f0e8 100644 --- a/tester/call_tester.c +++ b/tester/call_tester.c @@ -3463,6 +3463,59 @@ static void call_with_paused_no_sdp_on_resume() { } } +static void call_with_generic_cn(void) { + int begin; + int leaked_objects; + LinphoneCoreManager* marie; + LinphoneCoreManager* pauline; + LinphoneCall *pauline_call; + char *audio_file_with_silence=ms_strdup_printf("%s/%s",liblinphone_tester_file_prefix,"sounds/ahbahouaismaisbon.wav"); + char *recorded_file=ms_strdup_printf("%s/%s",liblinphone_tester_writable_dir_prefix,"result.wav"); + + belle_sip_object_enable_leak_detector(TRUE); + begin=belle_sip_object_get_object_count(); + + marie = linphone_core_manager_new( "marie_rc"); + pauline = linphone_core_manager_new( "pauline_rc"); + + remove(recorded_file); + + linphone_core_use_files(marie->lc,TRUE); + linphone_core_use_files(pauline->lc,TRUE); + linphone_core_set_play_file(marie->lc, audio_file_with_silence); + /*linphone_core_set_play_file(pauline->lc, NULL);*/ + linphone_core_set_record_file(pauline->lc, recorded_file); + linphone_core_enable_generic_confort_noise(marie->lc, TRUE); + linphone_core_enable_generic_confort_noise(pauline->lc, TRUE); + CU_ASSERT_TRUE(call(marie,pauline)); + pauline_call=linphone_core_get_current_call(pauline->lc); + CU_ASSERT_PTR_NOT_NULL(pauline_call); + if (pauline_call){ + const rtp_stats_t *rtps; + struct stat stbuf; + int err; + + wait_for_until(marie->lc, pauline->lc, NULL, 0, 8000); + rtps=rtp_session_get_stats(pauline_call->audiostream->ms.sessions.rtp_session); + CU_ASSERT_TRUE(rtps->packet_recv<=300 && rtps->packet_recv>=200); + CU_ASSERT_EQUAL((err=stat(recorded_file,&stbuf)), 0); + if (err==0){ + CU_ASSERT_TRUE(stbuf.st_size>120000); + } + } + end_call(marie,pauline); + linphone_core_manager_destroy(marie); + linphone_core_manager_destroy(pauline); + + leaked_objects=belle_sip_object_get_object_count()-begin; + CU_ASSERT_TRUE(leaked_objects==0); + if (leaked_objects>0){ + belle_sip_object_dump_active_objects(); + } + ms_free(audio_file_with_silence); + ms_free(recorded_file); +} + test_t call_tests[] = { { "Early declined call", early_declined_call }, @@ -3558,6 +3611,7 @@ test_t call_tests[] = { { "Outgoing INVITE without ACK SDP",outgoing_invite_without_sdp}, { "Incoming REINVITE without SDP",incoming_reinvite_without_ack_sdp}, { "Outgoing REINVITE without ACK SDP",outgoing_reinvite_without_ack_sdp}, + { "Call with generic CN", call_with_generic_cn } }; test_suite_t call_test_suite = {