[Pkg-voip-commits] [libre] 01/21: ice: Added functions to get selected candidates. (#72)

Jonas Smedegaard dr at jones.dk
Sat Dec 2 22:41:34 UTC 2017


This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag debian/0.5.6-1
in repository libre.

commit dfe0e0176d7a21595aeedc1f06778b72b577bfdf
Author: Joachim Bauch <mail at joachim-bauch.de>
Date:   Wed Sep 6 19:47:58 2017 +0200

    ice: Added functions to get selected candidates. (#72)
    
    * ice: Added functions to get selected candidates.
    
    Also added a function to get the type of a candidate. This can be used when
    sending data to handle relay candidates, where data must be sent through the
    TURN client.
    
    * Forward-declare "ice_cand" before it is used.
---
 include/re_ice.h  |  7 ++++++-
 src/ice/cand.c    |  5 +++++
 src/ice/chklist.c | 37 ++++++++++++++++++++++++++++++++++++-
 3 files changed, 47 insertions(+), 2 deletions(-)

diff --git a/include/re_ice.h b/include/re_ice.h
index aa4a092..6c72856 100644
--- a/include/re_ice.h
+++ b/include/re_ice.h
@@ -55,6 +55,7 @@ enum ice_candpair_state {
 };
 
 struct ice;
+struct ice_cand;
 struct icem;
 struct turnc;
 
@@ -100,6 +101,10 @@ struct list *icem_checkl(const struct icem *icem);
 struct list *icem_validl(const struct icem *icem);
 const struct sa *icem_cand_default(struct icem *icem, unsigned compid);
 const struct sa *icem_selected_laddr(const struct icem *icem, unsigned compid);
+const struct ice_cand *icem_selected_lcand(const struct icem *icem,
+				unsigned compid);
+const struct ice_cand *icem_selected_rcand(const struct icem *icem,
+				unsigned compid);
 void ice_candpair_set_states(struct icem *icem);
 void icem_cand_redund_elim(struct icem *icem);
 int  icem_comps_set_default_cand(struct icem *icem);
@@ -108,7 +113,6 @@ int icem_set_turn_client(struct icem *icem, unsigned compid,
 			 struct turnc *turnc);
 
 
-struct ice_cand;
 bool ice_remotecands_avail(const struct icem *icem);
 int  ice_cand_encode(struct re_printf *pf, const struct ice_cand *cand);
 int  ice_remotecands_encode(struct re_printf *pf, const struct icem *icem);
@@ -119,6 +123,7 @@ int icem_lcand_add(struct icem *icem, struct ice_cand *base,
 		   const struct sa *addr);
 struct ice_cand *icem_lcand_base(struct ice_cand *lcand);
 const struct sa *icem_lcand_addr(const struct ice_cand *cand);
+enum ice_cand_type icem_cand_type(const struct ice_cand *cand);
 
 
 extern const char ice_attr_cand[];
diff --git a/src/ice/cand.c b/src/ice/cand.c
index 3a9d0f7..bbc691c 100644
--- a/src/ice/cand.c
+++ b/src/ice/cand.c
@@ -310,3 +310,8 @@ int icem_cand_print(struct re_printf *pf, const struct ice_cand *cand)
 
 	return err;
 }
+
+enum ice_cand_type icem_cand_type(const struct ice_cand *cand)
+{
+	return cand ? cand->type : (enum ice_cand_type)-1;
+}
diff --git a/src/ice/chklist.c b/src/ice/chklist.c
index 624f3c4..bb2ebc6 100644
--- a/src/ice/chklist.c
+++ b/src/ice/chklist.c
@@ -294,9 +294,44 @@ void icem_checklist_update(struct icem *icem)
  */
 const struct sa *icem_selected_laddr(const struct icem *icem, unsigned compid)
 {
+	const struct ice_cand *cand = icem_selected_lcand(icem, compid);
+	return icem_lcand_addr(cand);
+}
+
+
+/**
+ * Get the Local candidate of the Selected Candidate pair, if available
+ *
+ * @param icem   ICE Media object
+ * @param compid Component ID
+ *
+ * @return Local candidate if available, otherwise NULL
+ */
+const struct ice_cand *icem_selected_lcand(const struct icem *icem,
+		unsigned compid)
+{
+	const struct icem_comp *comp = icem_comp_find(icem, compid);
+	if (!comp || !comp->cp_sel)
+		return NULL;
+
+	return comp->cp_sel->lcand;
+}
+
+
+/**
+ * Get the Remote candidate of the Selected Candidate pair, if available
+ *
+ * @param icem   ICE Media object
+ * @param compid Component ID
+ *
+ * @return Remote candidate if available, otherwise NULL
+ */
+const struct ice_cand *icem_selected_rcand(const struct icem *icem,
+		unsigned compid)
+{
 	const struct icem_comp *comp = icem_comp_find(icem, compid);
 	if (!comp || !comp->cp_sel)
 		return NULL;
 
-	return &comp->cp_sel->lcand->addr;
+	return comp->cp_sel->rcand;
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-voip/libre.git



More information about the Pkg-voip-commits mailing list