[xiph-commits] r8214 - icecast/trunk/icecast/src

karl at motherfish-iii.xiph.org karl at motherfish-iii.xiph.org
Wed Nov 17 12:35:36 PST 2004


Author: karl
Date: 2004-11-17 12:35:35 -0800 (Wed, 17 Nov 2004)
New Revision: 8214

Modified:
   icecast/trunk/icecast/src/format_mp3.c
Log:
prevent updated metadata being passed to listeners when the text hasn't
actually changed


Modified: icecast/trunk/icecast/src/format_mp3.c
===================================================================
--- icecast/trunk/icecast/src/format_mp3.c	2004-11-17 16:02:04 UTC (rev 8213)
+++ icecast/trunk/icecast/src/format_mp3.c	2004-11-17 20:35:35 UTC (rev 8214)
@@ -93,8 +93,11 @@
 
     plugin->_state = state;
 
-    meta = refbuf_new (1);
-    memcpy (meta->data, "", 1);
+    /* initial metadata needs to be blank for sending to clients and for
+       comparing with new metadata */
+    meta = refbuf_new (2);
+    memcpy (meta->data, "\0\0", 2);
+    meta->len = 1;
     state->metadata = meta;
     state->interval = ICY_METADATA_INTERVAL;
 
@@ -518,8 +521,9 @@
         bytes -= metadata_remaining;
         memmove (src, src+metadata_remaining, bytes);
 
-        /* assign metadata if it's not 1 byte, as that indicates a change */
-        if (source_mp3->build_metadata_len > 1)
+        /* assign metadata if it's greater than 1 byte, and the text has changed */
+        if (source_mp3->build_metadata_len > 1 &&
+                strcmp (source_mp3->build_metadata+1, source_mp3->metadata->data+1) != 0)
         {
             refbuf_t *meta = refbuf_new (source_mp3->build_metadata_len);
             memcpy (meta->data, source_mp3->build_metadata,



More information about the commits mailing list