multiudpsink: check the right size when warning about too large udp packets
authorTim-Philipp Müller <tim.muller@collabora.co.uk>
Wed, 11 Jul 2012 11:28:23 +0000 (12:28 +0100)
committerTim-Philipp Müller <tim.muller@collabora.co.uk>
Wed, 11 Jul 2012 11:31:13 +0000 (12:31 +0100)
What matters is the total size, not the size of any of the
individual memory chunks that make up the packet.

gst/udp/gstmultiudpsink.c

index c80bdda..dee3459 100644 (file)
@@ -468,11 +468,6 @@ gst_multiudpsink_render (GstBaseSink * bsink, GstBuffer * buffer)
     mem = gst_buffer_get_memory (buffer, i);
     gst_memory_map (mem, &map[i], GST_MAP_READ);
 
-    if (map[i].size > UDP_MAX_SIZE) {
-      GST_WARNING ("Attempting to send a UDP packet larger than maximum "
-          "size (%" G_GSIZE_FORMAT " > %d)", map[i].size, UDP_MAX_SIZE);
-    }
-
     vec[i].buffer = map[i].data;
     vec[i].size = map[i].size;
 
@@ -486,6 +481,11 @@ gst_multiudpsink_render (GstBaseSink * bsink, GstBuffer * buffer)
   g_mutex_lock (&sink->client_lock);
   GST_LOG_OBJECT (bsink, "about to send %" G_GSIZE_FORMAT " bytes", size);
 
+  if (size > UDP_MAX_SIZE) {
+    GST_WARNING_OBJECT (bsink, "Attempting to send a UDP packet larger than "
+        "maximum size (%" G_GSIZE_FORMAT " > %d)", size, UDP_MAX_SIZE);
+  }
+
   no_clients = 0;
   num = 0;
   for (clients = sink->clients; clients; clients = g_list_next (clients)) {