]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/views/shared/video-viewer-stats.ts
Prevent duplicated HLS playlist on transcoding
[github/Chocobozzz/PeerTube.git] / server / lib / views / shared / video-viewer-stats.ts
index 542bd51cfc6a65a5a0c5c052c767c90c2e65925b..39e34fb9095d9c303242beb93e87c3dcb3bc0b28 100644 (file)
@@ -104,7 +104,12 @@ export class VideoViewerStats {
       })
     } else {
       const lastSection = stats.watchSections[stats.watchSections.length - 1]
-      lastSection.end = currentTime
+
+      if (lastSection.start > currentTime) {
+        logger.warn('Invalid end watch section %d. Last start record was at %d.', currentTime, lastSection.start)
+      } else {
+        lastSection.end = currentTime
+      }
     }
 
     stats.watchTime = this.buildWatchTimeFromSections(stats.watchSections)