瀏覽代碼

UPnP discovery: fix issue with some servers offering different transcoding profiles where we played random file (closes #11, closes #16281)

(cherry picked from commit 9f2256d9b0b26399bd2bb4ec6f6b5b8527601f58)
Felix Paul Kühne 9 年之前
父節點
當前提交
1eb43dc042

+ 6 - 0
NEWS

@@ -1,3 +1,9 @@
+2.7.2:
+------
+* Stability improvements
+* Improved HTTP connectivity
+* Improved UPnP reliability, notably with Twonky
+
 2.7.1:
 ------
 * Stability improvements

+ 8 - 8
SharedSources/ServerBrowsing/UPnP/VLCNetworkServerBrowserUPnP.m

@@ -86,15 +86,17 @@
 
 - (VLCMediaList *)mediaList
 {
-    VLCMediaList *mediaList = [[VLCMediaList alloc] init];
+    NSMutableArray *mediaArray;
     @synchronized(_items) {
         NSUInteger count = _items.count;
+        mediaArray = [NSMutableArray arrayWithCapacity:count];
         for (NSInteger i = count - 1; i >= 0; i--) {
             VLCMedia *media = [_items[i] media];
             if (media)
-                [mediaList addMedia:media];
+                [mediaArray addObject:media];
         }
     }
+    VLCMediaList *mediaList = [[VLCMediaList alloc] initWithArray:mediaArray];
     return mediaList;
 }
 
@@ -247,12 +249,10 @@
                     return YES;
                 return NO;
             }]];
-            if (protocolStrings.count == 1) {
-                _URL = [NSURL URLWithString:[mediaItem uri]];
-            } else if (protocolStrings.count > 1) {
-                // withh multiple playable resources we simulate to be a container
-                _container = YES;
-            }
+            /* FIXME: on some servers, we can have more than 1 protocol string as different transcoding schemes are offered
+             * in previous versions, we offered a selector - maybe re-add? */
+
+            _URL = [NSURL URLWithString:[mediaItem uri]];
         }
     }
     return self;

+ 0 - 4
Sources/LocalNetworkConnectivity/VLCNetworkServerBrowserViewController.m

@@ -105,10 +105,8 @@
     [self update];
 }
 
-
 #pragma mark - server browser item specifics
 
-
 - (void)didSelectItem:(id<VLCNetworkServerBrowserItem>)item index:(NSUInteger)index singlePlayback:(BOOL)singlePlayback
 {
     if (item.isContainer) {
@@ -125,8 +123,6 @@
     }
 }
 
-
-
 #pragma mark - table view data source, for more see super
 
 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section