[vlc-devel] [PATCH] upnp: increase limits to allow for larger media collections

Marc K morckx at gmail.com
Mon Nov 7 00:51:40 CET 2016


From: morckx <morckx at gmail.com>

Previous only 1000 discovery results were allowed. This is probably
not enough for even the most modest media collectuion nowadays.
Increase limit to 500000 as, apparently, some servers don't accept "0"
for "no limit".

Also increase the maximum search time to 80s to account for slow
servers.

Signed-off-by: morckx <morckx at gmail.com>
---
 modules/services_discovery/upnp.cpp | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/modules/services_discovery/upnp.cpp b/modules/services_discovery/upnp.cpp
index 75b289f..6ef7ff4 100644
--- a/modules/services_discovery/upnp.cpp
+++ b/modules/services_discovery/upnp.cpp
@@ -24,6 +24,9 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
+#define MAX_SEARCH_TIME 80
+#define MAX_RESULTS "500000"
+
 #include "upnp.hpp"
 
 #include <vlc_access.h>
@@ -202,7 +205,7 @@ SearchThread( void *p_data )
     services_discovery_sys_t *p_sys  = p_sd->p_sys;
 
     /* Search for media servers */
-    int i_res = UpnpSearchAsync( p_sys->p_upnp->handle(), 5,
+    int i_res = UpnpSearchAsync( p_sys->p_upnp->handle(), MAX_SEARCH_TIME,
             MEDIA_SERVER_DEVICE_TYPE, p_sys->p_upnp );
     if( i_res != UPNP_E_SUCCESS )
     {
@@ -211,7 +214,7 @@ SearchThread( void *p_data )
     }
 
     /* Search for Sat Ip servers*/
-    i_res = UpnpSearchAsync( p_sys->p_upnp->handle(), 5,
+    i_res = UpnpSearchAsync( p_sys->p_upnp->handle(), MAX_SEARCH_TIME,
             SATIP_SERVER_DEVICE_TYPE, p_sys->p_upnp );
     if( i_res != UPNP_E_SUCCESS )
         msg_Err( p_sd, "Error sending search request: %s", UpnpGetErrorMessage( i_res ) );
@@ -1187,7 +1190,7 @@ bool MediaServer::fetchContents()
                                       "BrowseDirectChildren",
                                       "*",
                                       // Some servers don't understand "0" as "no-limit"
-                                      "1000", /* RequestedCount */
+                                      MAX_RESULTS, /* RequestedCount */
                                       "" /* SortCriteria */
                                       );
     if ( !p_response )
-- 
2.9.3



More information about the vlc-devel mailing list