Hello Max, Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/3056 to look at the new patch set (#3). sysmo: Allow passing low quality buffers to upper layers We want to always call l1if_tch_rx in order to avoid losing triggering events on the upper layer. With this change, the upper layer will increase correctly seq + ts for RTP. It will then send an RTP packet with only the header and no payload, which is not correct but at least we avoid drifting the RTP clock. Upcoming patch in the series solves this issue. Change-Id: If5df8940fab833eb4e3ed851880b66987d356031 --- M src/osmo-bts-sysmo/l1_if.c M src/osmo-bts-sysmo/l1_if.h M src/osmo-bts-sysmo/tch.c 3 files changed, 20 insertions(+), 13 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/56/3056/3 diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c index f564836..776ec01 100644 --- a/src/osmo-bts-sysmo/l1_if.c +++ b/src/osmo-bts-sysmo/l1_if.c @@ -937,6 +937,7 @@ struct osmo_phsap_prim *l1sap; uint32_t fn; int rc = 0; + bool low_quality = data_ind->measParam.fLinkQuality < btsb->min_qual_norm; chan_nr = chan_nr_by_sapi(&trx->ts[data_ind->u8Tn], data_ind->sapi, data_ind->subCh, data_ind->u8Tn, data_ind->u32Fn); @@ -951,12 +952,6 @@ process_meas_res(trx, chan_nr, fn, data_ind); - if (data_ind->measParam.fLinkQuality < btsb->min_qual_norm - && data_ind->msgUnitParam.u8Size != 0) { - msgb_free(l1p_msg); - return 0; - } - DEBUGP(DL1P, "Rx PH-DATA.ind %s (hL2 %08x): %s", get_value_string(femtobts_l1sapi_names, data_ind->sapi), data_ind->hLayer2, @@ -968,11 +963,20 @@ if (data_ind->sapi == GsmL1_Sapi_TchF || data_ind->sapi == GsmL1_Sapi_TchH) { /* TCH speech frame handling */ - rc = l1if_tch_rx(trx, chan_nr, l1p_msg); + rc = l1if_tch_rx(trx, chan_nr, l1p_msg, low_quality); msgb_free(l1p_msg); return rc; } + /* Discard frames with bad quality payload only after making sure we + * signal upper layers for TCH frames, because it expects to always be + * notified even if the content of the frame is not correct, otherwise + * it losses events and the RTP clock drifts. */ + if (low_quality && data_ind->msgUnitParam.u8Size != 0) { + msgb_free(l1p_msg); + return 0; + } + /* fill L1SAP header */ sap_msg = l1sap_msgb_alloc(data_ind->msgUnitParam.u8Size); l1sap = msgb_l1sap_prim(sap_msg); diff --git a/src/osmo-bts-sysmo/l1_if.h b/src/osmo-bts-sysmo/l1_if.h index 033e7f5..6dd2d60 100644 --- a/src/osmo-bts-sysmo/l1_if.h +++ b/src/osmo-bts-sysmo/l1_if.h @@ -128,7 +128,7 @@ int l1if_tch_encode(struct gsm_lchan *lchan, uint8_t *data, uint8_t *len, const uint8_t *rtp_pl, unsigned int rtp_pl_len, uint32_t fn, bool use_cache, bool marker); -int l1if_tch_rx(struct gsm_bts_trx *trx, uint8_t chan_nr, struct msgb *l1p_msg); +int l1if_tch_rx(struct gsm_bts_trx *trx, uint8_t chan_nr, struct msgb *l1p_msg, bool low_quality); int l1if_tch_fill(struct gsm_lchan *lchan, uint8_t *l1_buffer); struct msgb *gen_empty_tch_msg(struct gsm_lchan *lchan, uint32_t fn); diff --git a/src/osmo-bts-sysmo/tch.c b/src/osmo-bts-sysmo/tch.c index a12b1a7..584499b 100644 --- a/src/osmo-bts-sysmo/tch.c +++ b/src/osmo-bts-sysmo/tch.c @@ -502,7 +502,7 @@ } /*! \brief receive a traffic L1 primitive for a given lchan */ -int l1if_tch_rx(struct gsm_bts_trx *trx, uint8_t chan_nr, struct msgb *l1p_msg) +int l1if_tch_rx(struct gsm_bts_trx *trx, uint8_t chan_nr, struct msgb *l1p_msg, bool low_quality) { GsmL1_Prim_t *l1p = msgb_l1prim(l1p_msg); GsmL1_PhDataInd_t *data_ind = &l1p->u.phDataInd; @@ -513,10 +513,13 @@ if (is_recv_only(lchan->abis_ip.speech_mode)) return -EAGAIN; - if (data_ind->msgUnitParam.u8Size < 1) { - LOGP(DL1C, LOGL_ERROR, "chan_nr %d Rx Payload size 0\n", - chan_nr); - return -EINVAL; + if (low_quality || data_ind->msgUnitParam.u8Size < 1) { + LOGP(DL1C, LOGL_ERROR, "chan_nr %d Rx Payload size %u low_quality %d\n", + chan_nr, data_ind->msgUnitParam.u8Size, low_quality); + + /* Push empty payload to upper layers */ + rmsg = msgb_alloc_headroom(256, 128, "L1C-to-RTP"); + return add_l1sap_header(trx, rmsg, lchan, chan_nr, data_ind->u32Fn); } payload_type = data_ind->msgUnitParam.u8Buffer[0]; -- To view, visit https://gerrit.osmocom.org/3056 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: If5df8940fab833eb4e3ed851880b66987d356031 Gerrit-PatchSet: 3 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Pau Espin Pedrol <pes...@sysmocom.de> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max <msur...@sysmocom.de> Gerrit-Reviewer: Pau Espin Pedrol <pes...@sysmocom.de>