Harald Welte has submitted this change and it was merged.

Change subject: osmo_ortp: Add osmo_rtp_drop_frame API
......................................................................


osmo_ortp: Add osmo_rtp_drop_frame API

This API will be used by osmo-bts to maintain the sampling clock of the
RTP socket whenever a frame should be sent but it is not available, for
instance due to low quality of signal.

Change-Id: Id6099372b6231c0a4b6ea0716f46f5daee7049e1
---
M include/osmocom/trau/osmo_ortp.h
M src/trau/osmo_ortp.c
2 files changed, 23 insertions(+), 0 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmocom/trau/osmo_ortp.h b/include/osmocom/trau/osmo_ortp.h
index 9eb176f..578b1cb 100644
--- a/include/osmocom/trau/osmo_ortp.h
+++ b/include/osmocom/trau/osmo_ortp.h
@@ -76,6 +76,7 @@
 int osmo_rtp_socket_connect(struct osmo_rtp_socket *rs, const char *ip, 
uint16_t port);
 int osmo_rtp_socket_set_pt(struct osmo_rtp_socket *rs, int payload_type);
 int osmo_rtp_socket_free(struct osmo_rtp_socket *rs);
+int osmo_rtp_skipped_frame(struct osmo_rtp_socket *rs, unsigned int duration);
 int osmo_rtp_send_frame(struct osmo_rtp_socket *rs, const uint8_t *payload,
                        unsigned int payload_len, unsigned int duration);
 int osmo_rtp_send_frame_ext(struct osmo_rtp_socket *rs, const uint8_t *payload,
diff --git a/src/trau/osmo_ortp.c b/src/trau/osmo_ortp.c
index b2ee040..c9480ff 100644
--- a/src/trau/osmo_ortp.c
+++ b/src/trau/osmo_ortp.c
@@ -436,6 +436,28 @@
                return osmo_rtp_socket_fdreg(rs);
 }
 
+/*! \brief Increment timestamp on a RTP socket without sending any packet
+ *  \param[in] rs OsmoRTP socket
+ *  \param[in] duration duration in number of RTP clock ticks
+ *
+ * Useful to keep the RTP internal clock up to date if an RTP frame should be
+ * send at a given time but no audio content is available. When next packet is
+ * sent, the receiver will see a different increase on the sequence number and
+ * the timestamp, and it should then take it as a synchronization point. For
+ * that same reason, it is advisable to enable the marker bit on the next RTP
+ * packet to be sent after calling this function.
+ *
+ *  \returns 0 on success, <0 in case of error.
+ */
+int osmo_rtp_skipped_frame(struct osmo_rtp_socket *rs, unsigned int duration)
+{
+       if (rs->flags & OSMO_RTP_F_DISABLED)
+               return 0;
+
+       rs->tx_timestamp += duration;
+       return 0;
+}
+
 /*! \brief Send one RTP frame via a RTP socket
  *  \param[in] rs OsmoRTP socket
  *  \param[in] payload pointer to buffer with RTP payload data

-- 
To view, visit https://gerrit.osmocom.org/3070
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Id6099372b6231c0a4b6ea0716f46f5daee7049e1
Gerrit-PatchSet: 3
Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <[email protected]>
Gerrit-Reviewer: Harald Welte <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <[email protected]>
Gerrit-Reviewer: Pau Espin Pedrol <[email protected]>

Reply via email to