mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-30 13:41:48 +00:00
rtpjpegpay: pre-allocate buffer list of the right size
This commit is contained in:
parent
70bfc35756
commit
ccb7380689
1 changed files with 6 additions and 3 deletions
|
@ -662,6 +662,8 @@ gst_rtp_jpeg_pay_scan_marker (const guint8 * data, guint size, guint * offset)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define RTP_HEADER_LEN 12
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_rtp_jpeg_pay_handle_buffer (GstRTPBasePayload * basepayload,
|
gst_rtp_jpeg_pay_handle_buffer (GstRTPBasePayload * basepayload,
|
||||||
GstBuffer * buffer)
|
GstBuffer * buffer)
|
||||||
|
@ -678,7 +680,7 @@ gst_rtp_jpeg_pay_handle_buffer (GstRTPBasePayload * basepayload,
|
||||||
GstMapInfo map;
|
GstMapInfo map;
|
||||||
guint8 *data;
|
guint8 *data;
|
||||||
gsize size;
|
gsize size;
|
||||||
guint mtu;
|
guint mtu, max_payload_size;
|
||||||
guint bytes_left;
|
guint bytes_left;
|
||||||
guint jpeg_header_size = 0;
|
guint jpeg_header_size = 0;
|
||||||
guint offset;
|
guint offset;
|
||||||
|
@ -802,13 +804,14 @@ gst_rtp_jpeg_pay_handle_buffer (GstRTPBasePayload * basepayload,
|
||||||
|
|
||||||
GST_LOG_OBJECT (pay, "quant_data size %u", quant_data_size);
|
GST_LOG_OBJECT (pay, "quant_data size %u", quant_data_size);
|
||||||
|
|
||||||
list = gst_buffer_list_new ();
|
|
||||||
|
|
||||||
bytes_left = sizeof (jpeg_header) + quant_data_size + size;
|
bytes_left = sizeof (jpeg_header) + quant_data_size + size;
|
||||||
|
|
||||||
if (dri_found)
|
if (dri_found)
|
||||||
bytes_left += sizeof (restart_marker_header);
|
bytes_left += sizeof (restart_marker_header);
|
||||||
|
|
||||||
|
max_payload_size = mtu - (RTP_HEADER_LEN + sizeof (jpeg_header));
|
||||||
|
list = gst_buffer_list_new_sized ((bytes_left / max_payload_size) + 1);
|
||||||
|
|
||||||
frame_done = FALSE;
|
frame_done = FALSE;
|
||||||
do {
|
do {
|
||||||
GstBuffer *outbuf;
|
GstBuffer *outbuf;
|
||||||
|
|
Loading…
Reference in a new issue