jpegpay: consider header len when calculating payload len
authorOgnyan Tonchev <ognyan@axis.com>
Thu, 20 Mar 2014 14:28:26 +0000 (15:28 +0100)
committerWim Taymans <wtaymans@redhat.com>
Thu, 27 Mar 2014 08:45:20 +0000 (09:45 +0100)
Fixed https://bugzilla.gnome.org/show_bug.cgi?id=726777

gst/rtp/gstrtpjpegpay.c

index 91bd54c..227d8dd 100644 (file)
@@ -813,10 +813,16 @@ gst_rtp_jpeg_pay_handle_buffer (GstRTPBasePayload * basepayload,
   do {
     GstBuffer *outbuf;
     guint8 *payload;
-    guint payload_size = (bytes_left < mtu ? bytes_left : mtu);
+    guint payload_size;
     guint header_size;
     GstBuffer *paybuf;
     GstRTPBuffer rtp = { NULL };
+    guint rtp_header_size = gst_rtp_buffer_calc_header_len (0);
+
+    /* The available room is the packet MTU, minus the RTP header length. */
+    payload_size =
+        (bytes_left < (mtu - rtp_header_size) ? bytes_left :
+        (mtu - rtp_header_size));
 
     header_size = sizeof (jpeg_header) + quant_data_size;
     if (dri_found)