From 4a13ac6a7a37b45c4c2feea437ed9d8fd01689e9 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 13 Sep 2017 17:38:28 +0200 Subject: [PATCH] Use real pointer for C++ object inside LinphoneCallParams as it is a ClonableObject. --- coreapi/CMakeLists.txt | 1 - coreapi/call_log.c | 4 +- coreapi/chat.c | 17 +- coreapi/linphonecall.c | 33 +-- coreapi/linphonecore.c | 14 +- coreapi/proxy.c | 6 +- include/linphone/call_log.h | 4 +- include/linphone/core.h | 6 +- src/CMakeLists.txt | 2 +- src/c-wrapper/api/c-address.cpp | 2 +- .../c-wrapper/api/c-call-params.cpp | 226 ++++++++---------- src/c-wrapper/c-private-types.h | 46 ---- src/c-wrapper/c-tools.h | 42 ++-- src/call/call-p.h | 2 +- src/call/call.cpp | 18 +- src/call/call.h | 18 +- src/chat/basic-chat-room.cpp | 4 +- src/chat/basic-chat-room.h | 4 +- src/chat/chat-room.cpp | 2 +- src/chat/client-group-chat-room.cpp | 11 +- src/chat/client-group-chat-room.h | 4 +- src/chat/real-time-text-chat-room.cpp | 4 +- src/chat/real-time-text-chat-room.h | 4 +- src/conference/conference-interface.h | 4 +- src/conference/conference.cpp | 4 +- src/conference/conference.h | 4 +- src/conference/local-conference.h | 1 + .../params/media-session-params-p.h | 1 - src/conference/participant-p.h | 2 +- src/conference/participant.cpp | 5 +- src/conference/remote-conference.h | 3 + src/conference/session/call-session-p.h | 12 +- src/conference/session/call-session.cpp | 44 ++-- src/conference/session/call-session.h | 14 +- src/conference/session/media-session-p.h | 12 +- src/conference/session/media-session.cpp | 74 +++--- src/conference/session/media-session.h | 20 +- 37 files changed, 335 insertions(+), 339 deletions(-) rename coreapi/call_params.c => src/c-wrapper/api/c-call-params.cpp (68%) delete mode 100644 src/c-wrapper/c-private-types.h diff --git a/coreapi/CMakeLists.txt b/coreapi/CMakeLists.txt index a22bfc5ed..532f74bef 100644 --- a/coreapi/CMakeLists.txt +++ b/coreapi/CMakeLists.txt @@ -70,7 +70,6 @@ set(LINPHONE_SOURCE_FILES_C buffer.c callbacks.c call_log.c - call_params.c carddav.c chat.c chat_file_transfer.c diff --git a/coreapi/call_log.c b/coreapi/call_log.c index 47e689b1a..54088adc4 100644 --- a/coreapi/call_log.c +++ b/coreapi/call_log.c @@ -179,7 +179,7 @@ int linphone_call_log_get_duration(LinphoneCallLog *cl){ return cl->duration; } -LinphoneAddress *linphone_call_log_get_from_address(LinphoneCallLog *cl){ +const LinphoneAddress *linphone_call_log_get_from_address(LinphoneCallLog *cl){ return cl->from; } @@ -211,7 +211,7 @@ LinphoneCallStatus linphone_call_log_get_status(LinphoneCallLog *cl){ return cl->status; } -LinphoneAddress *linphone_call_log_get_to_address(LinphoneCallLog *cl){ +const LinphoneAddress *linphone_call_log_get_to_address(LinphoneCallLog *cl){ return cl->to; } diff --git a/coreapi/chat.c b/coreapi/chat.c index aa35495ef..9aa35ed7e 100644 --- a/coreapi/chat.c +++ b/coreapi/chat.c @@ -191,9 +191,9 @@ BELLE_SIP_INSTANCIATE_VPTR(LinphoneChatRoom, belle_sip_object_t, LinphoneChatRoom *_linphone_core_create_chat_room_base(LinphoneCore *lc, const LinphoneAddress *addr) { LinphoneChatRoom *cr = belle_sip_object_new(LinphoneChatRoom); if (linphone_core_realtime_text_enabled(lc)) - cr->cr = new LinphonePrivate::RealTimeTextChatRoom(lc, *L_GET_CPP_PTR_FROM_C_STRUCT(addr, Address)); + cr->cr = new LinphonePrivate::RealTimeTextChatRoom(lc, *L_GET_CPP_PTR_FROM_C_STRUCT(addr, Address, Address)); else - cr->cr = new LinphonePrivate::BasicChatRoom(lc, *L_GET_CPP_PTR_FROM_C_STRUCT(addr, Address)); + cr->cr = new LinphonePrivate::BasicChatRoom(lc, *L_GET_CPP_PTR_FROM_C_STRUCT(addr, Address, Address)); L_GET_PRIVATE(cr->cr)->setCBackPointer(cr); return cr; } @@ -257,9 +257,20 @@ LinphoneChatRoom *linphone_core_get_chat_room(LinphoneCore *lc, const LinphoneAd } LinphoneChatRoom * linphone_core_create_client_group_chat_room(LinphoneCore *lc, bctbx_list_t *addresses) { + const char *factoryUri = linphone_core_get_chat_conference_factory_uri(lc); + if (!factoryUri) + return nullptr; LinphoneChatRoom *cr = belle_sip_object_new(LinphoneChatRoom); + LinphoneAddress *factoryAddr = linphone_address_new(factoryUri); + LinphoneProxyConfig *proxy = linphone_core_lookup_known_proxy(lc, factoryAddr); + linphone_address_unref(factoryAddr); + std::string from; + if (proxy) + from = L_GET_CPP_PTR_FROM_C_STRUCT(linphone_proxy_config_get_identity_address(proxy), Address, Address)->asString(); + if (from.empty()) + from = linphone_core_get_primary_contact(lc); + LinphonePrivate::Address me(from); std::list l = L_GET_CPP_LIST_OF_CPP_OBJ_FROM_C_LIST_OF_STRUCT_PTR(addresses, Address); - LinphonePrivate::Address me; // TODO cr->cr = new LinphonePrivate::ClientGroupChatRoom(lc, me, l); L_GET_PRIVATE(cr->cr)->setCBackPointer(cr); return cr; diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 3acfd9607..516dd216c 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -45,7 +45,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // For migration purpose. #include "address/address-p.h" -#include "c-wrapper/c-private-types.h" #include "c-wrapper/c-tools.h" #include "call/call.h" #include "call/call-p.h" @@ -289,7 +288,9 @@ LinphoneCall * linphone_call_new_outgoing(LinphoneCore *lc, const LinphoneAddres call->paramsCache = linphone_call_params_new_for_wrapper(); call->remoteParamsCache = linphone_call_params_new_for_wrapper(); call->remoteAddressCache = linphone_address_new(nullptr); - call->call = std::make_shared(call, lc, LinphoneCallOutgoing, *L_GET_CPP_PTR_FROM_C_STRUCT(from, Address), *L_GET_CPP_PTR_FROM_C_STRUCT(to, Address), cfg, nullptr, linphone_call_params_get_cpp_obj(params)); + call->call = std::make_shared(call, lc, LinphoneCallOutgoing, + *L_GET_CPP_PTR_FROM_C_STRUCT(from, Address, Address), *L_GET_CPP_PTR_FROM_C_STRUCT(to, Address, Address), + cfg, nullptr, L_GET_CPP_PTR_FROM_C_STRUCT(params, MediaSessionParams, CallParams)); return call; } @@ -299,7 +300,9 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, const LinphoneAddres call->paramsCache = linphone_call_params_new_for_wrapper(); call->remoteParamsCache = linphone_call_params_new_for_wrapper(); call->remoteAddressCache = linphone_address_new(nullptr); - call->call = std::make_shared(call, lc, LinphoneCallIncoming, *L_GET_CPP_PTR_FROM_C_STRUCT(from, Address), *L_GET_CPP_PTR_FROM_C_STRUCT(to, Address), nullptr, op, nullptr); + call->call = std::make_shared(call, lc, LinphoneCallIncoming, + *L_GET_CPP_PTR_FROM_C_STRUCT(from, Address, Address), *L_GET_CPP_PTR_FROM_C_STRUCT(to, Address, Address), + nullptr, op, nullptr); L_GET_PRIVATE(linphone_call_get_cpp_obj(call).get())->initiateIncoming(); return call; } @@ -453,20 +456,20 @@ void linphone_call_unref(LinphoneCall *obj){ } const LinphoneCallParams * linphone_call_get_current_params(LinphoneCall *call){ - call->currentParamsCache->msp = linphone_call_get_cpp_obj(call)->getCurrentParams(); + L_SET_CPP_PTR_FROM_C_STRUCT(call->currentParamsCache, linphone_call_get_cpp_obj(call)->getCurrentParams()); return call->currentParamsCache; } const LinphoneCallParams * linphone_call_get_remote_params(LinphoneCall *call) { - call->remoteParamsCache->msp = linphone_call_get_cpp_obj(call)->getRemoteParams(); - if (call->remoteParamsCache->msp) - return call->remoteParamsCache; - return nullptr; + const LinphonePrivate::MediaSessionParams *remoteParams = linphone_call_get_cpp_obj(call)->getRemoteParams(); + if (!remoteParams) + return nullptr; + L_SET_CPP_PTR_FROM_C_STRUCT(call->remoteParamsCache, remoteParams); + return call->remoteParamsCache; } const LinphoneAddress * linphone_call_get_remote_address(const LinphoneCall *call) { - std::shared_ptr addr = std::make_shared(linphone_call_get_cpp_obj(call)->getRemoteAddress()); - L_SET_CPP_PTR_FROM_C_STRUCT(call->remoteAddressCache, addr); + L_SET_CPP_PTR_FROM_C_STRUCT(call->remoteAddressCache, &linphone_call_get_cpp_obj(call)->getRemoteAddress()); return call->remoteAddressCache; } @@ -1071,7 +1074,7 @@ void _linphone_call_set_new_params(LinphoneCall *call, const LinphoneCallParams } const LinphoneCallParams * linphone_call_get_params(LinphoneCall *call) { - call->paramsCache->msp = linphone_call_get_cpp_obj(call)->getParams(); + L_SET_CPP_PTR_FROM_C_STRUCT(call->paramsCache, linphone_call_get_cpp_obj(call)->getParams()); return call->paramsCache; } @@ -1281,7 +1284,7 @@ LinphoneStatus linphone_call_accept(LinphoneCall *call) { } LinphoneStatus linphone_call_accept_with_params(LinphoneCall *call, const LinphoneCallParams *params) { - return linphone_call_get_cpp_obj(call)->accept(params ? linphone_call_params_get_cpp_obj(params) : nullptr); + return linphone_call_get_cpp_obj(call)->accept(params ? L_GET_CPP_PTR_FROM_C_STRUCT(params, MediaSessionParams, CallParams) : nullptr); } LinphoneStatus linphone_call_accept_early_media(LinphoneCall* call) { @@ -1289,11 +1292,11 @@ LinphoneStatus linphone_call_accept_early_media(LinphoneCall* call) { } LinphoneStatus linphone_call_accept_early_media_with_params(LinphoneCall *call, const LinphoneCallParams *params) { - return linphone_call_get_cpp_obj(call)->acceptEarlyMedia(params ? linphone_call_params_get_cpp_obj(params) : nullptr); + return linphone_call_get_cpp_obj(call)->acceptEarlyMedia(params ? L_GET_CPP_PTR_FROM_C_STRUCT(params, MediaSessionParams, CallParams) : nullptr); } LinphoneStatus linphone_call_update(LinphoneCall *call, const LinphoneCallParams *params) { - return linphone_call_get_cpp_obj(call)->update(params ? linphone_call_params_get_cpp_obj(params) : nullptr); + return linphone_call_get_cpp_obj(call)->update(params ? L_GET_CPP_PTR_FROM_C_STRUCT(params, MediaSessionParams, CallParams) : nullptr); } int linphone_call_start_update(LinphoneCall *call) { @@ -1324,7 +1327,7 @@ int linphone_call_start_accept_update(LinphoneCall *call, LinphoneCallState next } LinphoneStatus linphone_call_accept_update(LinphoneCall *call, const LinphoneCallParams *params) { - return linphone_call_get_cpp_obj(call)->acceptUpdate(params ? linphone_call_params_get_cpp_obj(params) : nullptr); + return linphone_call_get_cpp_obj(call)->acceptUpdate(params ? L_GET_CPP_PTR_FROM_C_STRUCT(params, MediaSessionParams, CallParams) : nullptr); } LinphoneStatus linphone_call_transfer(LinphoneCall *call, const char *refer_to) { diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index ebc57dd9b..8e4416df4 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -3359,7 +3359,7 @@ static bctbx_list_t *make_routes_for_proxy(LinphoneProxyConfig *proxy, const Lin ret=bctbx_list_append(ret,sal_address_new(local_route)); } if (srv_route){ - ret=bctbx_list_append(ret,sal_address_clone(L_GET_PRIVATE_FROM_C_STRUCT(srv_route, Address)->getInternalAddress())); + ret=bctbx_list_append(ret,sal_address_clone(L_GET_PRIVATE_FROM_C_STRUCT(srv_route, Address, Address)->getInternalAddress())); } if (ret==NULL){ /*if the proxy address matches the domain part of the destination, then use the same transport @@ -5918,7 +5918,7 @@ void friends_config_uninit(LinphoneCore* lc) ms_message("Destroying friends done."); } -LpConfig * linphone_core_get_config(LinphoneCore *lc){ +LpConfig * linphone_core_get_config(const LinphoneCore *lc){ return lc->config; } @@ -6671,7 +6671,7 @@ void linphone_core_set_media_encryption_mandatory(LinphoneCore *lc, bool_t m) { } void linphone_core_init_default_params(LinphoneCore*lc, LinphoneCallParams *params) { - linphone_call_params_get_cpp_obj(params)->initDefault(lc); + L_GET_CPP_PTR_FROM_C_STRUCT(params, MediaSessionParams, CallParams)->initDefault(lc); } void linphone_core_set_device_identifier(LinphoneCore *lc,const char* device_id) { @@ -7085,6 +7085,14 @@ LinphoneConference *linphone_core_get_conference(LinphoneCore *lc) { return lc->conf_ctx; } +void linphone_core_set_chat_conference_factory_uri(LinphoneCore *lc, const char *uri) { + lp_config_set_string(linphone_core_get_config(lc), "misc", "chat_conference_factory_uri", uri); +} + +const char * linphone_core_get_chat_conference_factory_uri(const LinphoneCore *lc) { + return lp_config_get_string(linphone_core_get_config(lc), "misc", "chat_conference_factory_uri", nullptr); +} + void linphone_core_set_tls_cert(LinphoneCore *lc, const char *tls_cert) { if (lc->tls_cert) { ms_free(lc->tls_cert); diff --git a/coreapi/proxy.c b/coreapi/proxy.c index e5a4e03b1..e3f3ce9cd 100644 --- a/coreapi/proxy.c +++ b/coreapi/proxy.c @@ -500,7 +500,7 @@ static void linphone_proxy_config_register(LinphoneProxyConfig *cfg){ linphone_configure_op(cfg->lc, cfg->op, cfg->identity_address, cfg->sent_headers, FALSE); if ((contact=guess_contact_for_register(cfg))) { - sal_op_set_contact_address(cfg->op, L_GET_PRIVATE_FROM_C_STRUCT(contact, Address)->getInternalAddress()); + sal_op_set_contact_address(cfg->op, L_GET_PRIVATE_FROM_C_STRUCT(contact, Address, Address)->getInternalAddress()); linphone_address_unref(contact); } @@ -511,7 +511,7 @@ static void linphone_proxy_config_register(LinphoneProxyConfig *cfg){ proxy_string, cfg->reg_identity, cfg->expires, - cfg->pending_contact ? L_GET_PRIVATE_FROM_C_STRUCT(cfg->pending_contact, Address)->getInternalAddress() : NULL + cfg->pending_contact ? L_GET_PRIVATE_FROM_C_STRUCT(cfg->pending_contact, Address, Address)->getInternalAddress() : NULL )==0) { if (cfg->pending_contact) { linphone_address_unref(cfg->pending_contact); @@ -1393,7 +1393,7 @@ const char* linphone_proxy_config_get_transport(const LinphoneProxyConfig *cfg) bool_t destroy_route_addr = FALSE; if (linphone_proxy_config_get_service_route(cfg)) { - route_addr = L_GET_PRIVATE_FROM_C_STRUCT(linphone_proxy_config_get_service_route(cfg), Address)->getInternalAddress(); + route_addr = L_GET_PRIVATE_FROM_C_STRUCT(linphone_proxy_config_get_service_route(cfg), Address, Address)->getInternalAddress(); } else if (linphone_proxy_config_get_route(cfg)) { addr=linphone_proxy_config_get_route(cfg); } else if(linphone_proxy_config_get_addr(cfg)) { diff --git a/include/linphone/call_log.h b/include/linphone/call_log.h index 4320cb72b..fb5e743e1 100644 --- a/include/linphone/call_log.h +++ b/include/linphone/call_log.h @@ -62,7 +62,7 @@ LINPHONE_PUBLIC int linphone_call_log_get_duration(LinphoneCallLog *cl); * @param[in] cl LinphoneCallLog object * @return The origin address (ie from) of the call. **/ -LINPHONE_PUBLIC LinphoneAddress * linphone_call_log_get_from_address(LinphoneCallLog *cl); +LINPHONE_PUBLIC const LinphoneAddress * linphone_call_log_get_from_address(LinphoneCallLog *cl); /** * Get the RTP statistics computed locally regarding the call. @@ -123,7 +123,7 @@ LINPHONE_PUBLIC LinphoneCallStatus linphone_call_log_get_status(LinphoneCallLog * @param[in] cl LinphoneCallLog object * @return The destination address (ie to) of the call. **/ -LINPHONE_PUBLIC LinphoneAddress * linphone_call_log_get_to_address(LinphoneCallLog *cl); +LINPHONE_PUBLIC const LinphoneAddress * linphone_call_log_get_to_address(LinphoneCallLog *cl); /** * Associate a persistent reference key to the call log. diff --git a/include/linphone/core.h b/include/linphone/core.h index 9033527a7..e34b45f9c 100644 --- a/include/linphone/core.h +++ b/include/linphone/core.h @@ -3908,7 +3908,7 @@ LINPHONE_PUBLIC void linphone_core_set_user_data(LinphoneCore *lc, void *userdat * sections and pairs of key=value in the configuration file. * @ingroup misc **/ -LINPHONE_PUBLIC LinphoneConfig * linphone_core_get_config(LinphoneCore *lc); +LINPHONE_PUBLIC LinphoneConfig * linphone_core_get_config(const LinphoneCore *lc); /** * Create a LpConfig object from a user config file. @@ -4187,6 +4187,10 @@ LINPHONE_PUBLIC LinphoneStatus linphone_core_stop_conference_recording(LinphoneC */ LINPHONE_PUBLIC LinphoneConference *linphone_core_get_conference(LinphoneCore *lc); +void linphone_core_set_chat_conference_factory_uri(LinphoneCore *lc, const char *uri); + +const char * linphone_core_get_chat_conference_factory_uri(const LinphoneCore *lc); + /** * @} */ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 248535880..773f308f8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -23,7 +23,6 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES address/address-p.h address/address.h - c-wrapper/c-private-types.h c-wrapper/c-tools.h call/call-listener.h call/call-p.h @@ -98,6 +97,7 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES set(LINPHONE_CXX_OBJECTS_SOURCE_FILES address/address.cpp c-wrapper/api/c-address.cpp + c-wrapper/api/c-call-params.cpp c-wrapper/api/c-event-log.cpp call/call.cpp chat/basic-chat-room.cpp diff --git a/src/c-wrapper/api/c-address.cpp b/src/c-wrapper/api/c-address.cpp index bd9ec8b29..80d4002db 100644 --- a/src/c-wrapper/api/c-address.cpp +++ b/src/c-wrapper/api/c-address.cpp @@ -26,7 +26,7 @@ using namespace std; -L_DECLARE_C_CLONABLE_STRUCT_IMPL(Address, address); +L_DECLARE_C_CLONABLE_STRUCT_IMPL(Address, Address, address); LinphoneAddress *linphone_address_new (const char *address) { LINPHONE_NAMESPACE::Address *cppPtr = new LINPHONE_NAMESPACE::Address(L_C_TO_STRING(address)); diff --git a/coreapi/call_params.c b/src/c-wrapper/api/c-call-params.cpp similarity index 68% rename from coreapi/call_params.c rename to src/c-wrapper/api/c-call-params.cpp index 504cca79a..2b130b39b 100644 --- a/coreapi/call_params.c +++ b/src/c-wrapper/api/c-call-params.cpp @@ -20,14 +20,19 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "linphone/call_params.h" #include "private.h" -#include "c-wrapper/c-private-types.h" #include "c-wrapper/c-tools.h" #include "conference/params/media-session-params.h" #include "conference/params/call-session-params-p.h" #include "conference/params/media-session-params-p.h" -BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneCallParams); +#define GET_CALL_CPP_PTR(obj) L_GET_CPP_PTR_FROM_C_STRUCT(obj, CallSessionParams, CallParams) +#define GET_CALL_CPP_PRIVATE_PTR(obj) L_GET_PRIVATE_FROM_C_STRUCT(obj, CallSessionParams, CallParams) +#define GET_MEDIA_CPP_PTR(obj) L_GET_CPP_PTR_FROM_C_STRUCT(obj, MediaSessionParams, CallParams) +#define GET_MEDIA_CPP_PRIVATE_PTR(obj) L_GET_PRIVATE_FROM_C_STRUCT(obj, MediaSessionParams, CallParams) + + +L_DECLARE_C_CLONABLE_STRUCT_IMPL(MediaSessionParams, CallParams, call_params) /******************************************************************************* @@ -35,7 +40,7 @@ BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneCallParams); ******************************************************************************/ SalMediaProto get_proto_from_call_params(const LinphoneCallParams *params) { - return params->msp->getMediaProto(); + return GET_MEDIA_CPP_PTR(params)->getMediaProto(); } SalStreamDir sal_dir_from_call_params_dir(LinphoneMediaDirection cpdir) { @@ -78,15 +83,15 @@ SalStreamDir get_video_dir_from_call_params(const LinphoneCallParams *params) { } void linphone_call_params_set_custom_headers(LinphoneCallParams *params, const SalCustomHeader *ch) { - L_GET_PRIVATE(static_cast(params->msp.get()))->setCustomHeaders(ch); + GET_CALL_CPP_PRIVATE_PTR(params)->setCustomHeaders(ch); } void linphone_call_params_set_custom_sdp_attributes(LinphoneCallParams *params, const SalCustomSdpAttribute *csa) { - L_GET_PRIVATE(params->msp.get())->setCustomSdpAttributes(csa); + GET_MEDIA_CPP_PRIVATE_PTR(params)->setCustomSdpAttributes(csa); } void linphone_call_params_set_custom_sdp_media_attributes(LinphoneCallParams *params, LinphoneStreamType type, const SalCustomSdpAttribute *csa) { - L_GET_PRIVATE(params->msp.get())->setCustomSdpMediaAttributes(type, csa); + GET_MEDIA_CPP_PRIVATE_PTR(params)->setCustomSdpMediaAttributes(type, csa); } @@ -95,23 +100,23 @@ void linphone_call_params_set_custom_sdp_media_attributes(LinphoneCallParams *pa ******************************************************************************/ void linphone_call_params_add_custom_header(LinphoneCallParams *params, const char *header_name, const char *header_value) { - params->msp->addCustomHeader(header_name, header_value); + GET_MEDIA_CPP_PTR(params)->addCustomHeader(header_name, header_value); } void linphone_call_params_add_custom_sdp_attribute(LinphoneCallParams *params, const char *attribute_name, const char *attribute_value) { - params->msp->addCustomSdpAttribute(attribute_name, attribute_value); + GET_MEDIA_CPP_PTR(params)->addCustomSdpAttribute(attribute_name, attribute_value); } void linphone_call_params_add_custom_sdp_media_attribute(LinphoneCallParams *params, LinphoneStreamType type, const char *attribute_name, const char *attribute_value) { - params->msp->addCustomSdpMediaAttribute(type, attribute_name, attribute_value); + GET_MEDIA_CPP_PTR(params)->addCustomSdpMediaAttribute(type, attribute_name, attribute_value); } void linphone_call_params_clear_custom_sdp_attributes(LinphoneCallParams *params) { - params->msp->clearCustomSdpAttributes(); + GET_MEDIA_CPP_PTR(params)->clearCustomSdpAttributes(); } void linphone_call_params_clear_custom_sdp_media_attributes(LinphoneCallParams *params, LinphoneStreamType type) { - params->msp->clearCustomSdpMediaAttributes(type); + GET_MEDIA_CPP_PTR(params)->clearCustomSdpMediaAttributes(type); } LinphoneCallParams * linphone_call_params_copy(const LinphoneCallParams *params) { @@ -119,42 +124,42 @@ LinphoneCallParams * linphone_call_params_copy(const LinphoneCallParams *params) } bool_t linphone_call_params_early_media_sending_enabled(const LinphoneCallParams *params) { - return params->msp->earlyMediaSendingEnabled(); + return GET_MEDIA_CPP_PTR(params)->earlyMediaSendingEnabled(); } void linphone_call_params_enable_early_media_sending(LinphoneCallParams *params, bool_t enabled) { - params->msp->enableEarlyMediaSending(enabled); + GET_MEDIA_CPP_PTR(params)->enableEarlyMediaSending(enabled); } void linphone_call_params_enable_low_bandwidth(LinphoneCallParams *params, bool_t enabled) { - params->msp->enableLowBandwidth(enabled); + GET_MEDIA_CPP_PTR(params)->enableLowBandwidth(enabled); } void linphone_call_params_enable_audio(LinphoneCallParams *params, bool_t enabled) { - params->msp->enableAudio(enabled); + GET_MEDIA_CPP_PTR(params)->enableAudio(enabled); } LinphoneStatus linphone_call_params_enable_realtime_text(LinphoneCallParams *params, bool_t yesno) { - params->msp->enableRealtimeText(yesno); + GET_MEDIA_CPP_PTR(params)->enableRealtimeText(yesno); return 0; } void linphone_call_params_enable_video(LinphoneCallParams *params, bool_t enabled) { - params->msp->enableVideo(enabled); + GET_MEDIA_CPP_PTR(params)->enableVideo(enabled); } const char *linphone_call_params_get_custom_header(const LinphoneCallParams *params, const char *header_name) { - std::string value = params->msp->getCustomHeader(header_name); + std::string value = GET_MEDIA_CPP_PTR(params)->getCustomHeader(header_name); return value.empty() ? nullptr : value.c_str(); } const char * linphone_call_params_get_custom_sdp_attribute(const LinphoneCallParams *params, const char *attribute_name) { - std::string value = params->msp->getCustomSdpAttribute(attribute_name); + std::string value = GET_MEDIA_CPP_PTR(params)->getCustomSdpAttribute(attribute_name); return value.empty() ? nullptr : value.c_str(); } const char * linphone_call_params_get_custom_sdp_media_attribute(const LinphoneCallParams *params, LinphoneStreamType type, const char *attribute_name) { - std::string value = params->msp->getCustomSdpMediaAttribute(type, attribute_name); + std::string value = GET_MEDIA_CPP_PTR(params)->getCustomSdpMediaAttribute(type, attribute_name); return value.empty() ? nullptr : value.c_str(); } @@ -163,20 +168,20 @@ bool_t linphone_call_params_get_local_conference_mode(const LinphoneCallParams * } LinphoneMediaEncryption linphone_call_params_get_media_encryption(const LinphoneCallParams *params) { - return params->msp->getMediaEncryption(); + return GET_MEDIA_CPP_PTR(params)->getMediaEncryption(); } LinphonePrivacyMask linphone_call_params_get_privacy(const LinphoneCallParams *params) { - return params->msp->getPrivacy(); + return GET_MEDIA_CPP_PTR(params)->getPrivacy(); } float linphone_call_params_get_received_framerate(const LinphoneCallParams *params) { - return params->msp->getReceivedFps(); + return GET_MEDIA_CPP_PTR(params)->getReceivedFps(); } MSVideoSize linphone_call_params_get_received_video_size(const LinphoneCallParams *params) { MSVideoSize vsize; - LinphoneVideoDefinition *vdef = params->msp->getReceivedVideoDefinition(); + LinphoneVideoDefinition *vdef = GET_MEDIA_CPP_PTR(params)->getReceivedVideoDefinition(); if (vdef) { vsize.width = linphone_video_definition_get_width(vdef); vsize.height = linphone_video_definition_get_height(vdef); @@ -188,25 +193,25 @@ MSVideoSize linphone_call_params_get_received_video_size(const LinphoneCallParam } const LinphoneVideoDefinition * linphone_call_params_get_received_video_definition(const LinphoneCallParams *params) { - return params->msp->getReceivedVideoDefinition(); + return GET_MEDIA_CPP_PTR(params)->getReceivedVideoDefinition(); } const char *linphone_call_params_get_record_file(const LinphoneCallParams *params) { - const std::string &value = params->msp->getRecordFilePath(); + const std::string &value = GET_MEDIA_CPP_PTR(params)->getRecordFilePath(); return value.empty() ? nullptr : value.c_str(); } const char * linphone_call_params_get_rtp_profile(const LinphoneCallParams *params) { - return params->msp->getRtpProfile(); + return GET_MEDIA_CPP_PTR(params)->getRtpProfile(); } float linphone_call_params_get_sent_framerate(const LinphoneCallParams *params) { - return params->msp->getSentFps(); + return GET_MEDIA_CPP_PTR(params)->getSentFps(); } MSVideoSize linphone_call_params_get_sent_video_size(const LinphoneCallParams *params) { MSVideoSize vsize; - LinphoneVideoDefinition *vdef = params->msp->getSentVideoDefinition(); + LinphoneVideoDefinition *vdef = GET_MEDIA_CPP_PTR(params)->getSentVideoDefinition(); if (vdef) { vsize.width = linphone_video_definition_get_width(vdef); vsize.height = linphone_video_definition_get_height(vdef); @@ -218,155 +223,155 @@ MSVideoSize linphone_call_params_get_sent_video_size(const LinphoneCallParams *p } const LinphoneVideoDefinition * linphone_call_params_get_sent_video_definition(const LinphoneCallParams *params) { - return params->msp->getSentVideoDefinition(); + return GET_MEDIA_CPP_PTR(params)->getSentVideoDefinition(); } const char *linphone_call_params_get_session_name(const LinphoneCallParams *params) { - const std::string &value = params->msp->getSessionName(); + const std::string &value = GET_MEDIA_CPP_PTR(params)->getSessionName(); return value.empty() ? nullptr : value.c_str(); } LinphonePayloadType *linphone_call_params_get_used_audio_payload_type(const LinphoneCallParams *params) { - return params->msp->getUsedAudioPayloadType(); + return GET_MEDIA_CPP_PTR(params)->getUsedAudioPayloadType(); } LinphonePayloadType *linphone_call_params_get_used_video_payload_type(const LinphoneCallParams *params) { - return params->msp->getUsedVideoPayloadType(); + return GET_MEDIA_CPP_PTR(params)->getUsedVideoPayloadType(); } LinphonePayloadType *linphone_call_params_get_used_text_payload_type(const LinphoneCallParams *params) { - return params->msp->getUsedRealtimeTextPayloadType(); + return GET_MEDIA_CPP_PTR(params)->getUsedRealtimeTextPayloadType(); } const OrtpPayloadType *linphone_call_params_get_used_audio_codec(const LinphoneCallParams *params) { - return params->msp->getUsedAudioCodec(); + return GET_MEDIA_CPP_PTR(params)->getUsedAudioCodec(); } void linphone_call_params_set_used_audio_codec(LinphoneCallParams *params, OrtpPayloadType *codec) { - L_GET_PRIVATE(params->msp.get())->setUsedAudioCodec(codec); + GET_MEDIA_CPP_PRIVATE_PTR(params)->setUsedAudioCodec(codec); } const OrtpPayloadType *linphone_call_params_get_used_video_codec(const LinphoneCallParams *params) { - return params->msp->getUsedVideoCodec(); + return GET_MEDIA_CPP_PTR(params)->getUsedVideoCodec(); } void linphone_call_params_set_used_video_codec(LinphoneCallParams *params, OrtpPayloadType *codec) { - L_GET_PRIVATE(params->msp.get())->setUsedVideoCodec(codec); + GET_MEDIA_CPP_PRIVATE_PTR(params)->setUsedVideoCodec(codec); } const OrtpPayloadType *linphone_call_params_get_used_text_codec(const LinphoneCallParams *params) { - return params->msp->getUsedRealtimeTextCodec(); + return GET_MEDIA_CPP_PTR(params)->getUsedRealtimeTextCodec(); } void linphone_call_params_set_used_text_codec(LinphoneCallParams *params, OrtpPayloadType *codec) { - L_GET_PRIVATE(params->msp.get())->setUsedRealtimeTextCodec(codec); + GET_MEDIA_CPP_PRIVATE_PTR(params)->setUsedRealtimeTextCodec(codec); } bool_t linphone_call_params_low_bandwidth_enabled(const LinphoneCallParams *params) { - return params->msp->lowBandwidthEnabled(); + return GET_MEDIA_CPP_PTR(params)->lowBandwidthEnabled(); } int linphone_call_params_get_audio_bandwidth_limit(const LinphoneCallParams *params) { - return params->msp->getAudioBandwidthLimit(); + return GET_MEDIA_CPP_PTR(params)->getAudioBandwidthLimit(); } void linphone_call_params_set_audio_bandwidth_limit(LinphoneCallParams *params, int bandwidth) { - params->msp->setAudioBandwidthLimit(bandwidth); + GET_MEDIA_CPP_PTR(params)->setAudioBandwidthLimit(bandwidth); } void linphone_call_params_set_media_encryption(LinphoneCallParams *params, LinphoneMediaEncryption encryption) { - params->msp->setMediaEncryption(encryption); + GET_MEDIA_CPP_PTR(params)->setMediaEncryption(encryption); } void linphone_call_params_set_privacy(LinphoneCallParams *params, LinphonePrivacyMask privacy) { - params->msp->setPrivacy(privacy); + GET_MEDIA_CPP_PTR(params)->setPrivacy(privacy); } void linphone_call_params_set_record_file(LinphoneCallParams *params, const char *path) { - params->msp->setRecordFilePath(path ? path : ""); + GET_MEDIA_CPP_PTR(params)->setRecordFilePath(path ? path : ""); } void linphone_call_params_set_session_name(LinphoneCallParams *params, const char *name) { - params->msp->setSessionName(name ? name : ""); + GET_MEDIA_CPP_PTR(params)->setSessionName(name ? name : ""); } bool_t linphone_call_params_audio_enabled(const LinphoneCallParams *params) { - return params->msp->audioEnabled(); + return GET_MEDIA_CPP_PTR(params)->audioEnabled(); } bool_t linphone_call_params_realtime_text_enabled(const LinphoneCallParams *params) { - return params->msp->realtimeTextEnabled(); + return GET_MEDIA_CPP_PTR(params)->realtimeTextEnabled(); } bool_t linphone_call_params_video_enabled(const LinphoneCallParams *params) { - return params->msp->videoEnabled(); + return GET_MEDIA_CPP_PTR(params)->videoEnabled(); } LinphoneMediaDirection linphone_call_params_get_audio_direction(const LinphoneCallParams *params) { - return params->msp->getAudioDirection(); + return GET_MEDIA_CPP_PTR(params)->getAudioDirection(); } LinphoneMediaDirection linphone_call_params_get_video_direction(const LinphoneCallParams *params) { - return params->msp->getVideoDirection(); + return GET_MEDIA_CPP_PTR(params)->getVideoDirection(); } void linphone_call_params_set_audio_direction(LinphoneCallParams *params, LinphoneMediaDirection dir) { - params->msp->setAudioDirection(dir); + GET_MEDIA_CPP_PTR(params)->setAudioDirection(dir); } void linphone_call_params_set_video_direction(LinphoneCallParams *params, LinphoneMediaDirection dir) { - params->msp->setVideoDirection(dir); + GET_MEDIA_CPP_PTR(params)->setVideoDirection(dir); } void linphone_call_params_enable_audio_multicast(LinphoneCallParams *params, bool_t yesno) { - params->msp->enableAudioMulticast(yesno); + GET_MEDIA_CPP_PTR(params)->enableAudioMulticast(yesno); } bool_t linphone_call_params_audio_multicast_enabled(const LinphoneCallParams *params) { - return params->msp->audioMulticastEnabled(); + return GET_MEDIA_CPP_PTR(params)->audioMulticastEnabled(); } void linphone_call_params_enable_video_multicast(LinphoneCallParams *params, bool_t yesno) { - params->msp->enableVideoMulticast(yesno); + GET_MEDIA_CPP_PTR(params)->enableVideoMulticast(yesno); } bool_t linphone_call_params_video_multicast_enabled(const LinphoneCallParams *params) { - return params->msp->videoMulticastEnabled(); + return GET_MEDIA_CPP_PTR(params)->videoMulticastEnabled(); } bool_t linphone_call_params_real_early_media_enabled(const LinphoneCallParams *params) { - return params->msp->earlyMediaSendingEnabled(); + return GET_MEDIA_CPP_PTR(params)->earlyMediaSendingEnabled(); } bool_t linphone_call_params_avpf_enabled(const LinphoneCallParams *params) { - return params->msp->avpfEnabled(); + return GET_MEDIA_CPP_PTR(params)->avpfEnabled(); } void linphone_call_params_enable_avpf(LinphoneCallParams *params, bool_t enable) { - params->msp->enableAvpf(enable); + GET_MEDIA_CPP_PTR(params)->enableAvpf(enable); } bool_t linphone_call_params_mandatory_media_encryption_enabled(const LinphoneCallParams *params) { - return params->msp->mandatoryMediaEncryptionEnabled(); + return GET_MEDIA_CPP_PTR(params)->mandatoryMediaEncryptionEnabled(); } void linphone_call_params_enable_mandatory_media_encryption(LinphoneCallParams *params, bool_t value) { - params->msp->enableMandatoryMediaEncryption(value); + GET_MEDIA_CPP_PTR(params)->enableMandatoryMediaEncryption(value); } uint16_t linphone_call_params_get_avpf_rr_interval(const LinphoneCallParams *params) { - return params->msp->getAvpfRrInterval(); + return GET_MEDIA_CPP_PTR(params)->getAvpfRrInterval(); } void linphone_call_params_set_avpf_rr_interval(LinphoneCallParams *params, uint16_t value) { - params->msp->setAvpfRrInterval(value); + GET_MEDIA_CPP_PTR(params)->setAvpfRrInterval(value); } void linphone_call_params_set_sent_fps(LinphoneCallParams *params, float value) { - L_GET_PRIVATE(params->msp.get())->setSentFps(value); + GET_MEDIA_CPP_PRIVATE_PTR(params)->setSentFps(value); } void linphone_call_params_set_received_fps(LinphoneCallParams *params, float value) { - L_GET_PRIVATE(params->msp.get())->setReceivedFps(value); + GET_MEDIA_CPP_PRIVATE_PTR(params)->setReceivedFps(value); } @@ -375,115 +380,111 @@ void linphone_call_params_set_received_fps(LinphoneCallParams *params, float val ******************************************************************************/ bool_t linphone_call_params_get_in_conference(const LinphoneCallParams *params) { - return L_GET_PRIVATE(static_cast(params->msp.get()))->getInConference(); + return GET_CALL_CPP_PRIVATE_PTR(params)->getInConference(); } void linphone_call_params_set_in_conference(LinphoneCallParams *params, bool_t value) { - L_GET_PRIVATE(static_cast(params->msp.get()))->setInConference(value); + GET_CALL_CPP_PRIVATE_PTR(params)->setInConference(value); } bool_t linphone_call_params_get_internal_call_update(const LinphoneCallParams *params) { - return L_GET_PRIVATE(static_cast(params->msp.get()))->getInternalCallUpdate(); + return GET_CALL_CPP_PRIVATE_PTR(params)->getInternalCallUpdate(); } void linphone_call_params_set_internal_call_update(LinphoneCallParams *params, bool_t value) { - L_GET_PRIVATE(static_cast(params->msp.get()))->setInternalCallUpdate(value); + GET_CALL_CPP_PRIVATE_PTR(params)->setInternalCallUpdate(value); } bool_t linphone_call_params_implicit_rtcp_fb_enabled(const LinphoneCallParams *params) { - return L_GET_PRIVATE(params->msp.get())->implicitRtcpFbEnabled(); + return GET_MEDIA_CPP_PRIVATE_PTR(params)->implicitRtcpFbEnabled(); } void linphone_call_params_enable_implicit_rtcp_fb(LinphoneCallParams *params, bool_t value) { - L_GET_PRIVATE(params->msp.get())->enableImplicitRtcpFb(value); + GET_MEDIA_CPP_PRIVATE_PTR(params)->enableImplicitRtcpFb(value); } int linphone_call_params_get_down_bandwidth(const LinphoneCallParams *params) { - return L_GET_PRIVATE(params->msp.get())->getDownBandwidth(); + return GET_MEDIA_CPP_PRIVATE_PTR(params)->getDownBandwidth(); } void linphone_call_params_set_down_bandwidth(LinphoneCallParams *params, int value) { - L_GET_PRIVATE(params->msp.get())->setDownBandwidth(value); + GET_MEDIA_CPP_PRIVATE_PTR(params)->setDownBandwidth(value); } int linphone_call_params_get_up_bandwidth(const LinphoneCallParams *params) { - return L_GET_PRIVATE(params->msp.get())->getUpBandwidth(); + return GET_MEDIA_CPP_PRIVATE_PTR(params)->getUpBandwidth(); } void linphone_call_params_set_up_bandwidth(LinphoneCallParams *params, int value) { - L_GET_PRIVATE(params->msp.get())->setUpBandwidth(value); + GET_MEDIA_CPP_PRIVATE_PTR(params)->setUpBandwidth(value); } int linphone_call_params_get_down_ptime(const LinphoneCallParams *params) { - return L_GET_PRIVATE(params->msp.get())->getDownPtime(); + return GET_MEDIA_CPP_PRIVATE_PTR(params)->getDownPtime(); } void linphone_call_params_set_down_ptime(LinphoneCallParams *params, int value) { - L_GET_PRIVATE(params->msp.get())->setDownPtime(value); + GET_MEDIA_CPP_PRIVATE_PTR(params)->setDownPtime(value); } int linphone_call_params_get_up_ptime(const LinphoneCallParams *params) { - return L_GET_PRIVATE(params->msp.get())->getUpPtime(); + return GET_MEDIA_CPP_PRIVATE_PTR(params)->getUpPtime(); } void linphone_call_params_set_up_ptime(LinphoneCallParams *params, int value) { - L_GET_PRIVATE(params->msp.get())->setUpPtime(value); + GET_MEDIA_CPP_PRIVATE_PTR(params)->setUpPtime(value); } SalCustomHeader * linphone_call_params_get_custom_headers(const LinphoneCallParams *params) { - return L_GET_PRIVATE(static_cast(params->msp.get()))->getCustomHeaders(); + return GET_CALL_CPP_PRIVATE_PTR(params)->getCustomHeaders(); } SalCustomSdpAttribute * linphone_call_params_get_custom_sdp_attributes(const LinphoneCallParams *params) { - return L_GET_PRIVATE(params->msp.get())->getCustomSdpAttributes(); + return GET_MEDIA_CPP_PRIVATE_PTR(params)->getCustomSdpAttributes(); } SalCustomSdpAttribute * linphone_call_params_get_custom_sdp_media_attributes(const LinphoneCallParams *params, LinphoneStreamType type) { - return L_GET_PRIVATE(params->msp.get())->getCustomSdpMediaAttributes(type); + return GET_MEDIA_CPP_PRIVATE_PTR(params)->getCustomSdpMediaAttributes(type); } LinphoneCall * linphone_call_params_get_referer(const LinphoneCallParams *params) { - return L_GET_PRIVATE(static_cast(params->msp.get()))->getReferer(); + return GET_CALL_CPP_PRIVATE_PTR(params)->getReferer(); } void linphone_call_params_set_referer(LinphoneCallParams *params, LinphoneCall *referer) { - L_GET_PRIVATE(static_cast(params->msp.get()))->setReferer(referer); + GET_CALL_CPP_PRIVATE_PTR(params)->setReferer(referer); } bool_t linphone_call_params_get_update_call_when_ice_completed(const LinphoneCallParams *params) { - return L_GET_PRIVATE(params->msp.get())->getUpdateCallWhenIceCompleted(); + return GET_MEDIA_CPP_PRIVATE_PTR(params)->getUpdateCallWhenIceCompleted(); } void linphone_call_params_set_update_call_when_ice_completed(LinphoneCallParams *params, bool_t value) { - L_GET_PRIVATE(params->msp.get())->setUpdateCallWhenIceCompleted(value); + GET_MEDIA_CPP_PRIVATE_PTR(params)->setUpdateCallWhenIceCompleted(value); } void linphone_call_params_set_sent_vsize(LinphoneCallParams *params, MSVideoSize vsize) { - L_GET_PRIVATE(params->msp.get())->setSentVideoDefinition(linphone_video_definition_new(vsize.width, vsize.height, nullptr)); + GET_MEDIA_CPP_PRIVATE_PTR(params)->setSentVideoDefinition(linphone_video_definition_new(vsize.width, vsize.height, nullptr)); } void linphone_call_params_set_recv_vsize(LinphoneCallParams *params, MSVideoSize vsize) { - L_GET_PRIVATE(params->msp.get())->setReceivedVideoDefinition(linphone_video_definition_new(vsize.width, vsize.height, nullptr)); + GET_MEDIA_CPP_PRIVATE_PTR(params)->setReceivedVideoDefinition(linphone_video_definition_new(vsize.width, vsize.height, nullptr)); } void linphone_call_params_set_sent_video_definition(LinphoneCallParams *params, LinphoneVideoDefinition *vdef) { - L_GET_PRIVATE(params->msp.get())->setSentVideoDefinition(vdef); + GET_MEDIA_CPP_PRIVATE_PTR(params)->setSentVideoDefinition(vdef); } void linphone_call_params_set_received_video_definition(LinphoneCallParams *params, LinphoneVideoDefinition *vdef) { - L_GET_PRIVATE(params->msp.get())->setReceivedVideoDefinition(vdef); + GET_MEDIA_CPP_PRIVATE_PTR(params)->setReceivedVideoDefinition(vdef); } bool_t linphone_call_params_get_no_user_consent(const LinphoneCallParams *params) { - return L_GET_PRIVATE(static_cast(params->msp.get()))->getNoUserConsent(); + return GET_CALL_CPP_PRIVATE_PTR(params)->getNoUserConsent(); } void linphone_call_params_set_no_user_consent(LinphoneCallParams *params, bool_t value) { - L_GET_PRIVATE(static_cast(params->msp.get()))->setNoUserConsent(value); -} - -std::shared_ptr linphone_call_params_get_cpp_obj(const LinphoneCallParams *params) { - return params->msp; + GET_CALL_CPP_PRIVATE_PTR(params)->setNoUserConsent(value); } @@ -492,11 +493,11 @@ std::shared_ptr linphone_call_params_get_cp ******************************************************************************/ void *linphone_call_params_get_user_data(const LinphoneCallParams *cp) { - return cp->user_data; + return cp->userData; } void linphone_call_params_set_user_data(LinphoneCallParams *cp, void *ud) { - cp->user_data = ud; + cp->userData = ud; } LinphoneCallParams * linphone_call_params_ref(LinphoneCallParams *cp) { @@ -513,35 +514,18 @@ void linphone_call_params_unref(LinphoneCallParams *cp) { * Constructor and destructor functions * ******************************************************************************/ -static void _linphone_call_params_destroy(LinphoneCallParams *params) { - params->msp = nullptr; -} - -static void _linphone_call_params_clone(LinphoneCallParams *dst, const LinphoneCallParams *src) { - dst->msp = std::make_shared(*src->msp); -} - LinphoneCallParams * linphone_call_params_new(LinphoneCore *core) { - LinphoneCallParams *params = belle_sip_object_new(LinphoneCallParams); - params->msp = std::make_shared(); - params->msp->initDefault(core); + LinphoneCallParams *params = _linphone_call_params_init(); + params->cppPtr = new LinphonePrivate::MediaSessionParams(); + params->cppPtr->initDefault(core); return params; } LinphoneCallParams * linphone_call_params_new_for_wrapper(void) { - return belle_sip_object_new(LinphoneCallParams); + return _linphone_call_params_init(); } /* DEPRECATED */ void linphone_call_params_destroy(LinphoneCallParams *cp) { linphone_call_params_unref(cp); } - -BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneCallParams); - -BELLE_SIP_INSTANCIATE_VPTR(LinphoneCallParams, belle_sip_object_t, - (belle_sip_object_destroy_t)_linphone_call_params_destroy, - (belle_sip_object_clone_t)_linphone_call_params_clone, // clone - NULL, // marshal - FALSE -); diff --git a/src/c-wrapper/c-private-types.h b/src/c-wrapper/c-private-types.h deleted file mode 100644 index bf84e1db1..000000000 --- a/src/c-wrapper/c-private-types.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * c-private-types.h - * Copyright (C) 2017 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 3 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 . - */ - -#ifndef _C_PRIVATE_TYPES_H_ -#define _C_PRIVATE_TYPES_H_ - -#include - -#include "conference/params/media-session-params.h" - -// ============================================================================= - -#ifdef __cplusplus - extern "C" { -#endif - -// ============================================================================= -// C Structures. -// ============================================================================= - -struct _LinphoneCallParams{ - belle_sip_object_t base; - void *user_data; - std::shared_ptr msp; -}; - -#ifdef __cplusplus - } -#endif - -#endif // ifndef _C_PRIVATE_TYPES_H_ diff --git a/src/c-wrapper/c-tools.h b/src/c-wrapper/c-tools.h index 8a30c1e77..ce811af34 100644 --- a/src/c-wrapper/c-tools.h +++ b/src/c-wrapper/c-tools.h @@ -40,6 +40,7 @@ private: template struct WrappedClonableObject { belle_sip_object_t base; + void *userData; T *cppPtr; }; @@ -101,6 +102,16 @@ public: static_cast *>(object)->cppPtr = cppPtr; } + template + static inline void setCppPtrFromC (void *object, T *cppPtr) { + L_ASSERT(object); + T *tPtr = reinterpret_cast(static_cast *>(object)->cppPtr); + if (tPtr != cppPtr) { + delete tPtr; + static_cast *>(object)->cppPtr = new T(*cppPtr); + } + } + template static T *getCppPtr (const std::shared_ptr &cppPtr) { return cppPtr.get(); @@ -173,24 +184,25 @@ LINPHONE_END_NAMESPACE FALSE \ ); -#define L_DECLARE_C_CLONABLE_STRUCT_IMPL(STRUCT, C_NAME) \ - struct _Linphone ## STRUCT { \ +#define L_DECLARE_C_CLONABLE_STRUCT_IMPL(CPP_CLASS, C_STRUCT, C_NAME) \ + struct _Linphone ## C_STRUCT { \ belle_sip_object_t base; \ - LINPHONE_NAMESPACE::STRUCT *cppPtr; \ + void *userData; \ + LINPHONE_NAMESPACE::CPP_CLASS *cppPtr; \ }; \ - BELLE_SIP_DECLARE_VPTR_NO_EXPORT(Linphone ## STRUCT); \ - static Linphone ## STRUCT *_linphone_ ## C_NAME ## _init() { \ - return belle_sip_object_new(Linphone ## STRUCT); \ + BELLE_SIP_DECLARE_VPTR_NO_EXPORT(Linphone ## C_STRUCT); \ + static Linphone ## C_STRUCT *_linphone_ ## C_NAME ## _init() { \ + return belle_sip_object_new(Linphone ## C_STRUCT); \ } \ - static void _linphone_ ## C_NAME ## _uninit(Linphone ## STRUCT * object) { \ + static void _linphone_ ## C_NAME ## _uninit(Linphone ## C_STRUCT * object) { \ delete object->cppPtr; \ } \ - static void _linphone_ ## C_NAME ## _clone(Linphone ## STRUCT * dest, const Linphone ## STRUCT * src) { \ + static void _linphone_ ## C_NAME ## _clone(Linphone ## C_STRUCT * dest, const Linphone ## C_STRUCT * src) { \ L_ASSERT(src->cppPtr); \ - dest->cppPtr = new LINPHONE_NAMESPACE::STRUCT(*src->cppPtr); \ + dest->cppPtr = new LINPHONE_NAMESPACE::CPP_CLASS(*src->cppPtr); \ } \ - BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(Linphone ## STRUCT); \ - BELLE_SIP_INSTANCIATE_VPTR(Linphone ## STRUCT, belle_sip_object_t, \ + BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(Linphone ## C_STRUCT); \ + BELLE_SIP_INSTANCIATE_VPTR(Linphone ## C_STRUCT, belle_sip_object_t, \ _linphone_ ## C_NAME ## _uninit, \ _linphone_ ## C_NAME ## _clone, \ NULL, \ @@ -207,8 +219,8 @@ LINPHONE_END_NAMESPACE #define L_STRING_TO_C(STR) ((STR).empty() ? NULL : (STR).c_str()) #define L_C_TO_STRING(STR) ((STR) == NULL ? std::string() : (STR)) -#define L_GET_CPP_PTR_FROM_C_STRUCT(OBJECT, TYPE) \ - LINPHONE_NAMESPACE::Wrapper::getCppPtrFromC(OBJECT) +#define L_GET_CPP_PTR_FROM_C_STRUCT(OBJECT, CPP_TYPE, C_TYPE) \ + LINPHONE_NAMESPACE::Wrapper::getCppPtrFromC(OBJECT) #define L_SET_CPP_PTR_FROM_C_STRUCT(OBJECT, CPP_PTR) \ LINPHONE_NAMESPACE::Wrapper::setCppPtrFromC(OBJECT, CPP_PTR) @@ -216,9 +228,9 @@ LINPHONE_END_NAMESPACE #define L_GET_PRIVATE(OBJECT) \ LINPHONE_NAMESPACE::Wrapper::getPrivate(OBJECT) -#define L_GET_PRIVATE_FROM_C_STRUCT(OBJECT, TYPE) \ +#define L_GET_PRIVATE_FROM_C_STRUCT(OBJECT, CPP_TYPE, C_TYPE) \ L_GET_PRIVATE(LINPHONE_NAMESPACE::Wrapper::getCppPtr( \ - L_GET_CPP_PTR_FROM_C_STRUCT(OBJECT, TYPE) \ + L_GET_CPP_PTR_FROM_C_STRUCT(OBJECT, CPP_TYPE, C_TYPE) \ )) #define L_GET_C_LIST_FROM_CPP_LIST(LIST, TYPE) \ diff --git a/src/call/call-p.h b/src/call/call-p.h index 78e7a69de..98b062f74 100644 --- a/src/call/call-p.h +++ b/src/call/call-p.h @@ -39,7 +39,7 @@ LINPHONE_BEGIN_NAMESPACE class CallPrivate : public ObjectPrivate, CallListener { public: CallPrivate (LinphoneCall *call, LinphoneCore *core, LinphoneCallDir direction, const Address &from, const Address &to, - LinphoneProxyConfig *cfg, SalOp *op, const std::shared_ptr msp); + LinphoneProxyConfig *cfg, SalOp *op, const MediaSessionParams *msp); virtual ~CallPrivate (); void initiateIncoming (); diff --git a/src/call/call.cpp b/src/call/call.cpp index e3da64617..d8ee56d40 100644 --- a/src/call/call.cpp +++ b/src/call/call.cpp @@ -35,7 +35,7 @@ LINPHONE_BEGIN_NAMESPACE // ============================================================================= CallPrivate::CallPrivate (LinphoneCall *call, LinphoneCore *core, LinphoneCallDir direction, const Address &from, const Address &to, - LinphoneProxyConfig *cfg, SalOp *op, const shared_ptr msp) : lcall(call), core(core) { + LinphoneProxyConfig *cfg, SalOp *op, const MediaSessionParams *msp) : lcall(call), core(core) { nextVideoFrameDecoded._func = nullptr; nextVideoFrameDecoded._user_data = nullptr; } @@ -189,7 +189,7 @@ void CallPrivate::onResetFirstVideoFrameDecoded () { // ============================================================================= Call::Call (LinphoneCall *call, LinphoneCore *core, LinphoneCallDir direction, const Address &from, const Address &to, - LinphoneProxyConfig *cfg, SalOp *op, const shared_ptr msp) : Object(*new CallPrivate(call, core, direction, from, to, cfg, op, msp)) { + LinphoneProxyConfig *cfg, SalOp *op, const MediaSessionParams *msp) : Object(*new CallPrivate(call, core, direction, from, to, cfg, op, msp)) { L_D(Call); const Address *myAddress = (direction == LinphoneCallIncoming) ? &to : &from; string confType = lp_config_get_string(linphone_core_get_config(core), "misc", "conference_type", "local"); @@ -205,17 +205,17 @@ Call::Call (LinphoneCall *call, LinphoneCore *core, LinphoneCallDir direction, c // ----------------------------------------------------------------------------- -LinphoneStatus Call::accept (const shared_ptr msp) { +LinphoneStatus Call::accept (const MediaSessionParams *msp) { L_D(Call); return static_cast(d->getActiveSession().get())->accept(msp); } -LinphoneStatus Call::acceptEarlyMedia (const std::shared_ptr msp) { +LinphoneStatus Call::acceptEarlyMedia (const MediaSessionParams *msp) { L_D(Call); return static_cast(d->getActiveSession().get())->acceptEarlyMedia(msp); } -LinphoneStatus Call::acceptUpdate (const shared_ptr msp) { +LinphoneStatus Call::acceptUpdate (const MediaSessionParams *msp) { L_D(Call); return static_cast(d->getActiveSession().get())->acceptUpdate(msp); } @@ -270,7 +270,7 @@ LinphoneStatus Call::terminate (const LinphoneErrorInfo *ei) { return d->getActiveSession()->terminate(ei); } -LinphoneStatus Call::update (const std::shared_ptr msp) { +LinphoneStatus Call::update (const MediaSessionParams *msp) { L_D(Call); return static_cast(d->getActiveSession().get())->update(msp); } @@ -342,7 +342,7 @@ LinphoneCore * Call::getCore () const { return d->core; } -const shared_ptr Call::getCurrentParams () const { +const MediaSessionParams * Call::getCurrentParams () const { L_D(const Call); return static_cast(d->getActiveSession().get())->getCurrentParams(); } @@ -392,7 +392,7 @@ void * Call::getNativeVideoWindowId () const { return static_cast(d->getActiveSession().get())->getNativeVideoWindowId(); } -const std::shared_ptr Call::getParams () const { +const MediaSessionParams * Call::getParams () const { L_D(const Call); return static_cast(d->getActiveSession().get())->getMediaParams(); } @@ -427,7 +427,7 @@ string Call::getRemoteContact () const { return d->getActiveSession()->getRemoteContact(); } -const shared_ptr Call::getRemoteParams () const { +const MediaSessionParams * Call::getRemoteParams () const { L_D(const Call); return static_cast(d->getActiveSession().get())->getRemoteParams(); } diff --git a/src/call/call.h b/src/call/call.h index acf2d0c0f..2cb14bf3d 100644 --- a/src/call/call.h +++ b/src/call/call.h @@ -19,8 +19,6 @@ #ifndef _CALL_CALL_H_ #define _CALL_CALL_H_ -#include - #include "linphone/types.h" #include "object/object.h" @@ -42,11 +40,11 @@ class Call : public Object { public: Call (LinphoneCall *call, LinphoneCore *core, LinphoneCallDir direction, const Address &from, const Address &to, - LinphoneProxyConfig *cfg, SalOp *op, const std::shared_ptr msp); + LinphoneProxyConfig *cfg, SalOp *op, const MediaSessionParams *msp); - LinphoneStatus accept (const std::shared_ptr msp = nullptr); - LinphoneStatus acceptEarlyMedia (const std::shared_ptr msp = nullptr); - LinphoneStatus acceptUpdate (const std::shared_ptr msp); + LinphoneStatus accept (const MediaSessionParams *msp = nullptr); + LinphoneStatus acceptEarlyMedia (const MediaSessionParams *msp = nullptr); + LinphoneStatus acceptUpdate (const MediaSessionParams *msp); LinphoneStatus decline (LinphoneReason reason); LinphoneStatus decline (const LinphoneErrorInfo *ei); LinphoneStatus pause (); @@ -57,7 +55,7 @@ public: LinphoneStatus takePreviewSnapshot (const std::string& file); LinphoneStatus takeVideoSnapshot (const std::string& file); LinphoneStatus terminate (const LinphoneErrorInfo *ei = nullptr); - LinphoneStatus update (const std::shared_ptr msp = nullptr); + LinphoneStatus update (const MediaSessionParams *msp = nullptr); void zoomVideo (float zoomFactor, float *cx, float *cy); bool cameraEnabled () const; @@ -72,7 +70,7 @@ public: bool getAuthenticationTokenVerified () const; float getAverageQuality () const; LinphoneCore * getCore () const; - const std::shared_ptr getCurrentParams () const; + const MediaSessionParams * getCurrentParams () const; float getCurrentQuality () const; LinphoneCallDir getDirection () const; int getDuration () const; @@ -82,14 +80,14 @@ public: RtpTransport * getMetaRtpTransport (int streamIndex); float getMicrophoneVolumeGain () const; void * getNativeVideoWindowId () const; - const std::shared_ptr getParams () const; + const MediaSessionParams * getParams () const; float getPlayVolume () const; LinphoneReason getReason () const; float getRecordVolume () const; const Address& getRemoteAddress () const; std::string getRemoteAddressAsString () const; std::string getRemoteContact () const; - const std::shared_ptr getRemoteParams () const; + const MediaSessionParams * getRemoteParams () const; float getSpeakerVolumeGain () const; LinphoneCallState getState () const; LinphoneCallStats * getStats (LinphoneStreamType type) const; diff --git a/src/chat/basic-chat-room.cpp b/src/chat/basic-chat-room.cpp index d59554da5..a83535d03 100644 --- a/src/chat/basic-chat-room.cpp +++ b/src/chat/basic-chat-room.cpp @@ -35,12 +35,12 @@ BasicChatRoom::BasicChatRoom (LinphoneCore *core, const Address &peerAddress) : // ----------------------------------------------------------------------------- -shared_ptr BasicChatRoom::addParticipant (const Address &addr, const shared_ptr params, bool hasMedia) { +shared_ptr BasicChatRoom::addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) { lError() << "addParticipant() is not allowed on a BasicChatRoom"; return nullptr; } -void BasicChatRoom::addParticipants (const list
&addresses, const shared_ptr params, bool hasMedia) { +void BasicChatRoom::addParticipants (const list
&addresses, const CallSessionParams *params, bool hasMedia) { lError() << "addParticipants() is not allowed on a BasicChatRoom"; } diff --git a/src/chat/basic-chat-room.h b/src/chat/basic-chat-room.h index f47341fc7..3c696c67d 100644 --- a/src/chat/basic-chat-room.h +++ b/src/chat/basic-chat-room.h @@ -39,8 +39,8 @@ public: virtual ~BasicChatRoom () = default; /* ConferenceInterface */ - std::shared_ptr addParticipant (const Address &addr, const std::shared_ptr params, bool hasMedia); - void addParticipants (const std::list
&addresses, const std::shared_ptr params, bool hasMedia); + std::shared_ptr addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia); + void addParticipants (const std::list
&addresses, const CallSessionParams *params, bool hasMedia); const std::string& getId () const; int getNbParticipants () const; std::list> getParticipants () const; diff --git a/src/chat/chat-room.cpp b/src/chat/chat-room.cpp index f984adf59..2758244b7 100644 --- a/src/chat/chat-room.cpp +++ b/src/chat/chat-room.cpp @@ -800,7 +800,7 @@ void ChatRoom::sendMessage (LinphoneChatMessage *msg) { if (identity.empty()) { LinphoneProxyConfig *proxy = linphone_core_lookup_known_proxy(d->core, peer); if (proxy) { - identity = L_GET_CPP_PTR_FROM_C_STRUCT(linphone_proxy_config_get_identity_address(proxy), Address)->asString(); + identity = L_GET_CPP_PTR_FROM_C_STRUCT(linphone_proxy_config_get_identity_address(proxy), Address, Address)->asString(); } else { identity = linphone_core_get_primary_contact(d->core); } diff --git a/src/chat/client-group-chat-room.cpp b/src/chat/client-group-chat-room.cpp index 82550087a..47ad6a2e5 100644 --- a/src/chat/client-group-chat-room.cpp +++ b/src/chat/client-group-chat-room.cpp @@ -32,18 +32,25 @@ ClientGroupChatRoomPrivate::ClientGroupChatRoomPrivate (LinphoneCore *core) : Ch ClientGroupChatRoom::ClientGroupChatRoom (LinphoneCore *core, const Address &me, std::list
&addresses) : ChatRoom(*new ChatRoomPrivate(core)), RemoteConference(core, me, nullptr) { + string factoryUri = linphone_core_get_chat_conference_factory_uri(core); + focus = make_shared(factoryUri); + CallSessionParams csp; + shared_ptr session = focus->getPrivate()->createSession(*this, &csp, false, this); + session->configure(LinphoneCallOutgoing, nullptr, nullptr, me, focus->getAddress()); + session->initiateOutgoing(); + session->startInvite(nullptr); // TODO } // ----------------------------------------------------------------------------- -shared_ptr ClientGroupChatRoom::addParticipant (const Address &addr, const shared_ptr params, bool hasMedia) { +shared_ptr ClientGroupChatRoom::addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) { activeParticipant = make_shared(addr); activeParticipant->getPrivate()->createSession(*this, params, hasMedia, this); return activeParticipant; } -void ClientGroupChatRoom::addParticipants (const list
&addresses, const shared_ptr params, bool hasMedia) { +void ClientGroupChatRoom::addParticipants (const list
&addresses, const CallSessionParams *params, bool hasMedia) { // TODO } diff --git a/src/chat/client-group-chat-room.h b/src/chat/client-group-chat-room.h index f19a07326..b32d5951f 100644 --- a/src/chat/client-group-chat-room.h +++ b/src/chat/client-group-chat-room.h @@ -40,8 +40,8 @@ public: public: /* ConferenceInterface */ - std::shared_ptr addParticipant (const Address &addr, const std::shared_ptr params, bool hasMedia); - void addParticipants (const std::list
&addresses, const std::shared_ptr params, bool hasMedia); + std::shared_ptr addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia); + void addParticipants (const std::list
&addresses, const CallSessionParams *params, bool hasMedia); const std::string& getId () const; int getNbParticipants () const; std::list> getParticipants () const; diff --git a/src/chat/real-time-text-chat-room.cpp b/src/chat/real-time-text-chat-room.cpp index 4933b1874..2f352f3d8 100644 --- a/src/chat/real-time-text-chat-room.cpp +++ b/src/chat/real-time-text-chat-room.cpp @@ -140,12 +140,12 @@ LinphoneCall *RealTimeTextChatRoom::getCall () const { // ----------------------------------------------------------------------------- -shared_ptr RealTimeTextChatRoom::addParticipant (const Address &addr, const shared_ptr params, bool hasMedia) { +shared_ptr RealTimeTextChatRoom::addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) { lError() << "addParticipant() is not allowed on a RealTimeTextChatRoom"; return nullptr; } -void RealTimeTextChatRoom::addParticipants (const list
&addresses, const shared_ptr params, bool hasMedia) { +void RealTimeTextChatRoom::addParticipants (const list
&addresses, const CallSessionParams *params, bool hasMedia) { lError() << "addParticipants() is not allowed on a RealTimeTextChatRoom"; } diff --git a/src/chat/real-time-text-chat-room.h b/src/chat/real-time-text-chat-room.h index 3987a8a9b..949691722 100644 --- a/src/chat/real-time-text-chat-room.h +++ b/src/chat/real-time-text-chat-room.h @@ -43,8 +43,8 @@ public: LinphoneCall *getCall () const; /* ConferenceInterface */ - std::shared_ptr addParticipant (const Address &addr, const std::shared_ptr params, bool hasMedia); - void addParticipants (const std::list
&addresses, const std::shared_ptr params, bool hasMedia); + std::shared_ptr addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia); + void addParticipants (const std::list
&addresses, const CallSessionParams *params, bool hasMedia); const std::string& getId () const; int getNbParticipants () const; std::list> getParticipants () const; diff --git a/src/conference/conference-interface.h b/src/conference/conference-interface.h index 85e22ff67..840675c8c 100644 --- a/src/conference/conference-interface.h +++ b/src/conference/conference-interface.h @@ -34,8 +34,8 @@ class ConferenceInterface { public: virtual ~ConferenceInterface() = default; - virtual std::shared_ptr addParticipant (const Address &addr, const std::shared_ptr params, bool hasMedia) = 0; - virtual void addParticipants (const std::list
&addresses, const std::shared_ptr params, bool hasMedia) = 0; + virtual std::shared_ptr addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) = 0; + virtual void addParticipants (const std::list
&addresses, const CallSessionParams *params, bool hasMedia) = 0; virtual const std::string& getId () const = 0; virtual int getNbParticipants () const = 0; virtual std::list> getParticipants () const = 0; diff --git a/src/conference/conference.cpp b/src/conference/conference.cpp index 989713577..1d9e6666c 100644 --- a/src/conference/conference.cpp +++ b/src/conference/conference.cpp @@ -39,13 +39,13 @@ shared_ptr Conference::getActiveParticipant () const { // ----------------------------------------------------------------------------- -shared_ptr Conference::addParticipant (const Address &addr, const shared_ptr params, bool hasMedia) { +shared_ptr Conference::addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) { activeParticipant = make_shared(addr); activeParticipant->getPrivate()->createSession(*this, params, hasMedia, this); return activeParticipant; } -void Conference::addParticipants (const list
&addresses, const shared_ptr params, bool hasMedia) { +void Conference::addParticipants (const list
&addresses, const CallSessionParams *params, bool hasMedia) { // TODO } diff --git a/src/conference/conference.h b/src/conference/conference.h index fc027da6d..6f4886ff0 100644 --- a/src/conference/conference.h +++ b/src/conference/conference.h @@ -50,8 +50,8 @@ public: public: /* ConferenceInterface */ - virtual std::shared_ptr addParticipant (const Address &addr, const std::shared_ptr params, bool hasMedia); - virtual void addParticipants (const std::list
&addresses, const std::shared_ptr params, bool hasMedia); + virtual std::shared_ptr addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia); + virtual void addParticipants (const std::list
&addresses, const CallSessionParams *params, bool hasMedia); virtual const std::string& getId () const; virtual int getNbParticipants () const; virtual std::list> getParticipants () const; diff --git a/src/conference/local-conference.h b/src/conference/local-conference.h index 8b29b3752..7c60f772a 100644 --- a/src/conference/local-conference.h +++ b/src/conference/local-conference.h @@ -28,6 +28,7 @@ LINPHONE_BEGIN_NAMESPACE class LocalConference : public Conference { public: LocalConference (LinphoneCore *core, const Address &myAddress, CallListener *listener = nullptr); + virtual ~LocalConference() = default; private: L_DISABLE_COPY(LocalConference); diff --git a/src/conference/params/media-session-params-p.h b/src/conference/params/media-session-params-p.h index f2ca7ca8c..ece0fb241 100644 --- a/src/conference/params/media-session-params-p.h +++ b/src/conference/params/media-session-params-p.h @@ -27,7 +27,6 @@ // ============================================================================= -extern std::shared_ptr linphone_call_params_get_cpp_obj(const LinphoneCallParams *params); extern LinphoneCallParams * linphone_call_params_new_for_wrapper(void); // ============================================================================= diff --git a/src/conference/participant-p.h b/src/conference/participant-p.h index 8bef6f69e..21f906a07 100644 --- a/src/conference/participant-p.h +++ b/src/conference/participant-p.h @@ -38,7 +38,7 @@ class ParticipantPrivate : public ObjectPrivate { public: virtual ~ParticipantPrivate () = default; - void createSession (const Conference &conference, const std::shared_ptr params, bool hasMedia, CallSessionListener *listener); + std::shared_ptr createSession (const Conference &conference, const CallSessionParams *params, bool hasMedia, CallSessionListener *listener); std::shared_ptr getSession () const; Address addr; diff --git a/src/conference/participant.cpp b/src/conference/participant.cpp index 0739feb25..6bbfd4790 100644 --- a/src/conference/participant.cpp +++ b/src/conference/participant.cpp @@ -29,12 +29,13 @@ LINPHONE_BEGIN_NAMESPACE // ============================================================================= -void ParticipantPrivate::createSession (const Conference &conference, const shared_ptr params, bool hasMedia, CallSessionListener *listener) { - if (hasMedia && (!params || dynamic_cast(params.get()))) { +shared_ptr ParticipantPrivate::createSession (const Conference &conference, const CallSessionParams *params, bool hasMedia, CallSessionListener *listener) { + if (hasMedia && (!params || dynamic_cast(params))) { session = make_shared(conference, params, listener); } else { session = make_shared(conference, params, listener); } + return session; } shared_ptr ParticipantPrivate::getSession () const { diff --git a/src/conference/remote-conference.h b/src/conference/remote-conference.h index 40d9cc387..be1aa8c51 100644 --- a/src/conference/remote-conference.h +++ b/src/conference/remote-conference.h @@ -30,6 +30,9 @@ public: RemoteConference (LinphoneCore *core, const Address &myAddress, CallListener *listener = nullptr); virtual ~RemoteConference() = default; +protected: + std::shared_ptr focus = nullptr; + private: L_DISABLE_COPY(RemoteConference); }; diff --git a/src/conference/session/call-session-p.h b/src/conference/session/call-session-p.h index bca4ed0a3..2c9ed1c79 100644 --- a/src/conference/session/call-session-p.h +++ b/src/conference/session/call-session-p.h @@ -31,7 +31,7 @@ LINPHONE_BEGIN_NAMESPACE class CallSessionPrivate : public ObjectPrivate { public: - CallSessionPrivate (const Conference &conference, const std::shared_ptr params, CallSessionListener *listener); + CallSessionPrivate (const Conference &conference, const CallSessionParams *params, CallSessionListener *listener); virtual ~CallSessionPrivate (); int computeDuration () const; @@ -56,8 +56,8 @@ public: virtual void updating (bool isUpdate); protected: - void accept (const std::shared_ptr params); - virtual LinphoneStatus acceptUpdate (const std::shared_ptr csp, LinphoneCallState nextState, const std::string &stateInfo); + void accept (const CallSessionParams *params); + virtual LinphoneStatus acceptUpdate (const CallSessionParams *csp, LinphoneCallState nextState, const std::string &stateInfo); LinphoneStatus checkForAcceptation () const; virtual void handleIncomingReceivedStateInIncomingNotification (); virtual bool isReadyForInvite () const; @@ -82,9 +82,9 @@ protected: LinphoneCore *core = nullptr; CallSessionListener *listener = nullptr; - std::shared_ptr params = nullptr; - std::shared_ptr currentParams = nullptr; - std::shared_ptr remoteParams = nullptr; + CallSessionParams *params = nullptr; + CallSessionParams *currentParams = nullptr; + CallSessionParams *remoteParams = nullptr; LinphoneCallDir direction = LinphoneCallOutgoing; LinphoneCallState state = LinphoneCallIdle; diff --git a/src/conference/session/call-session.cpp b/src/conference/session/call-session.cpp index 595fc2c70..b87892db8 100644 --- a/src/conference/session/call-session.cpp +++ b/src/conference/session/call-session.cpp @@ -39,16 +39,22 @@ LINPHONE_BEGIN_NAMESPACE // ============================================================================= -CallSessionPrivate::CallSessionPrivate (const Conference &conference, const shared_ptr params, CallSessionListener *listener) +CallSessionPrivate::CallSessionPrivate (const Conference &conference, const CallSessionParams *params, CallSessionListener *listener) : conference(conference), listener(listener) { if (params) - this->params = make_shared(*params.get()); - currentParams = make_shared(); + this->params = new CallSessionParams(*params); + currentParams = new CallSessionParams(); core = conference.getCore(); ei = linphone_error_info_new(); } CallSessionPrivate::~CallSessionPrivate () { + if (currentParams) + delete currentParams; + if (params) + delete params; + if (remoteParams) + delete remoteParams; if (ei) linphone_error_info_unref(ei); if (log) @@ -475,13 +481,13 @@ void CallSessionPrivate::updating (bool isUpdate) { // ----------------------------------------------------------------------------- -void CallSessionPrivate::accept (const shared_ptr params) { +void CallSessionPrivate::accept (const CallSessionParams *params) { L_Q(CallSession); /* Try to be best-effort in giving real local or routable contact address */ setContactOp(); if (params) { - this->params = params; - sal_op_set_sent_custom_header(op, params->getPrivate()->getCustomHeaders()); + this->params = new CallSessionParams(*params); + sal_op_set_sent_custom_header(op, this->params->getPrivate()->getCustomHeaders()); } sal_call_accept(op); @@ -491,7 +497,7 @@ void CallSessionPrivate::accept (const shared_ptr params) { setState(LinphoneCallConnected, "Connected"); } -LinphoneStatus CallSessionPrivate::acceptUpdate (const shared_ptr csp, LinphoneCallState nextState, const string &stateInfo) { +LinphoneStatus CallSessionPrivate::acceptUpdate (const CallSessionParams *csp, LinphoneCallState nextState, const string &stateInfo) { return startAcceptUpdate(nextState, stateInfo); } @@ -672,7 +678,7 @@ void CallSessionPrivate::setContactOp () { SalAddress *salAddress = nullptr; LinphoneAddress *contact = getFixedContact(); if (contact) { - salAddress = const_cast(L_GET_PRIVATE_FROM_C_STRUCT(contact, Address)->getInternalAddress()); + salAddress = const_cast(L_GET_PRIVATE_FROM_C_STRUCT(contact, Address, Address)->getInternalAddress()); sal_address_ref(salAddress); linphone_address_unref(contact); } @@ -742,7 +748,7 @@ LinphoneAddress * CallSessionPrivate::getFixedContact () const { // ============================================================================= -CallSession::CallSession (const Conference &conference, const shared_ptr params, CallSessionListener *listener) +CallSession::CallSession (const Conference &conference, const CallSessionParams *params, CallSessionListener *listener) : Object(*new CallSessionPrivate(conference, params, listener)) { lInfo() << "New CallSession [" << this << "] initialized (LinphoneCore version: " << linphone_core_get_version() << ")"; } @@ -751,7 +757,7 @@ CallSession::CallSession (CallSessionPrivate &p) : Object(p) {} // ----------------------------------------------------------------------------- -LinphoneStatus CallSession::accept (const shared_ptr csp) { +LinphoneStatus CallSession::accept (const CallSessionParams *csp) { L_D(CallSession); LinphoneStatus result = d->checkForAcceptation(); if (result < 0) return result; @@ -759,7 +765,7 @@ LinphoneStatus CallSession::accept (const shared_ptr csp) { return 0; } -LinphoneStatus CallSession::acceptUpdate (const shared_ptr csp) { +LinphoneStatus CallSession::acceptUpdate (const CallSessionParams *csp) { L_D(CallSession); if (d->state != LinphoneCallUpdatedByRemote) { lError() << "CallSession::acceptUpdate(): invalid state " << linphone_call_state_to_string(d->state) << " to call this method"; @@ -798,7 +804,7 @@ void CallSession::configure (LinphoneCallDir direction, LinphoneProxyConfig *cfg if (direction == LinphoneCallOutgoing) { d->startPing(); } else if (direction == LinphoneCallIncoming) { - d->params = make_shared(); + d->params = new CallSessionParams(); d->params->initDefault(d->core); } } @@ -989,13 +995,13 @@ LinphoneStatus CallSession::terminate (const LinphoneErrorInfo *ei) { return 0; } -LinphoneStatus CallSession::update (const shared_ptr csp) { +LinphoneStatus CallSession::update (const CallSessionParams *csp) { L_D(CallSession); LinphoneCallState nextState; LinphoneCallState initialState = d->state; if (!d->isUpdateAllowed(nextState)) return -1; - if (d->currentParams.get() == csp.get()) + if (d->currentParams == csp) lWarning() << "CallSession::update() is given the current params, this is probably not what you intend to do!"; LinphoneStatus result = d->startUpdate(); if (result && (d->state != initialState)) { @@ -1044,7 +1050,7 @@ const Address& CallSession::getRemoteAddress () const { L_D(const CallSession); return *L_GET_CPP_PTR_FROM_C_STRUCT((d->direction == LinphoneCallIncoming) ? linphone_call_log_get_from(d->log) : linphone_call_log_get_to(d->log), - Address); + Address, Address); } string CallSession::getRemoteAddressAsString () const { @@ -1060,14 +1066,14 @@ string CallSession::getRemoteContact () const { return string(); } -const shared_ptr CallSession::getRemoteParams () { +const CallSessionParams * CallSession::getRemoteParams () { L_D(CallSession); if (d->op){ const SalCustomHeader *ch = sal_op_get_recv_custom_header(d->op); if (ch) { /* Instanciate a remote_params only if a SIP message was received before (custom headers indicates this) */ if (!d->remoteParams) - d->remoteParams = make_shared(); + d->remoteParams = new CallSessionParams(); d->remoteParams->getPrivate()->setCustomHeaders(ch); } return d->remoteParams; @@ -1089,7 +1095,7 @@ string CallSession::getRemoteUserAgent () const { return string(); } -shared_ptr CallSession::getCurrentParams () { +CallSessionParams * CallSession::getCurrentParams () { L_D(CallSession); d->updateCurrentParams(); return d->currentParams; @@ -1097,7 +1103,7 @@ shared_ptr CallSession::getCurrentParams () { // ----------------------------------------------------------------------------- -const shared_ptr CallSession::getParams () const { +const CallSessionParams * CallSession::getParams () const { L_D(const CallSession); return d->params; } diff --git a/src/conference/session/call-session.h b/src/conference/session/call-session.h index 89576c970..7e6d5634c 100644 --- a/src/conference/session/call-session.h +++ b/src/conference/session/call-session.h @@ -38,10 +38,10 @@ class CallSession : public Object, public std::enable_shared_from_this params, CallSessionListener *listener); + CallSession (const Conference &conference, const CallSessionParams *params, CallSessionListener *listener); - LinphoneStatus accept (const std::shared_ptr csp = nullptr); - LinphoneStatus acceptUpdate (const std::shared_ptr csp); + LinphoneStatus accept (const CallSessionParams *csp = nullptr); + LinphoneStatus acceptUpdate (const CallSessionParams *csp); virtual void configure (LinphoneCallDir direction, LinphoneProxyConfig *cfg, SalOp *op, const Address &from, const Address &to); LinphoneStatus decline (LinphoneReason reason); LinphoneStatus decline (const LinphoneErrorInfo *ei); @@ -51,19 +51,19 @@ public: virtual void startIncomingNotification (); virtual int startInvite (const Address *destination); LinphoneStatus terminate (const LinphoneErrorInfo *ei = nullptr); - LinphoneStatus update (const std::shared_ptr csp); + LinphoneStatus update (const CallSessionParams *csp); - std::shared_ptr getCurrentParams (); + CallSessionParams *getCurrentParams (); LinphoneCallDir getDirection () const; int getDuration () const; const LinphoneErrorInfo * getErrorInfo () const; LinphoneCallLog * getLog () const; - virtual const std::shared_ptr getParams () const; + virtual const CallSessionParams *getParams () const; LinphoneReason getReason () const; const Address& getRemoteAddress () const; std::string getRemoteAddressAsString () const; std::string getRemoteContact () const; - const std::shared_ptr getRemoteParams (); + const CallSessionParams *getRemoteParams (); LinphoneCallState getState () const; std::string getRemoteUserAgent () const; diff --git a/src/conference/session/media-session-p.h b/src/conference/session/media-session-p.h index a70865307..2207fbdef 100644 --- a/src/conference/session/media-session-p.h +++ b/src/conference/session/media-session-p.h @@ -39,7 +39,7 @@ LINPHONE_BEGIN_NAMESPACE class MediaSessionPrivate : public CallSessionPrivate { public: - MediaSessionPrivate (const Conference &conference, const std::shared_ptr params, CallSessionListener *listener); + MediaSessionPrivate (const Conference &conference, const CallSessionParams *params, CallSessionListener *listener); virtual ~MediaSessionPrivate (); public: @@ -221,8 +221,8 @@ private: void terminate (); void updateCurrentParams (); - void accept (const std::shared_ptr params); - LinphoneStatus acceptUpdate (const std::shared_ptr csp, LinphoneCallState nextState, const std::string &stateInfo); + void accept (const MediaSessionParams *params); + LinphoneStatus acceptUpdate (const CallSessionParams *csp, LinphoneCallState nextState, const std::string &stateInfo); #ifdef VIDEO_ENABLED void videoStreamEventCb (const MSFilter *f, const unsigned int eventId, const void *args); @@ -235,9 +235,9 @@ private: static const std::string ecStateStore; static const int ecStateMaxLen; - std::shared_ptr params = nullptr; - std::shared_ptr currentParams = nullptr; - std::shared_ptr remoteParams = nullptr; + MediaSessionParams *params = nullptr; + MediaSessionParams *currentParams = nullptr; + MediaSessionParams *remoteParams = nullptr; AudioStream *audioStream = nullptr; OrtpEvQueue *audioStreamEvQueue = nullptr; diff --git a/src/conference/session/media-session.cpp b/src/conference/session/media-session.cpp index 72f39635b..6158379de 100644 --- a/src/conference/session/media-session.cpp +++ b/src/conference/session/media-session.cpp @@ -66,11 +66,11 @@ const int MediaSessionPrivate::ecStateMaxLen = 1048576; /* 1Mo */ // ============================================================================= -MediaSessionPrivate::MediaSessionPrivate (const Conference &conference, const shared_ptr params, CallSessionListener *listener) - : CallSessionPrivate(conference, params, listener) { - if (params) - this->params = make_shared(*(reinterpret_cast(params.get()))); - currentParams = make_shared(); +MediaSessionPrivate::MediaSessionPrivate (const Conference &conference, const CallSessionParams *csp, CallSessionListener *listener) + : CallSessionPrivate(conference, csp, listener) { + if (csp) + params = new MediaSessionParams(*(reinterpret_cast(csp))); + currentParams = new MediaSessionParams(); audioStats = linphone_call_stats_ref(linphone_call_stats_new()); initStats(audioStats, LinphoneStreamTypeAudio); @@ -91,6 +91,12 @@ MediaSessionPrivate::MediaSessionPrivate (const Conference &conference, const sh } MediaSessionPrivate::~MediaSessionPrivate () { + if (currentParams) + delete currentParams; + if (params) + delete params; + if (remoteParams) + delete remoteParams; if (audioStats) linphone_call_stats_unref(audioStats); if (videoStats) @@ -317,7 +323,7 @@ bool MediaSessionPrivate::failure () { void MediaSessionPrivate::pausedByRemote () { linphone_core_notify_display_status(core, "We are paused by other party"); - shared_ptr newParams = make_shared(*params.get()); + MediaSessionParams *newParams = new MediaSessionParams(*params); if (lp_config_get_int(linphone_core_get_config(core), "sip", "inactive_video_on_pause", 0)) newParams->setVideoDirection(LinphoneMediaDirectionInactive); acceptUpdate(newParams, LinphoneCallPausedByRemote, "Call paused by remote"); @@ -419,7 +425,7 @@ void MediaSessionPrivate::updating (bool isUpdate) { /* Refresh the local description, but in paused state, we don't change anything. */ if (!rmd && lp_config_get_int(linphone_core_get_config(core), "sip", "sdp_200_ack_follow_video_policy", 0)) { lInfo() << "Applying default policy for offering SDP on CallSession [" << q << "]"; - params = make_shared(); + params = new MediaSessionParams(); params->initDefault(core); } makeLocalMediaDescription(); @@ -747,7 +753,7 @@ void MediaSessionPrivate::fixCallParams (SalMediaDescription *rmd) { */ /*params.getPrivate()->enableImplicitRtcpFb(params.getPrivate()->implicitRtcpFbEnabled() & sal_media_description_has_implicit_avpf(rmd));*/ } - const shared_ptr rcp = q->getRemoteParams(); + const MediaSessionParams *rcp = q->getRemoteParams(); if (rcp) { if (params->audioEnabled() && !rcp->audioEnabled()) { lInfo() << "CallSession [" << q << "]: disabling audio in our call params because the remote doesn't want it"; @@ -1111,8 +1117,8 @@ void MediaSessionPrivate::selectOutgoingIpVersion () { return; } - LinphoneAddress *to = linphone_call_log_get_to_address(log); - if (sal_address_is_ipv6(L_GET_PRIVATE_FROM_C_STRUCT(to, Address)->getInternalAddress())) + const LinphoneAddress *to = linphone_call_log_get_to_address(log); + if (sal_address_is_ipv6(L_GET_PRIVATE_FROM_C_STRUCT(to, Address, Address)->getInternalAddress())) af = AF_INET6; else if (destProxy && destProxy->op) af = sal_op_get_address_family(destProxy->op); @@ -1224,7 +1230,7 @@ void MediaSessionPrivate::makeLocalMediaDescription () { md->nb_streams = (biggestDesc ? biggestDesc->nb_streams : 1); /* Re-check local ip address each time we make a new offer, because it may change in case of network reconnection */ - getLocalIp(*L_GET_CPP_PTR_FROM_C_STRUCT((direction == LinphoneCallOutgoing) ? log->to : log->from, Address)); + getLocalIp(*L_GET_CPP_PTR_FROM_C_STRUCT((direction == LinphoneCallOutgoing) ? log->to : log->from, Address, Address)); strncpy(md->addr, mediaLocalIp.c_str(), sizeof(md->addr)); LinphoneAddress *addr = nullptr; if (destProxy) { @@ -2070,7 +2076,7 @@ void MediaSessionPrivate::handleIceEvents (OrtpEvent *ev) { if (iceAgent->hasCompletedCheckList()) { /* At least one ICE session has succeeded, so perform a call update */ if (iceAgent->isControlling() && q->getCurrentParams()->getPrivate()->getUpdateCallWhenIceCompleted()) { - shared_ptr newParams = make_shared(*params.get()); + MediaSessionParams *newParams = new MediaSessionParams(*params); newParams->getPrivate()->setInternalCallUpdate(true); q->update(newParams); } @@ -3845,9 +3851,9 @@ void MediaSessionPrivate::updateCurrentParams () { // ----------------------------------------------------------------------------- -void MediaSessionPrivate::accept (const shared_ptr params) { - if (params) { - this->params = params; +void MediaSessionPrivate::accept (const MediaSessionParams *csp) { + if (csp) { + params = new MediaSessionParams(*csp); iceAgent->prepare(localDesc, true); makeLocalMediaDescription(); sal_call_set_local_media_description(op, localDesc); @@ -3881,7 +3887,7 @@ void MediaSessionPrivate::accept (const shared_ptr params) { expectMediaInAck = true; } -LinphoneStatus MediaSessionPrivate::acceptUpdate (const shared_ptr csp, LinphoneCallState nextState, const string &stateInfo) { +LinphoneStatus MediaSessionPrivate::acceptUpdate (const CallSessionParams *csp, LinphoneCallState nextState, const string &stateInfo) { L_Q(MediaSession); SalMediaDescription *desc = sal_call_get_remote_media_description(op); bool keepSdpVersion = lp_config_get_int(linphone_core_get_config(core), "sip", "keep_sdp_version", 0); @@ -3893,7 +3899,7 @@ LinphoneStatus MediaSessionPrivate::acceptUpdate (const shared_ptr(*static_cast(csp.get())); + params = new MediaSessionParams(*static_cast(csp)); else { if (!sal_call_is_offerer(op)) { /* Reset call params for multicast because this param is only relevant when offering */ @@ -4006,7 +4012,7 @@ void MediaSessionPrivate::stunAuthRequestedCb (const char *realm, const char *no // ============================================================================= -MediaSession::MediaSession (const Conference &conference, const shared_ptr params, CallSessionListener *listener) +MediaSession::MediaSession (const Conference &conference, const CallSessionParams *params, CallSessionListener *listener) : CallSession(*new MediaSessionPrivate(conference, params, listener)) { L_D(MediaSession); d->iceAgent = new IceAgent(*this); @@ -4014,7 +4020,7 @@ MediaSession::MediaSession (const Conference &conference, const shared_ptr msp) { +LinphoneStatus MediaSession::accept (const MediaSessionParams *msp) { L_D(MediaSession); LinphoneStatus result = d->checkForAcceptation(); if (result < 0) return result; @@ -4043,7 +4049,7 @@ LinphoneStatus MediaSession::accept (const shared_ptr msp) { return 0; } -LinphoneStatus MediaSession::acceptEarlyMedia (const std::shared_ptr msp) { +LinphoneStatus MediaSession::acceptEarlyMedia (const MediaSessionParams *msp) { L_D(MediaSession); if (d->state != LinphoneCallIncomingReceived) { lError() << "Bad state " << linphone_call_state_to_string(d->state) << " for MediaSession::acceptEarlyMedia()"; @@ -4053,7 +4059,7 @@ LinphoneStatus MediaSession::acceptEarlyMedia (const std::shared_ptrsetContactOp(); /* If parameters are passed, update the media description */ if (msp) { - d->params = msp; + d->params = new MediaSessionParams(*msp); d->makeLocalMediaDescription(); sal_call_set_local_media_description(d->op, d->localDesc); sal_op_set_sent_custom_header(d->op, d->params->getPrivate()->getCustomHeaders()); @@ -4066,7 +4072,7 @@ LinphoneStatus MediaSession::acceptEarlyMedia (const std::shared_ptr msp) { +LinphoneStatus MediaSession::acceptUpdate (const MediaSessionParams *msp) { L_D(MediaSession); if (d->expectMediaInAck) { lError() << "MediaSession::acceptUpdate() is not possible during a late offer incoming reINVITE (INVITE without SDP)"; @@ -4102,7 +4108,7 @@ void MediaSession::configure (LinphoneCallDir direction, LinphoneProxyConfig *cf Address cleanedFrom = from; cleanedFrom.clean(); d->getLocalIp(cleanedFrom); - d->params = make_shared(); + d->params = new MediaSessionParams(); d->params->initDefault(d->core); d->initializeParamsAccordingToIncomingCallParams(); SalMediaDescription *md = sal_call_get_remote_media_description(d->op); @@ -4217,7 +4223,7 @@ LinphoneStatus MediaSession::resume () { void MediaSession::sendVfuRequest () { #ifdef VIDEO_ENABLED L_D(MediaSession); - shared_ptr currentParams = getCurrentParams(); + MediaSessionParams *currentParams = getCurrentParams(); if ((currentParams->avpfEnabled() || currentParams->getPrivate()->implicitRtcpFbEnabled()) && d->videoStream && media_stream_get_state(&d->videoStream->ms) == MSStreamStarted) { // || sal_media_description_has_implicit_avpf((const SalMediaDescription *)call->resultdesc) lInfo() << "Request Full Intra Request on CallSession [" << this << "]"; @@ -4302,13 +4308,13 @@ void MediaSession::stopRecording () { d->recordActive = false; } -LinphoneStatus MediaSession::update (const shared_ptr msp) { +LinphoneStatus MediaSession::update (const MediaSessionParams *msp) { L_D(MediaSession); LinphoneCallState nextState; LinphoneCallState initialState = d->state; if (!d->isUpdateAllowed(nextState)) return -1; - if (d->currentParams.get() == msp.get()) + if (d->currentParams == msp) lWarning() << "CallSession::update() is given the current params, this is probably not what you intend to do!"; d->iceAgent->checkSession(IR_Controlling, true); if (d->params) { @@ -4316,7 +4322,7 @@ LinphoneStatus MediaSession::update (const shared_ptr msp) { call->broken = FALSE; #endif d->setState(nextState, "Updating call"); - d->params = msp; + d->params = new MediaSessionParams(*msp); if (d->iceAgent->prepare(d->localDesc, false)) { lInfo() << "Defer CallSession update to gather ICE candidates"; return 0; @@ -4496,7 +4502,7 @@ float MediaSession::getAverageQuality () const { return MediaSessionPrivate::aggregateQualityRatings(audioRating, videoRating); } -shared_ptr MediaSession::getCurrentParams () { +MediaSessionParams * MediaSession::getCurrentParams () { L_D(MediaSession); d->updateCurrentParams(); return d->currentParams; @@ -4513,7 +4519,7 @@ float MediaSession::getCurrentQuality () const { return MediaSessionPrivate::aggregateQualityRatings(audioRating, videoRating); } -const shared_ptr MediaSession::getMediaParams () const { +const MediaSessionParams * MediaSession::getMediaParams () const { L_D(const MediaSession); return d->params; } @@ -4563,7 +4569,7 @@ void * MediaSession::getNativeVideoWindowId () const { return nullptr; } -const shared_ptr MediaSession::getParams () const { +const CallSessionParams * MediaSession::getParams () const { L_D(const MediaSession); return d->params; } @@ -4588,12 +4594,14 @@ float MediaSession::getRecordVolume () const { return LINPHONE_VOLUME_DB_LOWEST; } -const shared_ptr MediaSession::getRemoteParams () { +const MediaSessionParams * MediaSession::getRemoteParams () { L_D(MediaSession); if (d->op){ SalMediaDescription *md = sal_call_get_remote_media_description(d->op); if (md) { - d->remoteParams = make_shared(); + if (d->remoteParams) + delete d->remoteParams; + d->remoteParams = new MediaSessionParams(); unsigned int nbAudioStreams = sal_media_description_nb_active_streams_of_type(md, SalAudio); for (unsigned int i = 0; i < nbAudioStreams; i++) { SalStreamDescription *sd = sal_media_description_get_active_stream_of_type(md, SalAudio, i); @@ -4631,7 +4639,7 @@ const shared_ptr MediaSession::getRemoteParams () { if (ch) { /* Instanciate a remote_params only if a SIP message was received before (custom headers indicates this) */ if (!d->remoteParams) - d->remoteParams = make_shared(); + d->remoteParams = new MediaSessionParams(); d->remoteParams->getPrivate()->setCustomHeaders(ch); } return d->remoteParams; diff --git a/src/conference/session/media-session.h b/src/conference/session/media-session.h index 2d3d1ad10..589bf1e30 100644 --- a/src/conference/session/media-session.h +++ b/src/conference/session/media-session.h @@ -19,8 +19,6 @@ #ifndef _MEDIA_SESSION_H_ #define _MEDIA_SESSION_H_ -#include - #include "call-session.h" #include "conference/params/media-session-params.h" @@ -37,11 +35,11 @@ class MediaSession : public CallSession { friend class IceAgent; public: - MediaSession (const Conference &conference, const std::shared_ptr params, CallSessionListener *listener); + MediaSession (const Conference &conference, const CallSessionParams *params, CallSessionListener *listener); - LinphoneStatus accept (const std::shared_ptr msp = nullptr); - LinphoneStatus acceptEarlyMedia (const std::shared_ptr msp = nullptr); - LinphoneStatus acceptUpdate (const std::shared_ptr msp); + LinphoneStatus accept (const MediaSessionParams *msp = nullptr); + LinphoneStatus acceptEarlyMedia (const MediaSessionParams *msp = nullptr); + LinphoneStatus acceptUpdate (const MediaSessionParams *msp); void configure (LinphoneCallDir direction, LinphoneProxyConfig *cfg, SalOp *op, const Address &from, const Address &to); void initiateIncoming (); bool initiateOutgoing (); @@ -53,7 +51,7 @@ public: int startInvite (const Address *destination); void startRecording (); void stopRecording (); - LinphoneStatus update (const std::shared_ptr msp); + LinphoneStatus update (const MediaSessionParams *msp); void resetFirstVideoFrameDecoded (); LinphoneStatus takePreviewSnapshot (const std::string& file); @@ -71,17 +69,17 @@ public: std::string getAuthenticationToken () const; bool getAuthenticationTokenVerified () const; float getAverageQuality () const; - std::shared_ptr getCurrentParams (); + MediaSessionParams *getCurrentParams (); float getCurrentQuality () const; - const std::shared_ptr getMediaParams () const; + const MediaSessionParams *getMediaParams () const; RtpTransport * getMetaRtcpTransport (int streamIndex); RtpTransport * getMetaRtpTransport (int streamIndex); float getMicrophoneVolumeGain () const; void * getNativeVideoWindowId () const; - const std::shared_ptr getParams () const; + const CallSessionParams *getParams () const; float getPlayVolume () const; float getRecordVolume () const; - const std::shared_ptr getRemoteParams (); + const MediaSessionParams *getRemoteParams (); float getSpeakerVolumeGain () const; LinphoneCallStats * getStats (LinphoneStreamType type) const; int getStreamCount ();