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

Hugo Beauzée-Luyssen hugo at beauzee.fr
Tue Nov 15 13:17:55 CET 2016


On 11/07/2016 12:51 AM, Marc K wrote:
> 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 )
>

Hi,

I'm not sure this is the correct way of doing it.
I agree that 1000 is not enough in many cases, but at the same time, 
fetching all items and returning them all at once sucks. Especially when 
dealing with huge collections.

That being said, "pagination" isn't achievable with the current API set, 
and adding it might fall out of 3.0 scope.

Increasing the search timeout is not related to fetching the elements, 
as it refers to the discovery of UPnP shares IIRC.

Ant other opinion regarding this?



More information about the vlc-devel mailing list