pjproject: add two patches from Asterisk 16.10.0
authorSebastian Kemper <sebastian_ml@gmx.net>
Thu, 14 May 2020 19:40:03 +0000 (21:40 +0200)
committerSebastian Kemper <sebastian_ml@gmx.net>
Thu, 14 May 2020 19:40:05 +0000 (21:40 +0200)
Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
libs/pjproject/Makefile
libs/pjproject/patches/0040-ICE-Add-callback-for-finding-valid-pair.patch [new file with mode: 0644]
libs/pjproject/patches/0040-brackets-in-via-received-params.patch [new file with mode: 0644]

index 8df3c805fd2dfad885d9c7dd725a051310700d4a..d13272758d5ac5090aeb75148eed739605e1107a 100644 (file)
@@ -11,7 +11,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=pjproject
 PKG_VERSION:=2.9
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 
 PKG_SOURCE:=pjproject-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=https://www.pjsip.org/release/$(PKG_VERSION)
diff --git a/libs/pjproject/patches/0040-ICE-Add-callback-for-finding-valid-pair.patch b/libs/pjproject/patches/0040-ICE-Add-callback-for-finding-valid-pair.patch
new file mode 100644 (file)
index 0000000..062e75e
--- /dev/null
@@ -0,0 +1,84 @@
+From 8b8199180766e3eab6014feaa64ccaedcdc12816 Mon Sep 17 00:00:00 2001
+From: Ben Ford <bford@digium.com>
+Date: Mon, 23 Dec 2019 11:11:13 -0600
+Subject: [PATCH] ICE: Add callback for finding valid pair.
+
+It's possible to start sending as soon as one valid pair is found during
+ICE negotiation. The reason we would want to do this is because it is
+possible for a delay to occur at the start of a call for up to 3 seconds
+until ICE negotiation has actually completed. More information can be
+found here:
+https://bugs.chromium.org/p/chromium/issues/detail?id=1024096
+
+This patch adds a callback once a valid pair is found that applications
+can use to start sending to avoid this scenario. Since only one valid
+pair is needed to start media, we only trigger the callback once.
+---
+ pjnath/include/pjnath/ice_session.h |  9 +++++++++
+ pjnath/src/pjnath/ice_session.c     | 16 ++++++++++++++++
+ 2 files changed, 25 insertions(+)
+
+diff --git a/pjnath/include/pjnath/ice_session.h b/pjnath/include/pjnath/ice_session.h
+index 15f0d04..8971220 100644
+--- a/pjnath/include/pjnath/ice_session.h
++++ b/pjnath/include/pjnath/ice_session.h
+@@ -468,6 +468,14 @@ typedef struct pj_ice_sess_cb
+ {
+     /**
+      * An optional callback that will be called by the ICE session when
++     * a valid pair has been found during ICE negotiation.
++     *
++     * @param ice           The ICE session.
++     */
++    void      (*on_valid_pair)(pj_ice_sess *ice);
++
++    /**
++     * An optional callback that will be called by the ICE session when
+      * ICE negotiation has completed, successfully or with failure.
+      *
+      * @param ice         The ICE session.
+@@ -625,6 +633,7 @@ struct pj_ice_sess
+     pj_bool_t          is_nominating;             /**< Nominating stage   */
+     pj_bool_t          is_complete;               /**< Complete?          */
+     pj_bool_t          is_destroying;             /**< Destroy is called  */
++    pj_bool_t            valid_pair_found;          /**< First pair found   */
+     pj_status_t                ice_status;                /**< Error status.      */
+     pj_timer_entry     timer;                     /**< ICE timer.         */
+     pj_ice_sess_cb     cb;                        /**< Callback.          */
+diff --git a/pjnath/src/pjnath/ice_session.c b/pjnath/src/pjnath/ice_session.c
+index c51dba7..ed4138a 100644
+--- a/pjnath/src/pjnath/ice_session.c
++++ b/pjnath/src/pjnath/ice_session.c
+@@ -418,6 +418,8 @@ PJ_DEF(pj_status_t) pj_ice_sess_create(pj_stun_config *stun_cfg,
+     pj_list_init(&ice->early_check);
++    ice->valid_pair_found = PJ_FALSE;
++
+     /* Done */
+     *p_ice = ice;
+@@ -1348,6 +1350,20 @@ static pj_bool_t on_check_complete(pj_ice_sess *ice,
+            GET_CHECK_ID(&ice->clist, check),
+            (check->nominated ? "  and nominated" : "")));
++      {
++          /* On the first valid pair, we call the callback, if present */
++          if (ice->valid_pair_found == PJ_FALSE) {
++              void (*on_valid_pair)(pj_ice_sess *ice);
++
++              ice->valid_pair_found = PJ_TRUE;
++              on_valid_pair = ice->cb.on_valid_pair;
++
++              if (on_valid_pair) {
++                  (*on_valid_pair)(ice);
++              }
++          }
++      }
++
+     }
+     /* 8.2.  Updating States
+-- 
+2.7.4
+
diff --git a/libs/pjproject/patches/0040-brackets-in-via-received-params.patch b/libs/pjproject/patches/0040-brackets-in-via-received-params.patch
new file mode 100644 (file)
index 0000000..bf96d3d
--- /dev/null
@@ -0,0 +1,40 @@
+From 6324760c2fb0ffeb2e29c6c0a96a33906caa8d5f Mon Sep 17 00:00:00 2001
+From: Sean Bright <sean.bright@gmail.com>
+Date: Thu, 16 Jan 2020 10:46:11 -0500
+Subject: [PATCH] sip_parser.c: Allow brackets in via parameters
+
+From RFC 5118 section 4.5:
+
+  While it would be beneficial if the same non-terminal
+  ("IPv6reference") was used for both the "sent-by" and "via-received"
+  production rules, there has not been a consensus in the working group
+  to that effect.  Thus, the best that can be suggested is that
+  implementations must follow the Robustness Principle [RFC1122] and be
+  liberal in accepting a "received" parameter with or without the
+  delimiting "[" and "]" tokens.  When sending a request,
+  implementations must not put the delimiting "[" and "]" tokens.
+---
+ pjsip/src/pjsip/sip_parser.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/pjsip/src/pjsip/sip_parser.c b/pjsip/src/pjsip/sip_parser.c
+index e01e672fb..4f9c7fca4 100644
+--- a/pjsip/src/pjsip/sip_parser.c
++++ b/pjsip/src/pjsip/sip_parser.c
+@@ -384,11 +384,11 @@ static pj_status_t init_parser()
+     status = pj_cis_dup(&pconst.pjsip_VIA_PARAM_SPEC, &pconst.pjsip_TOKEN_SPEC);
+     PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
+-    pj_cis_add_str(&pconst.pjsip_VIA_PARAM_SPEC, ":");
++    pj_cis_add_str(&pconst.pjsip_VIA_PARAM_SPEC, "[:]");
+     status = pj_cis_dup(&pconst.pjsip_VIA_PARAM_SPEC_ESC, &pconst.pjsip_TOKEN_SPEC_ESC);
+     PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
+-    pj_cis_add_str(&pconst.pjsip_VIA_PARAM_SPEC_ESC, ":");
++    pj_cis_add_str(&pconst.pjsip_VIA_PARAM_SPEC_ESC, "[:]");
+     status = pj_cis_dup(&pconst.pjsip_HOST_SPEC, &pconst.pjsip_ALNUM_SPEC);
+     PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
+-- 
+2.20.1
+