Re: [PATCH] Bug in sending heart-beat / silence frame / jitterbuffer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is variant 1 to fix that issue by directly calling
pjmedia_port_get_frame in conference.c (write_port) after calling
pjmedia_portput_frame to ensure that there are "snychronous" calls of
put- and get-frame.

---
 pjmedia/src/pjmedia/conference.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/pjmedia/src/pjmedia/conference.c
b/pjmedia/src/pjmedia/conference.c
index 2ef65380..42e741d6 100644
--- a/pjmedia/src/pjmedia/conference.c
+++ b/pjmedia/src/pjmedia/conference.c
@@ -214,6 +214,11 @@ struct conf_port
      * Burst and drift are handled by delay buffer.
      */
     pjmedia_delay_buf    *delay_buf;
+
+    /* RX null buffer is a temporary buffer to be used if port is muted or
+     * nobody is transmitting to this port, transmit NULL frame.
+     */
+    pj_int16_t          *rx_null_buf; /**< Rx null
buffer.                    */
 };
 
 
@@ -396,6 +401,10 @@ static pj_status_t create_conf_port( pj_pool_t *pool,
     PJ_ASSERT_RETURN(conf_port->tx_buf, PJ_ENOMEM);
     }
 
+    /* create null frame to store silence frames */
+    conf_port->rx_null_buf = (pj_int16_t*)
+                             pj_pool_alloc(pool,
conf_port->samples_per_frame *
+                                          
sizeof(conf_port->rx_null_buf[0]));
 
     /* Create mix buffer. */
     conf_port->mix_buf = (pj_int32_t*)
@@ -1587,6 +1596,15 @@ static pj_status_t write_port(pjmedia_conf *conf,
struct conf_port *cport,
 
         cport->tx_heart_beat -= cport->samples_per_frame;
         frame.timestamp.u64 += cport->samples_per_frame;
+
+        /* directly call get_frame to have synchron access and avoid
+           JB at full capacity */
+        pjmedia_frame null_frame;
+        pj_bzero(&null_frame, sizeof(null_frame));
+        null_frame.buf = cport->rx_null_buf;
+        null_frame.type = PJMEDIA_FRAME_TYPE_AUDIO;
+        null_frame.size = cport->samples_per_frame * BYTES_PER_SAMPLE;
+        pjmedia_port_get_frame(cport->port, &null_frame);
         }
     }
 
-- 
2.13.7

_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org




[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux