[vlc-commits] macosx: don't continue library items that weren't played at all or are too short

Felix Paul Kühne git at videolan.org
Wed Sep 25 21:32:59 CEST 2019


vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Wed Sep 25 21:31:03 2019 +0200| [845cae7b1aaef3310e7b6aeea80c46f064c44d76] | committer: Felix Paul Kühne

macosx: don't continue library items that weren't played at all or are too short

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=845cae7b1aaef3310e7b6aeea80c46f064c44d76
---

 .../macosx/playlist/VLCPlaybackContinuityController.m    | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/modules/gui/macosx/playlist/VLCPlaybackContinuityController.m b/modules/gui/macosx/playlist/VLCPlaybackContinuityController.m
index 7c0049554c..e8de840e63 100644
--- a/modules/gui/macosx/playlist/VLCPlaybackContinuityController.m
+++ b/modules/gui/macosx/playlist/VLCPlaybackContinuityController.m
@@ -31,6 +31,12 @@
 #import "library/VLCInputItem.h"
 #import "library/VLCLibraryDataTypes.h"
 
+static const int64_t MinimumDuration = 3 * 60 * 1000;
+static const float MinimumStorePercent = 0.05;
+static const float MaximumStorePercent = 0.95;
+static const int64_t MinimumStoreTime = 60 * 1000;
+static const int64_t MinimumStoreRemainingTime = 60 * 1000;
+
 @interface VLCPlaybackContinuityController()
 {
     VLCInputItem *_currentInput;
@@ -182,6 +188,10 @@
     float lastPlaybackPosition = libraryMediaItem.lastPlaybackPosition;
     int64_t duration = libraryMediaItem.duration;
 
+    if (lastPlaybackPosition < MinimumStorePercent || duration < MinimumDuration) {
+        return;
+    }
+
     CompletionBlock completionBlock = ^(enum ResumeResult result) {
         if (result == RESUME_RESTART)
             return;
@@ -240,12 +250,6 @@
                                 completionBlock:completionBlock];
 }
 
-static const int64_t MinimumDuration = 3 * 60 * 1000;
-static const float MinimumStorePercent = 0.5;
-static const float MaximumStorePercent = 0.95;
-static const int64_t MinimumStoreTime = 60 * 1000;
-static const int64_t MinimumStoreRemainingTime = 60 * 1000;
-
 BOOL ShouldStorePlaybackPosition(float position, int64_t duration)
 {
     int64_t positionTime = position * duration;



More information about the vlc-commits mailing list