Commit 101adaea authored by Ronan's avatar Ronan

feat(coreapi/linphonecore): provide a `linphone_core_preview_ogl_render` function

parent 05a9cf12
......@@ -4326,7 +4326,7 @@ float linphone_call_stats_get_sender_loss_rate(const LinphoneCallStats *stats) {
/* Perform msgpullup() to prevent crashes in rtcp_is_SR() or rtcp_is_RR() if the RTCP packet is composed of several mblk_t structure */
if (stats->sent_rtcp->b_cont != NULL)
msgpullup(stats->sent_rtcp, -1);
do{
if (rtcp_is_SR(stats->sent_rtcp))
srb = rtcp_SR_get_report_block(stats->sent_rtcp, 0);
......@@ -4348,7 +4348,7 @@ float linphone_call_stats_get_receiver_loss_rate(const LinphoneCallStats *stats)
/* Perform msgpullup() to prevent crashes in rtcp_is_SR() or rtcp_is_RR() if the RTCP packet is composed of several mblk_t structure */
if (stats->received_rtcp->b_cont != NULL)
msgpullup(stats->received_rtcp, -1);
do{
if (rtcp_is_RR(stats->received_rtcp))
rrb = rtcp_RR_get_report_block(stats->received_rtcp, 0);
......@@ -4372,7 +4372,7 @@ float linphone_call_stats_get_local_late_rate(const LinphoneCallStats *stats) {
float linphone_call_stats_get_sender_interarrival_jitter(const LinphoneCallStats *stats) {
const report_block_t *srb = NULL;
if (!stats || !stats->sent_rtcp)
return 0.0;
/* Perform msgpullup() to prevent crashes in rtcp_is_SR() or rtcp_is_RR() if the RTCP packet is composed of several mblk_t structure */
......@@ -4474,14 +4474,14 @@ static void report_bandwidth_for_stream(LinphoneCall *call, MediaStream *ms, Lin
} else {
return;
}
stats->download_bandwidth=(active) ? (float)(media_stream_get_down_bw(ms)*1e-3) : 0.f;
stats->upload_bandwidth=(active) ? (float)(media_stream_get_up_bw(ms)*1e-3) : 0.f;
stats->rtcp_download_bandwidth=(active) ? (float)(media_stream_get_rtcp_down_bw(ms)*1e-3) : 0.f;
stats->rtcp_upload_bandwidth=(active) ? (float)(media_stream_get_rtcp_up_bw(ms)*1e-3) : 0.f;
stats->rtp_remote_family=(active)
? (ortp_stream_is_ipv6(&ms->sessions.rtp_session->rtp.gs) ? LinphoneAddressFamilyInet6 : LinphoneAddressFamilyInet) : LinphoneAddressFamilyUnspec;
if (call->core->send_call_stats_periodical_updates){
if (active) update_local_stats(stats, ms);
stats->updated |= LINPHONE_CALL_STATS_PERIODICAL_UPDATE;
......@@ -4815,7 +4815,7 @@ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapse
void linphone_call_log_completed(LinphoneCall *call){
LinphoneCore *lc=call->core;
call->log->duration= _linphone_call_compute_duration(call); /*store duration since connected*/
call->log->error_info = linphone_error_info_ref((LinphoneErrorInfo*)linphone_call_get_error_info(call));
......@@ -4938,7 +4938,7 @@ LinphonePlayer *linphone_call_get_player(LinphoneCall *call){
return call->player;
}
void linphone_call_set_params(LinphoneCall *call, const LinphoneCallParams *params){
if ( call->state == LinphoneCallOutgoingInit || call->state == LinphoneCallIncomingReceived){
_linphone_call_set_new_params(call, params);
......@@ -4948,7 +4948,7 @@ void linphone_call_set_params(LinphoneCall *call, const LinphoneCallParams *para
}
}
void _linphone_call_set_new_params(LinphoneCall *call, const LinphoneCallParams *params){
LinphoneCallParams *cp=NULL;
if (params) cp=linphone_call_params_copy(params);
......@@ -5262,11 +5262,11 @@ LinphoneStatus linphone_call_terminate(LinphoneCall *call) {
return linphone_call_terminate_with_error_info(call, NULL);
}
LinphoneStatus linphone_call_terminate_with_error_info(LinphoneCall *call , const LinphoneErrorInfo *ei){
SalErrorInfo sei={0};
LinphoneErrorInfo* p_ei = (LinphoneErrorInfo*) ei;
ms_message("Terminate call [%p] which is currently in state %s", call, linphone_call_state_to_string(call->state));
switch (call->state) {
case LinphoneCallReleased:
......@@ -5283,7 +5283,7 @@ LinphoneStatus linphone_call_terminate_with_error_info(LinphoneCall *call , cons
call->op = NULL;
break;
default:
if (ei == NULL){
sal_call_terminate(call->op);
}
......@@ -5297,7 +5297,7 @@ LinphoneStatus linphone_call_terminate_with_error_info(LinphoneCall *call , cons
terminate_call(call);
return 0;
}
LinphoneStatus linphone_call_redirect(LinphoneCall *call, const char *redirect_uri) {
......@@ -5339,14 +5339,14 @@ LinphoneStatus linphone_call_decline(LinphoneCall * call, LinphoneReason reason)
linphone_error_info_unref(ei);
return status;
}
LinphoneStatus linphone_call_decline_with_error_info(LinphoneCall * call, const LinphoneErrorInfo *ei) {
SalErrorInfo sei = {0};
SalErrorInfo sub_sei = {0};
sei.sub_sei = &sub_sei;
if ((call->state != LinphoneCallIncomingReceived) && (call->state != LinphoneCallIncomingEarlyMedia)) {
ms_error("Cannot decline a call that is in state %s", linphone_call_state_to_string(call->state));
return -1;
......@@ -5653,12 +5653,12 @@ LinphoneStatus linphone_call_defer_update(LinphoneCall *call) {
ms_error("linphone_call_defer_update() not done in state LinphoneCallUpdatedByRemote");
return -1;
}
if (call->expect_media_in_ack) {
ms_error("linphone_call_defer_update() is not possible during a late offer incoming reINVITE (INVITE without SDP)");
return -1;
}
call->defer_update=TRUE;
return 0;
}
......@@ -5869,7 +5869,7 @@ int linphone_call_start_invite(LinphoneCall *call, const LinphoneAddress *destin
linphone_call_ref(call); /* Take a ref because sal_call() may destroy the call if no SIP transport is available */
err = sal_call(call->op, from, real_url);
if (err < 0) {
if ((call->state != LinphoneCallError) && (call->state != LinphoneCallReleased)) {
/* sal_call() may invoke call_failure() and call_released() SAL callbacks synchronously,
......@@ -6064,20 +6064,14 @@ void linphone_call_replace_op(LinphoneCall *call, SalOp *op) {
sal_op_release(oldop);
}
void linphone_call_ogl_render(LinphoneCall *call, bool_t is_preview) {
VideoStream *stream = call->videostream;
if (!stream)
return;
if (!is_preview) {
if (stream->output && ms_filter_get_id(stream->output) == MS_OGL_ID)
ms_filter_call_method(stream->output, MS_OGL_RENDER, NULL);
void linphone_call_ogl_render(const LinphoneCall *call) {
#ifdef VIDEO_ENABLED
return;
}
VideoStream *stream = call->videostream;
if (stream && stream->output && ms_filter_get_id(stream->output) == MS_OGL_ID)
ms_filter_call_method(stream->output, MS_OGL_RENDER, NULL);
if (stream->output2 && ms_filter_get_id(stream->output2) == MS_OGL_ID)
ms_filter_call_method(stream->output2, MS_OGL_RENDER, NULL);
#endif
}
void linphone_call_add_callbacks(LinphoneCall *call, LinphoneCallCbs *cbs) {
......
......@@ -36,13 +36,14 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <ortp/telephonyevents.h>
#include <mediastreamer2/zrtp.h>
#include <mediastreamer2/dtls_srtp.h>
#include "mediastreamer2/dtmfgen.h"
#include "mediastreamer2/mediastream.h"
#include "mediastreamer2/msfactory.h"
#include "mediastreamer2/mseventqueue.h"
#include "mediastreamer2/msvolume.h"
#include "mediastreamer2/msequalizer.h"
#include "mediastreamer2/dtmfgen.h"
#include "mediastreamer2/mseventqueue.h"
#include "mediastreamer2/msfactory.h"
#include "mediastreamer2/msjpegwriter.h"
#include "mediastreamer2/msogl.h"
#include "mediastreamer2/msvolume.h"
#ifdef INET6
#ifndef _WIN32
......@@ -2861,7 +2862,7 @@ LinphoneStatus linphone_core_set_sip_transports(LinphoneCore *lc, const Linphone
}
LinphoneStatus linphone_core_set_transports(LinphoneCore *lc, const LinphoneTransports * transports){
if (transports->udp_port == lc->sip_conf.transports.udp_port &&
if (transports->udp_port == lc->sip_conf.transports.udp_port &&
transports->tcp_port == lc->sip_conf.transports.tcp_port &&
transports->tls_port == lc->sip_conf.transports.tls_port &&
transports->dtls_port == lc->sip_conf.transports.dtls_port) {
......@@ -5321,7 +5322,7 @@ void linphone_core_set_preferred_video_definition(LinphoneCore *lc, LinphoneVide
if (video_definition_supported(vdef)) {
LinphoneVideoDefinition *oldvdef = lc->video_conf.vdef;
lc->video_conf.vdef = linphone_video_definition_ref(vdef);
if ((lc->previewstream != NULL) && (lc->video_conf.preview_vdef == NULL)
&& (oldvdef != NULL) && !linphone_video_definition_equals(oldvdef, vdef)) {
relaunch_video_preview(lc);
......@@ -5459,6 +5460,19 @@ float linphone_core_get_preferred_framerate(LinphoneCore *lc){
return lc->video_conf.fps;
}
void linphone_core_preview_ogl_render(const LinphoneCore *lc) {
#ifdef VIDEO_ENABLED
LinphoneCall *call = linphone_core_get_current_call(lc);
VideoStream *stream;
if (call && (stream = call->videostream) && stream->output2 && ms_filter_get_id(stream->output2) == MS_OGL_ID)
ms_filter_call_method(stream->output2, MS_OGL_RENDER, NULL);
else if ((stream = lc->previewstream) && stream->output && ms_filter_get_id(stream->output) == MS_OGL_ID)
ms_filter_call_method(stream->output, MS_OGL_RENDER, NULL);
#endif
}
void linphone_core_set_use_files(LinphoneCore *lc, bool_t yesno){
lc->use_files=yesno;
......
......@@ -381,11 +381,11 @@ LINPHONE_PUBLIC LinphoneStatus linphone_call_resume(LinphoneCall *call);
* @return 0 on success, -1 on failure
**/LINPHONE_PUBLIC LinphoneStatus linphone_call_terminate(LinphoneCall *call);
/**
* Terminates a call.
* @param[in] call LinphoneCall object
* @param[in] ei LinphoneErrorInfo
* @param[in] ei LinphoneErrorInfo
* @return 0 on success, -1 on failure
**/
LINPHONE_PUBLIC LinphoneStatus linphone_call_terminate_with_error_info(LinphoneCall *call, const LinphoneErrorInfo *ei);
......@@ -820,9 +820,8 @@ LINPHONE_PUBLIC bool_t linphone_call_media_in_progress(LinphoneCall *call);
/**
* Call generic OpenGL render for a given call.
* @param call The call.
* @is_preview If true the preview is displayed otherwise it's the input stream.
*/
LINPHONE_PUBLIC void linphone_call_ogl_render(LinphoneCall *call, bool_t is_preview);
LINPHONE_PUBLIC void linphone_call_ogl_render(const LinphoneCall *call);
......
......@@ -3209,7 +3209,7 @@ LINPHONE_PUBLIC bool_t linphone_core_video_display_enabled(LinphoneCore *lc);
* This policy defines whether:
* - video shall be initiated by default for outgoing calls
* - video shall be accepter by default for incoming calls
*
*
* @param[in] lc LinphoneCore object
* @param[in] policy The video policy to use
* @ingroup media_parameters
......@@ -3428,6 +3428,13 @@ LINPHONE_PUBLIC void linphone_core_set_preferred_framerate(LinphoneCore *lc, flo
**/
LINPHONE_PUBLIC float linphone_core_get_preferred_framerate(LinphoneCore *lc);
/**
* Call generic OpenGL render for a given core.
* @param lc The core.
* @ingroup media_parameters
*/
LINPHONE_PUBLIC void linphone_core_preview_ogl_render(const LinphoneCore *lc);
/**
* Controls video preview enablement.
* @param[in] lc LinphoneCore object
......@@ -5119,8 +5126,8 @@ LINPHONE_PUBLIC LinphonePresencePerson * linphone_core_create_presence_person(Li
* @return The created #LinphonePresenceService object.
*/
LINPHONE_PUBLIC LinphonePresenceService * linphone_core_create_presence_service(LinphoneCore *lc, const char *id, LinphonePresenceBasicStatus basic_status, const char *contact);
/**
* Notifies the upper layer that a presence status has been received by calling the appropriate
* callback if one has been set.
......@@ -5139,7 +5146,7 @@ LINPHONE_PUBLIC void linphone_core_notify_notify_presence_received(LinphoneCore
* @param[in] presence_model the #LinphonePresenceModel that has been modified
*/
LINPHONE_PUBLIC void linphone_core_notify_notify_presence_received_for_uri_or_tel(LinphoneCore *lc, LinphoneFriend *lf, const char *uri_or_tel, const LinphonePresenceModel *presence_model);
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment