This commit is contained in:
Yami Odymel 2023-03-09 22:32:38 +08:00
parent 67dc496f6f
commit 96bcf4beea
No known key found for this signature in database
GPG Key ID: 68E469836934DB36
5 changed files with 7 additions and 1 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
chaturbate-dvr Normal file

Binary file not shown.

View File

@ -11,6 +11,7 @@ import (
"regexp"
"strconv"
"strings"
"sync"
"time"
"github.com/TwiN/go-color"
@ -35,6 +36,8 @@ var segmentIndex int
// segmentMap is the map stores temporary video segments, it will be merged into master video file then got deleted.
var segmentMap map[string][]byte = make(map[string][]byte)
var segmentMapLock sync.Mutex
// stripLimit reprsents the maximum Bytes sizes to split the video into chunks.
var stripLimit int
@ -295,8 +298,9 @@ func combineSegment(master *os.File, filename string) {
master.Write(b)
//
log.Printf(infoMergeSegment, index, segmentIndex)
segmentMapLock.Lock()
delete(segmentMap, fmt.Sprintf("./%s/%s~%d.ts", savePath, filename, index))
segmentMapLock.Unlock()
index++
}
}
@ -310,7 +314,9 @@ func fetchSegment(master *os.File, segment *m3u8.MediaSegment, baseURL string, f
return
}
stripQuota -= len(body)
segmentMapLock.Lock()
segmentMap[fmt.Sprintf("./%s/%s~%d.ts", savePath, filename, index)] = body
segmentMapLock.Unlock()
}
// endpoint implements the application main function endpoint.