diff --git a/coreapi/tester_utils.cpp b/coreapi/tester_utils.cpp index 600c21bdb..a9896ade8 100644 --- a/coreapi/tester_utils.cpp +++ b/coreapi/tester_utils.cpp @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "tester_utils.h" #include "private.h" +#include "call/call-p.h" #include "chat/chat-room/chat-room.h" #include "core/core.h" #include "c-wrapper/c-wrapper.h" @@ -103,3 +104,7 @@ const bctbx_list_t *linphone_friend_list_get_dirty_friends_to_update(const Linph int linphone_friend_list_get_revision(const LinphoneFriendList *lfl) { return lfl->revision; } + +unsigned int _linphone_call_get_nb_media_starts (const LinphoneCall *call) { + return L_GET_PRIVATE_FROM_C_OBJECT(call)->getMediaStartCount(); +} diff --git a/coreapi/tester_utils.h b/coreapi/tester_utils.h index 32a058161..91a8af3dc 100644 --- a/coreapi/tester_utils.h +++ b/coreapi/tester_utils.h @@ -82,6 +82,7 @@ LINPHONE_PUBLIC LinphoneCallLog *linphone_call_get_log(const LinphoneCall *call) LINPHONE_PUBLIC MediaStream * linphone_call_get_stream(LinphoneCall *call, LinphoneStreamType type); LINPHONE_PUBLIC bool_t linphone_call_get_all_muted(const LinphoneCall *call); LINPHONE_PUBLIC LinphoneProxyConfig * linphone_call_get_dest_proxy(const LinphoneCall *call); +LINPHONE_PUBLIC unsigned int _linphone_call_get_nb_media_starts (const LinphoneCall *call); LINPHONE_PUBLIC void linphone_call_params_set_no_user_consent(LinphoneCallParams *params, bool_t value); LINPHONE_PUBLIC bool_t linphone_call_params_get_update_call_when_ice_completed(const LinphoneCallParams *params); diff --git a/src/call/call-p.h b/src/call/call-p.h index 5d4d87838..2cfe8dabc 100644 --- a/src/call/call-p.h +++ b/src/call/call-p.h @@ -49,6 +49,7 @@ public: LinphoneProxyConfig *getDestProxy () const; IceSession *getIceSession () const; + unsigned int getMediaStartCount () const; MediaStream *getMediaStream (LinphoneStreamType type) const; SalCallOp *getOp () const; void setAudioMuted (bool value); diff --git a/src/call/call.cpp b/src/call/call.cpp index b41bd6d4b..1dfb19eeb 100644 --- a/src/call/call.cpp +++ b/src/call/call.cpp @@ -42,6 +42,10 @@ IceSession *CallPrivate::getIceSession () const { return static_pointer_cast(getActiveSession())->getPrivate()->getIceSession(); } +unsigned int CallPrivate::getMediaStartCount () const { + return static_pointer_cast(getActiveSession())->getPrivate()->getMediaStartCount(); +} + MediaStream *CallPrivate::getMediaStream (LinphoneStreamType type) const { return static_pointer_cast(getActiveSession())->getPrivate()->getMediaStream(type); } diff --git a/src/conference/session/media-session-p.h b/src/conference/session/media-session-p.h index 0514faea2..19f3b0205 100644 --- a/src/conference/session/media-session-p.h +++ b/src/conference/session/media-session-p.h @@ -78,6 +78,7 @@ public: SalMediaDescription *getLocalDesc () const { return localDesc; } + unsigned int getMediaStartCount () const; MediaStream *getMediaStream (LinphoneStreamType type) const; LinphoneNatPolicy *getNatPolicy () const { return natPolicy; } @@ -308,7 +309,7 @@ private: bool authTokenVerified = false; std::string dtlsCertificateFingerprint; - unsigned int nbMediaStarts = 0; + unsigned int mediaStartCount = 0; // Upload bandwidth setting at the time the call is started. Used to detect if it changes during a call. int upBandwidth = 0; diff --git a/src/conference/session/media-session.cpp b/src/conference/session/media-session.cpp index 6d27e967b..7d10394b7 100644 --- a/src/conference/session/media-session.cpp +++ b/src/conference/session/media-session.cpp @@ -896,6 +896,10 @@ OrtpEvQueue * MediaSessionPrivate::getEventQueue (int streamIndex) const { return nullptr; } +unsigned int MediaSessionPrivate::getMediaStartCount () const { + return mediaStartCount; +} + MediaStream * MediaSessionPrivate::getMediaStream (int streamIndex) const { if (streamIndex == mainAudioStreamIndex) return &audioStream->ms; @@ -2775,7 +2779,7 @@ void MediaSessionPrivate::startStreams (LinphoneCallState targetState) { setSymmetricRtp(false); } - nbMediaStarts++; + mediaStartCount++; bool videoWillBeUsed = false; #if defined(VIDEO_ENABLED) const SalStreamDescription *vstream = sal_media_description_find_best_stream(resultDesc, SalVideo); diff --git a/tester/call_single_tester.c b/tester/call_single_tester.c index f0e5dc34e..3d7357e25 100644 --- a/tester/call_single_tester.c +++ b/tester/call_single_tester.c @@ -1530,16 +1530,14 @@ int check_nb_media_starts(LinphoneCoreManager *caller, LinphoneCoreManager *call BC_ASSERT_PTR_NOT_NULL(c2); if (!c1 || !c2) return FALSE; -#if 0 if (c1) { - c1_ret = c1->nb_media_starts == caller_nb_media_starts; - BC_ASSERT_EQUAL(c1->nb_media_starts, caller_nb_media_starts, unsigned int, "%u"); + c1_ret = (_linphone_call_get_nb_media_starts(c1) == caller_nb_media_starts) ? TRUE : FALSE; + BC_ASSERT_EQUAL(_linphone_call_get_nb_media_starts(c1), caller_nb_media_starts, unsigned int, "%u"); } if (c2) { - c2_ret = c2->nb_media_starts == callee_nb_media_starts; - BC_ASSERT_EQUAL(c2->nb_media_starts, callee_nb_media_starts, unsigned int, "%u"); + c2_ret = (_linphone_call_get_nb_media_starts(c2) == callee_nb_media_starts) ? TRUE : FALSE; + BC_ASSERT_EQUAL(_linphone_call_get_nb_media_starts(c2), callee_nb_media_starts, unsigned int, "%u"); } -#endif return c1_ret && c2_ret; }