rtptwcc: don't assume all PacketInfo->data are buffers

They can also be buffer lists

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1268>
This commit is contained in:
Mathieu Duponchelle 2021-10-29 03:46:25 +02:00
parent b83e85ab67
commit c414f9560a

View file

@ -272,10 +272,27 @@ static guint16
rtp_twcc_manager_set_send_twcc_seqnum (RTPTWCCManager * twcc, rtp_twcc_manager_set_send_twcc_seqnum (RTPTWCCManager * twcc,
RTPPacketInfo * pinfo) RTPPacketInfo * pinfo)
{ {
guint16 seqnum = twcc->send_seqnum++; guint16 first_seqnum = twcc->send_seqnum;
if (GST_IS_BUFFER_LIST (pinfo->data)) {
GstBufferList *list;
guint i = 0;
pinfo->data = gst_buffer_list_make_writable (pinfo->data);
list = GST_BUFFER_LIST (pinfo->data);
for (i = 0; i < gst_buffer_list_length (list); i++) {
GstBuffer *buffer = gst_buffer_list_get_writable (list, i);
_set_twcc_seqnum_data (buffer, twcc->send_ext_id, twcc->send_seqnum++);
}
} else {
pinfo->data = gst_buffer_make_writable (pinfo->data); pinfo->data = gst_buffer_make_writable (pinfo->data);
_set_twcc_seqnum_data (pinfo->data, twcc->send_ext_id, seqnum); _set_twcc_seqnum_data (pinfo->data, twcc->send_ext_id, twcc->send_seqnum++);
return seqnum; }
return first_seqnum;
} }
static gint32 static gint32