tests/avtp: Fix coverity issues

Fixes sign extension issues, unchecked return values and some constant
expression results.

CID: 1465073, 1465074, 1465075, 1465076, 1465077
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1398>
This commit is contained in:
Ederson de Souza 2020-07-01 09:03:21 -07:00 committed by GStreamer Merge Bot
parent 38d3360edb
commit 8335039ecd
4 changed files with 10 additions and 7 deletions

View file

@ -605,8 +605,8 @@ gst_avtp_cvf_pay_prepare_avtp_packets (GstAvtpCvfPay * avtpcvfpay,
" DTS: %" GST_TIME_FORMAT " AVTP_TS: %" GST_TIME_FORMAT
" H264_TS: %" GST_TIME_FORMAT "\navtp_time: %" G_GUINT64_FORMAT
" h264_time: %" G_GUINT64_FORMAT, GST_TIME_ARGS (h264_time),
GST_TIME_ARGS (avtp_time), GST_TIME_ARGS ((guint32) avtp_time),
GST_TIME_ARGS ((guint32) h264_time), avtp_time, h264_time);
GST_TIME_ARGS (avtp_time), GST_TIME_ARGS (avtp_time & 0xffffffff),
GST_TIME_ARGS (h264_time & 0xffffffff), avtp_time, h264_time);
}
}

View file

@ -106,11 +106,13 @@ set_buffer_tstamps (GstBuffer * buf, GstClockTime avtp_tstamp,
struct avtp_stream_pdu *pdu;
GstMapInfo info;
guint32 type;
gint r;
gst_buffer_map (buf, &info, GST_MAP_WRITE);
pdu = (struct avtp_stream_pdu *) info.data;
avtp_pdu_get ((struct avtp_common_pdu *) pdu, AVTP_FIELD_SUBTYPE, &type);
r = avtp_pdu_get ((struct avtp_common_pdu *) pdu, AVTP_FIELD_SUBTYPE, &type);
g_assert (r == 0);
if (type == AVTP_SUBTYPE_AAF)
avtp_aaf_pdu_set (pdu, AVTP_AAF_FIELD_TIMESTAMP, avtp_tstamp);
else if (type == AVTP_SUBTYPE_CVF) {

View file

@ -112,6 +112,7 @@ set_buffer_tstamps (GstBuffer * buf, struct buffer_tstamps *orig)
struct avtp_stream_pdu *pdu;
GstMapInfo info;
guint32 type;
gint r;
gst_buffer_map (buf, &info, GST_MAP_WRITE);
pdu = (struct avtp_stream_pdu *) info.data;
@ -119,7 +120,8 @@ set_buffer_tstamps (GstBuffer * buf, struct buffer_tstamps *orig)
GST_BUFFER_PTS (buf) = orig->buf_pts;
GST_BUFFER_DTS (buf) = orig->buf_dts;
avtp_pdu_get ((struct avtp_common_pdu *) pdu, AVTP_FIELD_SUBTYPE, &type);
r = avtp_pdu_get ((struct avtp_common_pdu *) pdu, AVTP_FIELD_SUBTYPE, &type);
g_assert (r == 0);
if (type == AVTP_SUBTYPE_AAF)
avtp_aaf_pdu_set (pdu, AVTP_AAF_FIELD_TIMESTAMP, orig->avtp_ts);
else if (type == AVTP_SUBTYPE_CVF) {

View file

@ -64,8 +64,7 @@ nal_size (GstBuffer * buffer)
guint8 nal_size[4];
gst_buffer_extract (buffer, 0, nal_size, 4);
return (nal_size[0] << 24) | (nal_size[1] << 16) | (nal_size[2] << 8) |
nal_size[3];
return GST_READ_UINT32_BE (nal_size);
}
static gsize
@ -88,7 +87,7 @@ fetch_nal (GstBuffer * buffer, gsize * offset)
return NULL;
gst_buffer_extract (buffer, *offset, buf, 4);
nal_size = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3];
nal_size = GST_READ_UINT32_BE (buf);
ret =
gst_buffer_copy_region (buffer, GST_BUFFER_COPY_MEMORY, *offset,