Commit 61f00e20 authored by Ghislain MARY's avatar Ghislain MARY

Fix build of liblinphone C++/Cx wrapper.

parent 313da40e
......@@ -24,11 +24,17 @@ cmake_minimum_required(VERSION 3.0)
project(NATIVE CXX)
find_package(ORTP REQUIRED)
find_package(Mediastreamer2 REQUIRED)
find_package(BelleSIP REQUIRED)
find_package(Linphone REQUIRED)
include_directories(
${LINPHONE_INCLUDE_DIRS}
${BELLESIP_INCLUDE_DIRS}
${MEDIASTREAMER2_INCLUDE_DIRS}
${ORTP_INCLUDE_DIRS}
)
set(SOURCE_FILES
......@@ -76,7 +82,7 @@ set(SOURCE_FILES
VoipCallController.cpp
VoipCallController.h
)
set(LIBS ${LINPHONE_LIBRARIES})
set(LIBS ${LINPHONE_LIBRARIES} ${BELLESIP_LIBRARIES} ${MEDIASTREAMER2_LIBRARIES} ${ORTP_LIBRARIES})
add_library(linphone_native MODULE ${SOURCE_FILES})
set_target_properties(linphone_native PROPERTIES VERSION 0)
......
......@@ -21,131 +21,95 @@ using namespace BelledonneCommunications::Linphone::Native;
float CallStats::DownloadBandwidth::get()
{
return this->downloadBandwidth;
return linphone_call_stats_get_download_bandwidth(this->stats);
}
IceState CallStats::IceState::get()
{
return this->iceState;
return (BelledonneCommunications::Linphone::Native::IceState)linphone_call_stats_get_ice_state(this->stats);
}
float CallStats::JitterBufferSize::get()
{
return this->jitterBufferSize;
return linphone_call_stats_get_jitter_buffer_size_ms(this->stats);
}
int64 CallStats::LatePacketsCumulativeNumber::get()
{
return this->cumulativeLatePackets;
return linphone_call_stats_get_late_packets_cumulative_number(this->stats);
}
float CallStats::LocalLateRate::get()
{
return this->localLateRate;
return linphone_call_stats_get_local_late_rate(this->stats);
}
float CallStats::LocalLossRate::get()
{
return this->localLossRate;
return linphone_call_stats_get_local_loss_rate(this->stats);
}
MediaType CallStats::MediaType::get()
{
return this->mediaType;
return (BelledonneCommunications::Linphone::Native::MediaType)linphone_call_stats_get_type(this->stats);
}
float CallStats::ReceiverInterarrivalJitter::get()
{
return this->receiverInterarrivalJitter;
return linphone_call_stats_get_receiver_interarrival_jitter(this->stats);
}
float CallStats::ReceiverLossRate::get()
{
return this->receiverLossRate;
return linphone_call_stats_get_receiver_loss_rate(this->stats);
}
float CallStats::RoundTripDelay::get()
{
return this->roundTripDelay;
return linphone_call_stats_get_round_trip_delay(this->stats);
}
float CallStats::SenderInterarrivalJitter::get()
{
return this->senderInterarrivalJitter;
return linphone_call_stats_get_sender_interarrival_jitter(this->stats);
}
float CallStats::SenderLossRate::get()
{
return this->senderLossRate;
return linphone_call_stats_get_sender_loss_rate(this->stats);
}
float CallStats::UploadBandwidth::get()
{
return this->uploadBandwidth;
return linphone_call_stats_get_upload_bandwidth(this->stats);
}
CallStats::CallStats(::LinphoneCall *call, BelledonneCommunications::Linphone::Native::MediaType mediaType)
: call(call)
{
API_LOCK;
RefToPtrProxy<CallStats^> *proxy = new RefToPtrProxy<CallStats^>(this);
const ::LinphoneCallStats *stats = nullptr;
if (mediaType == BelledonneCommunications::Linphone::Native::MediaType::Audio) {
stats = linphone_call_get_audio_stats(this->call);
stats = linphone_call_get_audio_stats(call);
} else {
stats = linphone_call_get_video_stats(this->call);
stats = linphone_call_get_video_stats(call);
}
FillStats(stats);
linphone_call_stats_ref(this->stats);
linphone_call_stats_set_user_data(this->stats, proxy);
}
CallStats::CallStats(::LinphoneCallStats *callStats)
{
API_LOCK;
FillStats(callStats);
RefToPtrProxy<CallStats^> *proxy = new RefToPtrProxy<CallStats^>(this);
this->stats = callStats;
linphone_call_stats_ref(this->stats);
linphone_call_stats_set_user_data(this->stats, proxy);
}
CallStats::~CallStats()
{
}
float CallStats::GetSenderLossRate(const ::LinphoneCallStats *stats)
{
return linphone_call_stats_get_sender_loss_rate(stats);
}
float CallStats::GetReceiverLossRate(const ::LinphoneCallStats *stats)
{
return linphone_call_stats_get_receiver_loss_rate(stats);
}
float CallStats::GetSenderInterarrivalJitter(const ::LinphoneCallStats *stats)
{
return linphone_call_stats_get_sender_interarrival_jitter(stats);
}
float CallStats::GetReceiverInterarrivalJitter(const ::LinphoneCallStats *stats)
{
return linphone_call_stats_get_receiver_interarrival_jitter(stats);
}
int64 CallStats::GetLatePacketsCumulativeNumber(const ::LinphoneCallStats *stats)
{
return linphone_call_stats_get_late_packets_cumulative_number(stats);
}
void CallStats::FillStats(const ::LinphoneCallStats *stats)
{
this->mediaType = (BelledonneCommunications::Linphone::Native::MediaType) stats->type;
this->iceState = (BelledonneCommunications::Linphone::Native::IceState) stats->ice_state;
this->downloadBandwidth = stats->download_bandwidth;
this->uploadBandwidth = stats->upload_bandwidth;
this->senderLossRate = GetSenderLossRate(stats);
this->receiverLossRate = GetReceiverLossRate(stats);
this->senderInterarrivalJitter = GetSenderInterarrivalJitter(stats);
this->receiverInterarrivalJitter = GetReceiverInterarrivalJitter(stats);
this->roundTripDelay = stats->round_trip_delay;
this->cumulativeLatePackets = GetLatePacketsCumulativeNumber(stats);
this->jitterBufferSize = stats->jitter_stats.jitter_buffer_size_ms;
this->localLossRate = stats->local_loss_rate;
this->localLateRate = stats->local_late_rate;
linphone_call_stats_unref(this->stats);
RefToPtrProxy<CallStats^> *proxy = reinterpret_cast< RefToPtrProxy<CallStats^> *>(linphone_call_stats_get_user_data(this->stats));
delete proxy;
}
......@@ -145,27 +145,7 @@ namespace BelledonneCommunications
CallStats(::LinphoneCallStats *callStats);
~CallStats();
float GetSenderLossRate(const ::LinphoneCallStats *stats);
float GetReceiverLossRate(const ::LinphoneCallStats *stats);
float GetSenderInterarrivalJitter(const ::LinphoneCallStats *stats);
float GetReceiverInterarrivalJitter(const ::LinphoneCallStats *stats);
int64 GetLatePacketsCumulativeNumber(const ::LinphoneCallStats *stats);
void FillStats(const ::LinphoneCallStats *stats);
::LinphoneCall *call;
BelledonneCommunications::Linphone::Native::MediaType mediaType;
BelledonneCommunications::Linphone::Native::IceState iceState;
float downloadBandwidth;
float uploadBandwidth;
float senderLossRate;
float receiverLossRate;
float senderInterarrivalJitter;
float receiverInterarrivalJitter;
float roundTripDelay;
int64 cumulativeLatePackets;
float jitterBufferSize;
float localLossRate;
float localLateRate;
::LinphoneCallStats *stats;
};
}
}
......
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