This avoids the infamous VLC playlist bug whereby the playlist stops if
the current item is deleted. It turns out PulseAudio tends to "update"
a source right after VLC opens it, and then VLC stopped playing almost
as soon as it started.
{
struct device *d = data;
- if (d->sd)
- services_discovery_RemoveItem (d->sd, d->item);
+ services_discovery_RemoveItem (d->sd, d->item);
vlc_gc_decref (d->item);
free (d);
}
}
d->index = info->index;
d->item = item;
- d->sd = NULL;
struct device **dp = tsearch (d, &sys->root, cmpsrc);
if (dp == NULL) /* Out-of-memory */
{
- DestroySource (d);
+ free (d);
+ vlc_gc_decref (item);
return -1;
}
- if (*dp != d) /* Replace existing source */
+ if (*dp != d) /* Update existing source */
{
- DestroySource (*dp);
- *dp = d;
+ free (d);
+ d = *dp;
+ input_item_SetURI (d->item, item->psz_uri);
+ input_item_SetName (d->item, item->psz_name);
+ vlc_gc_decref (item);
+ return 0;
}
char *card;