Browse Source

iOS: Fix VLCPlaybackController projection checking crash out-of-bounds exception

libVLC 3.0 does not handle correctly multiple video tracks

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
Soomin Lee 8 years ago
parent
commit
0f60f39609
1 changed files with 4 additions and 3 deletions
  1. 4 3
      Sources/VLCPlaybackController.m

+ 4 - 3
Sources/VLCPlaybackController.m

@@ -779,10 +779,11 @@ VLCMediaDelegate>
 
     if (media && currentVideoTrackIndex >= 0) {
         NSArray *tracksInfo = media.tracksInformation;
-        NSDictionary *track = tracksInfo[currentVideoTrackIndex];
 
-        if ([track[VLCMediaTracksInformationType] isEqualToString:VLCMediaTracksInformationTypeVideo]) {
-            return [track[VLCMediaTracksInformationVideoProjection] integerValue];
+        for (NSDictionary *track in tracksInfo) {
+            if ([track[VLCMediaTracksInformationType] isEqualToString:VLCMediaTracksInformationTypeVideo]) {
+                return [track[VLCMediaTracksInformationVideoProjection] integerValue];
+            }
         }
     }
     return -1;