diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 4380ecbeb..261a8d763 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1885,6 +1885,7 @@ static RtpProfile *make_profile(LinphoneCall *call, const SalMediaDescription *m const LinphoneCallParams *params=&call->params; *used_pt=-1; + if (desc->type==SalAudio) bw=get_ideal_audio_bw(call,md,desc); else if (desc->type==SalVideo) @@ -1911,6 +1912,7 @@ static RtpProfile *make_profile(LinphoneCall *call, const SalMediaDescription *m first=FALSE; } if (pt->flags & PAYLOAD_TYPE_BITRATE_OVERRIDE){ + ms_message("Payload type [%s/%i] has explicit bitrate [%i] kbit/s", pt->mime_type, pt->clock_rate, pt->normal_bitrate/1000); pt->normal_bitrate=get_min_bandwidth(pt->normal_bitrate,bw*1000); } else pt->normal_bitrate=bw*1000; if (desc->ptime>0){ @@ -2227,11 +2229,15 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut use_arc=FALSE; } #endif + ms_message("linphone_call_start_media_streams() call=[%p] local upload_bandwidth=[%i] kbit/s; local download_bandwidth=[%i] kbit/s", + call, linphone_core_get_upload_bandwidth(lc),linphone_core_get_download_bandwidth(lc)); + if (call->audiostream!=NULL) { linphone_call_start_audio_stream(call,cname,all_inputs_muted,send_ringbacktone,use_arc); } call->current_params.has_video=FALSE; if (call->videostream!=NULL) { + if (call->audiostream) audio_stream_link_video(call->audiostream,call->videostream); linphone_call_start_video_stream(call,cname,all_inputs_muted); } @@ -2352,7 +2358,7 @@ static void linphone_call_log_fill_stats(LinphoneCallLog *log, MediaStream *st){ } } -void linphone_call_stop_audio_stream(LinphoneCall *call) { +static void linphone_call_stop_audio_stream(LinphoneCall *call) { if (call->audiostream!=NULL) { linphone_reporting_update_media_info(call, LINPHONE_CALL_STATS_AUDIO); media_stream_reclaim_sessions(&call->audiostream->ms,&call->sessions[0]); @@ -2380,7 +2386,7 @@ void linphone_call_stop_audio_stream(LinphoneCall *call) { } } -void linphone_call_stop_video_stream(LinphoneCall *call) { +static void linphone_call_stop_video_stream(LinphoneCall *call) { #ifdef VIDEO_ENABLED if (call->videostream!=NULL){ linphone_reporting_update_media_info(call, LINPHONE_CALL_STATS_VIDEO); @@ -2404,6 +2410,8 @@ static void unset_rtp_profile(LinphoneCall *call, int i){ void linphone_call_stop_media_streams(LinphoneCall *call){ if (call->audiostream || call->videostream) { + if (call->audiostream && call->videostream) + audio_stream_unlink_video(call->audiostream, call->videostream); linphone_call_stop_audio_stream(call); linphone_call_stop_video_stream(call); diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 0b49be7cc..7380ebb80 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -5939,7 +5939,7 @@ static void linphone_core_uninit(LinphoneCore *lc) linphone_presence_model_unref(lc->presence_model); } linphone_core_free_payload_types(lc); - + if (lc->supported_formats) ms_free(lc->supported_formats); linphone_core_message_storage_close(lc); ms_exit(); linphone_core_set_state(lc,LinphoneGlobalOff,"Off"); diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index a4e91e2c3..9da626732 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -2612,6 +2612,14 @@ LINPHONE_PUBLIC void linphone_core_set_tone(LinphoneCore *lc, LinphoneToneID id, * */ LINPHONE_PUBLIC void linphone_core_set_file_transfer_server(LinphoneCore *core, const char * server_url); +/** + * Returns a null terminated table of strings containing the file format extension supported for call recording. + * @param core the core + * @return the supported formats, typically 'wav' and 'mkv' + * @ingroup media_parameters +**/ +LINPHONE_PUBLIC const char ** linphone_core_get_supported_file_formats(LinphoneCore *core); + #ifdef __cplusplus } #endif diff --git a/coreapi/misc.c b/coreapi/misc.c index 43b3a3139..0cc6a3ac9 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -1522,3 +1522,18 @@ const MSCryptoSuite * linphone_core_get_srtp_crypto_suites(LinphoneCore *lc){ lc->rtp_conf.srtp_suites=result; return result; } + + + +const char ** linphone_core_get_supported_file_formats(LinphoneCore *core){ + static const char *mkv="mkv"; + static const char *wav="wav"; + if (core->supported_formats==NULL){ + core->supported_formats=ms_malloc0(3*sizeof(char*)); + core->supported_formats[0]=wav; + if (ms_factory_lookup_filter_by_id(ms_factory_get_fallback(),MS_MKV_RECORDER_ID)){ + core->supported_formats[1]=mkv; + } + } + return core->supported_formats; +} diff --git a/coreapi/private.h b/coreapi/private.h index 690498c98..79537e742 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -375,8 +375,6 @@ void linphone_call_init_video_stream(LinphoneCall *call); void linphone_call_init_media_streams(LinphoneCall *call); void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_muted, bool_t send_ringbacktone); void linphone_call_start_media_streams_for_ice_gathering(LinphoneCall *call); -void linphone_call_stop_audio_stream(LinphoneCall *call); -void linphone_call_stop_video_stream(LinphoneCall *call); void linphone_call_stop_media_streams(LinphoneCall *call); void linphone_call_delete_ice_session(LinphoneCall *call); void linphone_call_delete_upnp_session(LinphoneCall *call); @@ -727,6 +725,7 @@ struct _LinphoneCore MSList *tones; LinphoneReason chat_deny_code; char *file_transfer_server; + const char **supported_formats; }; diff --git a/gtk/main.c b/gtk/main.c index 4dd4f1a1f..a08681dde 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -983,6 +983,9 @@ gchar *linphone_gtk_get_record_path(const LinphoneAddress *address, gboolean is_ char date[64]={0}; time_t curtime=time(NULL); struct tm loctime; + const char **fmts=linphone_core_get_supported_file_formats(linphone_gtk_get_core()); + int i; + const char *ext="wav"; #ifdef WIN32 loctime=*localtime(&curtime); @@ -991,19 +994,26 @@ gchar *linphone_gtk_get_record_path(const LinphoneAddress *address, gboolean is_ #endif snprintf(date,sizeof(date)-1,"%i%02i%02i-%02i%02i",loctime.tm_year+1900,loctime.tm_mon+1,loctime.tm_mday, loctime.tm_hour, loctime.tm_min); + for (i=0;fmts[i]!=NULL;++i){ + if (strcmp(fmts[i],"mkv")==0){ + ext="mkv"; + break; + } + } + if (address){ id=linphone_address_get_username(address); if (id==NULL) id=linphone_address_get_domain(address); } if (is_conference){ - snprintf(filename,sizeof(filename)-1,"%s-conference-%s.wav", + snprintf(filename,sizeof(filename)-1,"%s-conference-%s.%s", linphone_gtk_get_ui_config("title","Linphone"), - date); + date,ext); }else{ - snprintf(filename,sizeof(filename)-1,"%s-call-%s-%s.wav", + snprintf(filename,sizeof(filename)-1,"%s-call-%s-%s.%s", linphone_gtk_get_ui_config("title","Linphone"), date, - id); + id,ext); } if (!dir) { ms_message ("No directory for music, using [%s] instead",dir=getenv("HOME")); diff --git a/mediastreamer2 b/mediastreamer2 index 84ce0753e..5313bf3a5 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 84ce0753edfae002c0f5bcff17f80f6f9c285f14 +Subproject commit 5313bf3a57474411efce3b8f60a8c7190554a619