mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-22 01:31:03 +00:00
rtph26xpay: silence some maybe-unitialized warnings
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7875>
This commit is contained in:
parent
c7ee7c65ae
commit
1814d7ae11
2 changed files with 70 additions and 76 deletions
|
@ -1404,58 +1404,18 @@ gst_rtp_h264_pay_handle_buffer (GstRTPBasePayload * basepayload,
|
||||||
|
|
||||||
avc = rtph264pay->stream_format == GST_H264_STREAM_FORMAT_AVC;
|
avc = rtph264pay->stream_format == GST_H264_STREAM_FORMAT_AVC;
|
||||||
|
|
||||||
if (avc) {
|
|
||||||
/* In AVC mode, there is no adapter, so nothing to drain */
|
|
||||||
if (draining)
|
|
||||||
return GST_FLOW_OK;
|
|
||||||
} else {
|
|
||||||
if (buffer) {
|
|
||||||
if (!GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT)) {
|
|
||||||
if (gst_adapter_available (rtph264pay->adapter) == 0)
|
|
||||||
rtph264pay->delta_unit = FALSE;
|
|
||||||
else
|
|
||||||
/* This buffer contains a key frame but the adapter isn't empty. So
|
|
||||||
* we'll purge it first by sending a first packet and then the second
|
|
||||||
* one won't have the DELTA_UNIT flag. */
|
|
||||||
delayed_not_delta_unit = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GST_BUFFER_IS_DISCONT (buffer)) {
|
|
||||||
if (gst_adapter_available (rtph264pay->adapter) == 0)
|
|
||||||
rtph264pay->discont = TRUE;
|
|
||||||
else
|
|
||||||
/* This buffer has the DISCONT flag but the adapter isn't empty. So
|
|
||||||
* we'll purge it first by sending a first packet and then the second
|
|
||||||
* one will have the DISCONT flag set. */
|
|
||||||
delayed_discont = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
marker = GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_MARKER);
|
|
||||||
gst_adapter_push (rtph264pay->adapter, buffer);
|
|
||||||
buffer = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* We want to use the first TS used to construct the following NAL */
|
|
||||||
dts = gst_adapter_prev_dts (rtph264pay->adapter, NULL);
|
|
||||||
pts = gst_adapter_prev_pts (rtph264pay->adapter, NULL);
|
|
||||||
|
|
||||||
size = gst_adapter_available (rtph264pay->adapter);
|
|
||||||
/* Nothing to do here if the adapter is empty, e.g. on EOS */
|
|
||||||
if (size == 0)
|
|
||||||
return GST_FLOW_OK;
|
|
||||||
data = gst_adapter_map (rtph264pay->adapter, size);
|
|
||||||
GST_DEBUG_OBJECT (basepayload, "got %" G_GSIZE_FORMAT " bytes", size);
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = GST_FLOW_OK;
|
ret = GST_FLOW_OK;
|
||||||
|
|
||||||
/* now loop over all NAL units and put them in a packet */
|
|
||||||
if (avc) {
|
if (avc) {
|
||||||
GstBufferMemoryMap memory;
|
GstBufferMemoryMap memory;
|
||||||
gsize remaining_buffer_size;
|
gsize remaining_buffer_size;
|
||||||
guint nal_length_size;
|
guint nal_length_size;
|
||||||
gsize offset = 0;
|
gsize offset = 0;
|
||||||
|
|
||||||
|
/* In AVC mode, there is no adapter, so nothing to drain */
|
||||||
|
if (draining)
|
||||||
|
return GST_FLOW_OK;
|
||||||
|
|
||||||
gst_buffer_memory_map (buffer, &memory);
|
gst_buffer_memory_map (buffer, &memory);
|
||||||
remaining_buffer_size = gst_buffer_get_size (buffer);
|
remaining_buffer_size = gst_buffer_get_size (buffer);
|
||||||
|
|
||||||
|
@ -1534,6 +1494,43 @@ gst_rtp_h264_pay_handle_buffer (GstRTPBasePayload * basepayload,
|
||||||
guint next;
|
guint next;
|
||||||
gboolean update = FALSE;
|
gboolean update = FALSE;
|
||||||
|
|
||||||
|
if (buffer) {
|
||||||
|
if (!GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT)) {
|
||||||
|
if (gst_adapter_available (rtph264pay->adapter) == 0)
|
||||||
|
rtph264pay->delta_unit = FALSE;
|
||||||
|
else
|
||||||
|
/* This buffer contains a key frame but the adapter isn't empty. So
|
||||||
|
* we'll purge it first by sending a first packet and then the second
|
||||||
|
* one won't have the DELTA_UNIT flag. */
|
||||||
|
delayed_not_delta_unit = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GST_BUFFER_IS_DISCONT (buffer)) {
|
||||||
|
if (gst_adapter_available (rtph264pay->adapter) == 0)
|
||||||
|
rtph264pay->discont = TRUE;
|
||||||
|
else
|
||||||
|
/* This buffer has the DISCONT flag but the adapter isn't empty. So
|
||||||
|
* we'll purge it first by sending a first packet and then the second
|
||||||
|
* one will have the DISCONT flag set. */
|
||||||
|
delayed_discont = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
marker = GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_MARKER);
|
||||||
|
gst_adapter_push (rtph264pay->adapter, buffer);
|
||||||
|
buffer = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* We want to use the first TS used to construct the following NAL */
|
||||||
|
dts = gst_adapter_prev_dts (rtph264pay->adapter, NULL);
|
||||||
|
pts = gst_adapter_prev_pts (rtph264pay->adapter, NULL);
|
||||||
|
|
||||||
|
size = gst_adapter_available (rtph264pay->adapter);
|
||||||
|
/* Nothing to do here if the adapter is empty, e.g. on EOS */
|
||||||
|
if (size == 0)
|
||||||
|
return GST_FLOW_OK;
|
||||||
|
data = gst_adapter_map (rtph264pay->adapter, size);
|
||||||
|
GST_DEBUG_OBJECT (basepayload, "got %" G_GSIZE_FORMAT " bytes", size);
|
||||||
|
|
||||||
/* get offset of first start code */
|
/* get offset of first start code */
|
||||||
next = next_start_code (data, size);
|
next = next_start_code (data, size);
|
||||||
|
|
||||||
|
|
|
@ -1488,40 +1488,8 @@ gst_rtp_h265_pay_handle_buffer (GstRTPBasePayload * basepayload,
|
||||||
hevc = (rtph265pay->stream_format == GST_H265_STREAM_FORMAT_HEV1)
|
hevc = (rtph265pay->stream_format == GST_H265_STREAM_FORMAT_HEV1)
|
||||||
|| (rtph265pay->stream_format == GST_H265_STREAM_FORMAT_HVC1);
|
|| (rtph265pay->stream_format == GST_H265_STREAM_FORMAT_HVC1);
|
||||||
|
|
||||||
if (hevc) {
|
|
||||||
/* In hevc mode, there is no adapter, so nothing to drain */
|
|
||||||
if (draining)
|
|
||||||
return GST_FLOW_OK;
|
|
||||||
} else {
|
|
||||||
if (buffer) {
|
|
||||||
if (!GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT)) {
|
|
||||||
if (gst_adapter_available (rtph265pay->adapter) == 0)
|
|
||||||
rtph265pay->delta_unit = FALSE;
|
|
||||||
else
|
|
||||||
delayed_not_delta_unit = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
discont = GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DISCONT);
|
|
||||||
marker = GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_MARKER);
|
|
||||||
gst_adapter_push (rtph265pay->adapter, buffer);
|
|
||||||
buffer = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* We want to use the first TS used to construct the following NAL */
|
|
||||||
dts = gst_adapter_prev_dts (rtph265pay->adapter, NULL);
|
|
||||||
pts = gst_adapter_prev_pts (rtph265pay->adapter, NULL);
|
|
||||||
|
|
||||||
size = gst_adapter_available (rtph265pay->adapter);
|
|
||||||
/* Nothing to do here if the adapter is empty, e.g. on EOS */
|
|
||||||
if (size == 0)
|
|
||||||
return GST_FLOW_OK;
|
|
||||||
data = gst_adapter_map (rtph265pay->adapter, size);
|
|
||||||
GST_DEBUG_OBJECT (basepayload, "got %" G_GSIZE_FORMAT " bytes", size);
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = GST_FLOW_OK;
|
ret = GST_FLOW_OK;
|
||||||
|
|
||||||
/* now loop over all NAL units and put them in a packet */
|
|
||||||
if (hevc) {
|
if (hevc) {
|
||||||
GstBufferMemoryMap memory;
|
GstBufferMemoryMap memory;
|
||||||
gsize remaining_buffer_size;
|
gsize remaining_buffer_size;
|
||||||
|
@ -1529,6 +1497,10 @@ gst_rtp_h265_pay_handle_buffer (GstRTPBasePayload * basepayload,
|
||||||
gsize offset = 0;
|
gsize offset = 0;
|
||||||
GPtrArray *paybufs;
|
GPtrArray *paybufs;
|
||||||
|
|
||||||
|
/* In hevc mode, there is no adapter, so nothing to drain */
|
||||||
|
if (draining)
|
||||||
|
return GST_FLOW_OK;
|
||||||
|
|
||||||
paybufs = g_ptr_array_new ();
|
paybufs = g_ptr_array_new ();
|
||||||
nal_length_size = rtph265pay->nal_length_size;
|
nal_length_size = rtph265pay->nal_length_size;
|
||||||
|
|
||||||
|
@ -1609,6 +1581,31 @@ gst_rtp_h265_pay_handle_buffer (GstRTPBasePayload * basepayload,
|
||||||
gboolean update = FALSE;
|
gboolean update = FALSE;
|
||||||
GPtrArray *paybufs;
|
GPtrArray *paybufs;
|
||||||
|
|
||||||
|
if (buffer) {
|
||||||
|
if (!GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT)) {
|
||||||
|
if (gst_adapter_available (rtph265pay->adapter) == 0)
|
||||||
|
rtph265pay->delta_unit = FALSE;
|
||||||
|
else
|
||||||
|
delayed_not_delta_unit = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
discont = GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DISCONT);
|
||||||
|
marker = GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_MARKER);
|
||||||
|
gst_adapter_push (rtph265pay->adapter, buffer);
|
||||||
|
buffer = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* We want to use the first TS used to construct the following NAL */
|
||||||
|
dts = gst_adapter_prev_dts (rtph265pay->adapter, NULL);
|
||||||
|
pts = gst_adapter_prev_pts (rtph265pay->adapter, NULL);
|
||||||
|
|
||||||
|
size = gst_adapter_available (rtph265pay->adapter);
|
||||||
|
/* Nothing to do here if the adapter is empty, e.g. on EOS */
|
||||||
|
if (size == 0)
|
||||||
|
return GST_FLOW_OK;
|
||||||
|
data = gst_adapter_map (rtph265pay->adapter, size);
|
||||||
|
GST_DEBUG_OBJECT (basepayload, "got %" G_GSIZE_FORMAT " bytes", size);
|
||||||
|
|
||||||
/* get offset of first start code */
|
/* get offset of first start code */
|
||||||
next = next_start_code (data, size);
|
next = next_start_code (data, size);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue