osmux: osmux_xfrm_input(): Propagate error code to inform caller

This way the caller can log or make statistics based on the return code.
All known implementations simply check the return code to be >0, so we
are fine here.

Change-Id: I981cc7e560cd9c792a8a2a219b3612f9834296ce
This commit is contained in:
Pau Espin 2022-09-23 17:42:03 +02:00
parent 2f58903376
commit 3de07cf481
1 changed files with 8 additions and 6 deletions

View File

@ -754,9 +754,11 @@ osmux_batch_add(struct osmux_batch *batch, uint32_t batch_factor, struct msgb *m
* osmux_xfrm_input - add RTP message to OSmux batch
* \param msg: RTP message that you want to batch into one OSmux message
*
* If 0 is returned, this indicates that the message has been batched or that
* an error occured and we have skipped the message. If 1 is returned, you
* have to invoke osmux_xfrm_input_deliver and try again.
* If 0 is returned, this indicates that the message has been batched and the
* msgb is now owned by the osmux layer.
* If negative value is returned, an error occurred and the message has been
* dropped (and freed).
* If 1 is returned, you have to invoke osmux_xfrm_input_deliver and try again.
*
* The function takes care of releasing the messages in case of error and
* when building the batch.
@ -774,14 +776,14 @@ int osmux_xfrm_input(struct osmux_in_handle *h, struct msgb *msg, int ccid)
LOGP(DLMUX, LOGL_NOTICE, "RTP payload too big (%u) for configured batch size (%u)\n",
msg->len, h->batch_size);
msgb_free(msg);
return 0;
return -1;
}
rtph = osmo_rtp_get_hdr(msg);
if (rtph == NULL) {
LOGP(DLMUX, LOGL_NOTICE, "msg not containing an RTP header\n");
msgb_free(msg);
return 0;
return -1;
}
switch(rtph->payload_type) {
@ -805,7 +807,7 @@ int osmux_xfrm_input(struct osmux_in_handle *h, struct msgb *msg, int ccid)
*/
LOGP(DLMUX, LOGL_DEBUG, "Dropping RTP packet instead of adding to batch\n");
msgb_free(msg);
return 0;
return ret;
}
h->stats.input_rtp_msgs++;