Merge remote-tracking branch 'linphone/master'

This commit is contained in:
Simon Morlat 2014-10-14 16:18:13 +02:00
commit dfc26d9403
12 changed files with 160 additions and 44 deletions

View file

@ -639,7 +639,7 @@ static void sal_op_fill_invite(SalOp *op, belle_sip_request_t* invite) {
belle_sip_message_add_header(BELLE_SIP_MESSAGE(invite),BELLE_SIP_HEADER(create_allow(op->base.root->enable_sip_update)));
if (op->base.root->session_expires!=0){
belle_sip_message_add_header(BELLE_SIP_MESSAGE(invite),belle_sip_header_create( "Session-expires", "200"));
belle_sip_message_add_header(BELLE_SIP_MESSAGE(invite),belle_sip_header_create( "Session-expires", "600;refresher=uas"));
belle_sip_message_add_header(BELLE_SIP_MESSAGE(invite),belle_sip_header_create( "Supported", "timer"));
}
if (op->base.local_media){
@ -766,9 +766,10 @@ int sal_call_accept(SalOp*h){
}
belle_sip_message_add_header(BELLE_SIP_MESSAGE(response),BELLE_SIP_HEADER(create_allow(h->base.root->enable_sip_update)));
if (h->base.root->session_expires!=0){
if (h->supports_session_timers) {
/* if (h->supports_session_timers) {*/
belle_sip_message_add_header(BELLE_SIP_MESSAGE(response),belle_sip_header_create("Supported", "timer"));
}
belle_sip_message_add_header(BELLE_SIP_MESSAGE(response),belle_sip_header_create( "Session-expires", "600;refresher=uac"));
/*}*/
}
if ((contact_header=sal_op_create_contact(h))) {

View file

@ -1,3 +1,22 @@
/*
linphone
Copyright (C) 2000 - 2010 Simon MORLAT (simon.morlat@linphone.org)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "private.h"
#include <mediastreamer2/fileplayer.h>
#include <mediastreamer2/mssndcard.h>
@ -12,11 +31,11 @@ static int file_player_get_current_position(LinphonePlayer *obj);
static void file_player_close(LinphonePlayer *obj);
static void file_player_eof_callback(void *user_data);
LinphonePlayer *linphone_core_create_file_player(LinphoneCore *lc, MSSndCard *snd_card, const char *video_out) {
LinphonePlayer *linphone_core_create_file_player(LinphoneCore *lc, MSSndCard *snd_card, const char *video_out, void *window_id) {
LinphonePlayer *obj = ms_new0(LinphonePlayer, 1);
if(snd_card == NULL) snd_card = lc->sound_conf.play_sndcard;
if(video_out == NULL) video_out = linphone_core_get_video_display_filter(lc);
obj->impl = ms_file_player_new(snd_card, video_out);
obj->impl = ms_file_player_new(snd_card, video_out, window_id);
obj->open = file_player_open;
obj->start = file_player_start;
obj->pause = file_player_pause;

View file

@ -793,7 +793,7 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro
call->current_params->privacy=(LinphonePrivacyMask)sal_op_get_privacy(call->op);
/*set video support */
md=sal_call_get_remote_media_description(op);
call->params->has_video = lc->video_policy.automatically_accept;
call->params->has_video = linphone_core_video_enabled(lc) && lc->video_policy.automatically_accept;
if (md) {
// It is licit to receive an INVITE without SDP
// In this case WE chose the media parameters according to policy.
@ -2176,7 +2176,7 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut
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);
linphone_call_start_audio_stream(call,cname,all_inputs_muted||call->audio_muted,send_ringbacktone,use_arc);
}
call->current_params->has_video=FALSE;
if (call->videostream!=NULL) {

View file

@ -144,7 +144,7 @@ const LinphoneAddress *linphone_core_get_current_call_remote_address(struct _Lin
}
void linphone_core_set_log_handler(OrtpLogFunc logfunc) {
ortp_set_log_handler(liblinphone_log_func);
ortp_set_log_handler(logfunc);
}
void linphone_core_set_log_file(FILE *file) {
@ -3487,8 +3487,7 @@ int linphone_core_accept_call(LinphoneCore *lc, LinphoneCall *call){
* @param params the specific parameters for this call, for example whether video is accepted or not. Use NULL to use default parameters.
*
**/
int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call, const LinphoneCallParams *params)
{
int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call, const LinphoneCallParams *params){
SalOp *replaced;
SalMediaDescription *new_md;
bool_t was_ringing=FALSE;
@ -3501,11 +3500,17 @@ int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call,
call = (LinphoneCall*)linphone_core_get_calls(lc)->data;
}
if (call->state==LinphoneCallConnected){
/*call already accepted*/
return -1;
switch(call->state){
case LinphoneCallIncomingReceived:
case LinphoneCallIncomingEarlyMedia:
break;
default:
ms_error("linphone_core_accept_call_with_params() call [%p] is in state [%s], operation not permitted.",
call, linphone_call_state_to_string(call->state));
return -1;
break;
}
/* check if this call is supposed to replace an already running one*/
replaced=sal_call_get_replaces(call->op);
if (replaced){
@ -4579,26 +4584,28 @@ bool_t linphone_core_echo_limiter_enabled(const LinphoneCore *lc){
return lc->sound_conf.ea;
}
static void linphone_core_mute_audio_stream(LinphoneCore *lc, AudioStream *st, bool_t val) {
audio_stream_set_mic_gain(st,
(val==TRUE) ? 0 : pow(10,lc->sound_conf.soft_mic_lev/10));
if ( linphone_core_get_rtp_no_xmit_on_audio_mute(lc) ){
audio_stream_mute_rtp(st,val);
}
}
void linphone_core_mute_mic(LinphoneCore *lc, bool_t val){
LinphoneCall *call=linphone_core_get_current_call(lc);
AudioStream *st=NULL;
LinphoneCall *call;
const MSList *list;
const MSList *elem;
if (linphone_core_is_in_conference(lc)){
lc->conf_ctx.local_muted=val;
st=lc->conf_ctx.local_participant;
}else if (call==NULL){
ms_warning("linphone_core_mute_mic(): No current call !");
return;
}else{
st=call->audiostream;
call->audio_muted=val;
linphone_core_mute_audio_stream(lc, lc->conf_ctx.local_participant, val);
}
if (st!=NULL){
audio_stream_set_mic_gain(st,
(val==TRUE) ? 0 : pow(10,lc->sound_conf.soft_mic_lev/10));
if ( linphone_core_get_rtp_no_xmit_on_audio_mute(lc) ){
audio_stream_mute_rtp(st,val);
}
list = linphone_core_get_calls(lc);
for (elem = list; elem != NULL; elem = elem->next) {
call = (LinphoneCall *)elem->data;
call->audio_muted = val;
linphone_core_mute_audio_stream(lc, call->audiostream, val);
}
}
@ -6836,6 +6843,7 @@ void linphone_core_remove_supported_tag(LinphoneCore *lc, const char *tag){
* The value set here is used for calls placed or received out of any proxy configured, or if the proxy config is configured with LinphoneAVPFDefault.
* @param lc the LinphoneCore
* @param mode the mode.
* @ingroup media_parameters
**/
void linphone_core_set_avpf_mode(LinphoneCore *lc, LinphoneAVPFMode mode){
if (mode==LinphoneAVPFDefault) mode=LinphoneAVPFDisabled;
@ -6847,6 +6855,7 @@ void linphone_core_set_avpf_mode(LinphoneCore *lc, LinphoneAVPFMode mode){
* Return AVPF enablement. See linphone_core_set_avpf_mode() .
* @param lc the core
* @return the avpf enablement mode.
* @ingroup media_parameters
**/
LinphoneAVPFMode linphone_core_get_avpf_mode(const LinphoneCore *lc){
return lc->rtp_conf.avpf_mode;
@ -6856,6 +6865,7 @@ LinphoneAVPFMode linphone_core_get_avpf_mode(const LinphoneCore *lc){
* Return the avpf report interval in seconds.
* @param lc the LinphoneCore
* @return the avpf report interval in seconds.
* @ingroup media_parameters
**/
int linphone_core_get_avpf_rr_interval(const LinphoneCore *lc){
return lp_config_get_int(lc->config,"rtp","avpf_rr_interval",5);
@ -6865,7 +6875,8 @@ int linphone_core_get_avpf_rr_interval(const LinphoneCore *lc){
* Set the avpf report interval in seconds.
* This value can be overriden by the proxy config using linphone_proxy_config_set_avpf_rr_interval().
* @param lc the core
* @param interval interval in seconds.
* @param interval interval in seconds.
* @ingroup media_parameters
**/
void linphone_core_set_avpf_rr_interval(LinphoneCore *lc, int interval){
lp_config_set_int(lc->config,"rtp","avpf_rr_interval",interval);

View file

@ -602,9 +602,10 @@ void linphone_player_close(LinphonePlayer *obj);
* @param lc A LinphoneCore
* @param snd_card Playback sound card. If NULL, the sound card set in LinphoneCore will be used
* @param video_out Video display. If NULL, the video display set in LinphoneCore will be used
* @param window_id Pointer on the drawing window
* @return A pointer on the new instance. NULL if faild.
*/
LINPHONE_PUBLIC LinphonePlayer *linphone_core_create_file_player(LinphoneCore *lc, MSSndCard *snd_card, const char *video_out);
LINPHONE_PUBLIC LinphonePlayer *linphone_core_create_file_player(LinphoneCore *lc, MSSndCard *snd_card, const char *video_out, void *window_id);
/**
* @brief Destroy a file player

View file

@ -28,6 +28,7 @@ extern "C" {
#include "mediastreamer2/mediastream.h"
#include "mediastreamer2/mscommon.h"
#include "mediastreamer2/dsptools.h"
#include "mediastreamer2/fileplayer.h"
}
#include "mediastreamer2/msjava.h"
#include "private.h"
@ -5294,15 +5295,18 @@ extern "C" void Java_org_linphone_core_LinphonePlayerImpl_close(JNIEnv *env, job
linphone_player_close(player);
}
extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_createPlayer(JNIEnv *env, jobject jobj, jlong ptr) {
extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_createPlayer(JNIEnv *env, jobject jobj, jlong ptr, jobject window) {
jobject window_ref = NULL;
MSSndCard *snd_card = ms_snd_card_manager_get_default_playback_card(ms_snd_card_manager_get());
if(snd_card == NULL) {
ms_error("No default playback sound card found");
return 0;
}
LinphonePlayer *player = linphone_core_create_file_player((LinphoneCore *)ptr, snd_card, "MSAndroidDisplay");
window_ref = env->NewGlobalRef(window);
LinphonePlayer *player = linphone_core_create_file_player((LinphoneCore *)ptr, snd_card, "MSAndroidDisplay", window_ref);
if(player == NULL) {
ms_error("Fails to create a player");
if(window_ref) env->DeleteGlobalRef(window_ref);
return 0;
} else {
return (jlong)player;
@ -5312,7 +5316,9 @@ extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_createPlayer(JNIEnv *en
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_destroyPlayer(JNIEnv *env, jobject jobj, jlong playerPtr) {
LinphonePlayer *player = (LinphonePlayer *)playerPtr;
if(player->user_data) {
delete (LinphonePlayerData *)player->user_data;;
delete (LinphonePlayerData *)player->user_data;
}
jobject window_id = (jobject)ms_file_player_get_window_id((MSFilePlayer *)player->impl);
if(window_id) env->DeleteGlobalRef(window_id);
linphone_file_player_destroy(player);
}

View file

@ -1786,7 +1786,7 @@ public interface LinphoneCore {
* Create a media player
* @return An object that implement LinphonePlayer
*/
public LinphonePlayer createPlayer();
public LinphonePlayer createPlayer(AndroidVideoWindowImpl window);
/**
* Destroy a player

View file

@ -25,6 +25,7 @@ import java.io.IOException;
import org.linphone.core.LinphoneCall.State;
import org.linphone.mediastream.Log;
import org.linphone.mediastream.video.AndroidVideoWindowImpl;
import org.linphone.mediastream.video.capture.hwconf.Hacks;
import android.content.Context;
@ -1279,12 +1280,12 @@ class LinphoneCoreImpl implements LinphoneCore {
return getFileTransferServer(nativePtr);
}
private native long createPlayer(long nativePtr);
private native long createPlayer(long nativePtr, AndroidVideoWindowImpl window);
@Override
public synchronized LinphonePlayer createPlayer() {
long player = createPlayer(nativePtr);
if(player != 0) {
return new LinphonePlayerImpl(createPlayer(nativePtr));
public synchronized LinphonePlayer createPlayer(AndroidVideoWindowImpl window) {
long playerPtr = createPlayer(nativePtr, window);
if(playerPtr != 0) {
return new LinphonePlayerImpl(playerPtr);
} else {
return null;
}

@ -1 +1 @@
Subproject commit 8a357b56945bc1f3675d748ee237c451d3cf470e
Subproject commit 2fa9c8e258eacadc789f87d3ea3a152faea291ea

2
oRTP

@ -1 +1 @@
Subproject commit f4ecaee9570f411ff2689e2cb348505833320616
Subproject commit 05e0242a91391747408340dffa34f9b4e1335be4

View file

@ -1,3 +1,21 @@
/*
liblinphone_tester - liblinphone test suite
Copyright (C) 2013 Belledonne Communications SARL
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "liblinphone_tester.h"
static const char *_get_default_video_renderer(void){
@ -41,7 +59,7 @@ static void play_file(const char *filename, bool_t unsupported_format) {
CU_ASSERT_PTR_NOT_NULL(lc_manager);
if(lc_manager == NULL) return;
player = linphone_core_create_file_player(lc_manager->lc, ms_snd_card_manager_get_default_card(ms_snd_card_manager_get()), _get_default_video_renderer());
player = linphone_core_create_file_player(lc_manager->lc, ms_snd_card_manager_get_default_card(ms_snd_card_manager_get()), _get_default_video_renderer(), NULL);
CU_ASSERT_PTR_NOT_NULL(player);
if(player == NULL) goto fail;

View file

@ -347,6 +347,62 @@ static void presence_information(void) {
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
#define USE_PRESENCE_SERVER 0
#if USE_PRESENCE_SERVER
static void test_subscribe_notify_publish(void) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
LinphoneProxyConfig* proxy;
LinphonePresenceModel* presence;
LpConfig *pauline_lp = linphone_core_get_config(pauline->lc);
char* lf_identity=linphone_address_as_string_uri_only(marie->identity);
LinphoneFriend *lf = linphone_core_create_friend_with_address(pauline->lc,lf_identity);
lp_config_set_int(pauline_lp,"sip","subscribe_expires",5);
linphone_core_add_friend(pauline->lc,lf);
/*wait for subscribe acknowledgment*/
wait_for_until(pauline->lc,marie->lc,&pauline->stat.number_of_NotifyReceived,1,2000);
CU_ASSERT_EQUAL(LinphoneStatusOffline,linphone_friend_get_status(lf));
/*enable publish*/
linphone_core_get_default_proxy(marie->lc,&proxy);
linphone_proxy_config_edit(proxy);
linphone_proxy_config_enable_publish(proxy,TRUE);
linphone_proxy_config_set_publish_expires(proxy,3);
linphone_proxy_config_done(proxy);
/*wait for marie status*/
wait_for_until(pauline->lc,marie->lc,&pauline->stat.number_of_NotifyReceived,2,2000);
CU_ASSERT_EQUAL(LinphoneStatusOnline,linphone_friend_get_status(lf));
presence =linphone_presence_model_new_with_activity(LinphonePresenceActivityOffline,NULL);
linphone_core_set_presence_model(marie->lc,presence);
/*wait for new status*/
wait_for_until(pauline->lc,marie->lc,&pauline->stat.number_of_NotifyReceived,3,2000);
CU_ASSERT_EQUAL(LinphonePresenceActivityOffline,linphone_friend_get_status(lf));
/*wait for refresh*/
wait_for_until(pauline->lc,marie->lc,&pauline->stat.number_of_NotifyReceived,4,5000);
CU_ASSERT_EQUAL(LinphonePresenceActivityOffline,linphone_friend_get_status(lf));
//linphone_core_remove_friend(pauline->lc,lf);
/*wait for final notify*/
//wait_for_until(pauline->lc,marie->lc,&pauline->stat.number_of_NotifyReceived,4,5000);
//CU_ASSERT_EQUAL(LinphonePresenceActivityOffline,linphone_friend_get_status(lf));
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
#endif
test_t presence_tests[] = {
{ "Simple Subscribe", simple_subscribe },
@ -356,6 +412,9 @@ test_t presence_tests[] = {
{ "Unsubscribe while subscribing", unsubscribe_while_subscribing },
{ "Presence information", presence_information },
{ "App managed presence failure", subscribe_failure_handle_by_app },
#if USE_PRESENCE_SERVER
{ "Subscribe with late publish", test_subscribe_notify_publish },
#endif
};
test_suite_t presence_test_suite = {