[vlc-devel] Patch/request for comment and testing - constructing the upNp playlist

Chris Clayton chris2553 at gmail.com
Wed Oct 9 13:34:10 CEST 2013


Hi,

For a while now, I've wondered why vlc takes so long to build the
initial playlist for
UPnP servers. So I added some diagnostic fprintf()s to
modules/services_discovery/upnp.cpp. The result of this work is the patch below.

What I found is that immediately after the playlist is built through
the ->fetchcontents()
call in MediaServer::parseDeviceDescription(), Callback() is called
with event_type set to
UPNP_EVENT_RECEIVED. I don't know, but I suspect that this event is the server's
response to the call to ->subscribeToContentDirectory() earlier in
::ParseDeviceDescription(). Part of the processing for this event is to call
->fetchcontents() and this means that the playlist is constructed
twice before it is
presented to the user and clickable. In fact, roughly half way through
the time the user
has to wait, there is a quick "flicker" of the playlist, which is
probably caused by the playlist
being deleted in the second call to fetchcontents() before it is reconstructed.

My patch to overcome the long wait is very simple, it just removes the call to
->fetchcontents() from ::ParseDeviceDescription() and relies on the
UPNP_EVENT_RECEIVED
event to construct the playlist. I've tested the patch against
miniDLNA running on
OpenWrt (hosted on a mini-server on my local LAN, BubbleUPnP running
on my Samsung
Galaxy S3 phone, the media server built into my Panasonic Blu-Ray
recorder (model
DMR-BW880), and both miniDLNA and mediatomb hosted on the (linux)
laptop that I am
testing the patched vlc on.

As you would expect, the time taken to construct the playlist is
roughly halved. For
example, the miniDLNA/OpenWrt server hosts 3712 media files, made up
mainly of mp3
music, mp4 video and jpeg photographs. Unpatched, vlc takes 177
seconds to present a
useable playlist, whereas the patched vlc takes only 82 seconds.
(Times taken with a stopwatch,
but the difference is so large that a tiny bit of inaccuracy is not material.)

I plan to test this some more against a box running windows (where I
believe Media
Player can act as a media server)and any other media servers I can get
working on other
computers on my home LAN. I'll report back on that, but thought I'd
submit the patch now for
more knowledgeable developers to comment on.

Regards,

Chris Clayton
--

--- vlc-2.1.0/modules/services_discovery/upnp.cpp~      2013-10-08
05:54:54.751793889 +0100
+++ vlc-2.1.0/modules/services_discovery/upnp.cpp       2013-10-08
05:57:32.623789225 +0100
@@ -579,7 +579,9 @@ void MediaServer::parseDeviceDescription
                                 UPNP_E_SUCCESS )
                         {
                             p_server->setContentDirectoryControlURL( psz_url );
-                            p_server->fetchContents();
+                           // don't fetch contents. The subscription
above causes receipt
+                           // of a upnp event, which triggers
fetching the contents.
+                            //p_server->fetchContents();
                         }

                         free( psz_url );



More information about the vlc-devel mailing list