From 8526f23a08897794d5e871659f8a14b2bd70b9c8 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Wed, 30 Mar 2011 09:29:25 +0200 Subject: [PATCH] Custom video transport. ffmpeg shared lib on Android. --- build/android/Android.mk | 5 +++-- coreapi/linphonecall.c | 3 +++ coreapi/linphonecore.c | 6 +++++- coreapi/linphonecore.h | 2 ++ coreapi/private.h | 1 + coreapi/sal_eXosip2.c | 3 +++ 6 files changed, 17 insertions(+), 3 deletions(-) diff --git a/build/android/Android.mk b/build/android/Android.mk index 48a4c75be..4a2add8f6 100755 --- a/build/android/Android.mk +++ b/build/android/Android.mk @@ -83,11 +83,12 @@ LOCAL_STATIC_LIBRARIES := \ libgsm ifeq ($(LINPHONE_VIDEO),1) -LOCAL_STATIC_LIBRARIES += \ +LOCAL_SHARED_LIBRARIES += \ libavcodec \ libswscale \ libavcore \ - libavutil \ + libavutil +LOCAL_STATIC_LIBRARIES += \ libmsx264 \ libx264 endif diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 9a21ca65b..03f04da5b 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -663,11 +663,14 @@ void linphone_call_init_media_streams(LinphoneCall *call){ rtp_session_set_transports(audiostream->session,lc->a_rtp,lc->a_rtcp); #ifdef VIDEO_ENABLED + if ((lc->video_conf.display || lc->video_conf.capture) && md->streams[1].port>0){ call->videostream=video_stream_new(md->streams[1].port,linphone_core_ipv6_enabled(lc)); if( lc->video_conf.displaytype != NULL) video_stream_set_display_filter_name(call->videostream,lc->video_conf.displaytype); video_stream_set_event_callback(call->videostream,video_stream_event_cb, call); + if (lc->v_rtp) + rtp_session_set_transports(call->videostream->session,lc->v_rtp,lc->v_rtcp); #ifdef TEST_EXT_RENDERER video_stream_set_render_callback(call->videostream,rendercb,NULL); #endif diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 8a7140fb5..6bc2133b7 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -54,7 +54,6 @@ static void toggle_video_preview(LinphoneCore *lc, bool_t val); extern SalCallbacks linphone_sal_callbacks; - void lc_callback_obj_init(LCCallbackObj *obj,LinphoneCoreCbFunc func,void* ud) { obj->_func=func; @@ -3672,6 +3671,11 @@ void linphone_core_set_audio_transports(LinphoneCore *lc, RtpTransport *rtp, Rtp lc->a_rtcp=rtcp; } +void linphone_core_set_video_transports(LinphoneCore *lc, RtpTransport *rtp, RtpTransport *rtcp){ + lc->v_rtp=rtp; + lc->v_rtcp=rtcp; +} + /** * Retrieve RTP statistics regarding current call. * @param local RTP statistics computed locally. diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 81ab3e949..d0e13ba50 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -966,6 +966,8 @@ void linphone_core_destroy(LinphoneCore *lc); /*for advanced users:*/ void linphone_core_set_audio_transports(LinphoneCore *lc, RtpTransport *rtp, RtpTransport *rtcp); +void linphone_core_set_video_transports(LinphoneCore *lc, RtpTransport *rtp, RtpTransport *rtcp); + int linphone_core_get_current_call_stats(LinphoneCore *lc, rtp_stats_t *local, rtp_stats_t *remote); diff --git a/coreapi/private.h b/coreapi/private.h index 2c3966a3b..08c9b6aac 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -411,6 +411,7 @@ struct _LinphoneCore VideoPreview *previewstream; struct _MSEventQueue *msevq; RtpTransport *a_rtp,*a_rtcp; + RtpTransport *v_rtp,*v_rtcp; MSList *bl_reqs; MSList *subscribers; /* unknown subscribers */ int minutes_away; diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index 38638716e..8da6488d3 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -24,6 +24,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "private.h" #include "offeranswer.h" +// Necessary to make it linked +static void for_linker() { eXosip_transport_hook_register(NULL); } + static bool_t call_failure(Sal *sal, eXosip_event_t *ev); static void text_received(Sal *sal, eXosip_event_t *ev);