diff --git a/bin/arm64/darwin/chatubrate-dvr b/bin/arm64/darwin/chatubrate-dvr index 1fc9cc2..6d376ef 100644 Binary files a/bin/arm64/darwin/chatubrate-dvr and b/bin/arm64/darwin/chatubrate-dvr differ diff --git a/bin/arm64/linux/chatubrate-dvr b/bin/arm64/linux/chatubrate-dvr index d088d6f..ef74a9f 100644 Binary files a/bin/arm64/linux/chatubrate-dvr and b/bin/arm64/linux/chatubrate-dvr differ diff --git a/bin/arm64/windows/chatubrate-dvr b/bin/arm64/windows/chatubrate-dvr index 8dedabf..ff1764f 100644 Binary files a/bin/arm64/windows/chatubrate-dvr and b/bin/arm64/windows/chatubrate-dvr differ diff --git a/chaturbate-dvr b/chaturbate-dvr new file mode 100644 index 0000000..4eedea8 Binary files /dev/null and b/chaturbate-dvr differ diff --git a/main.go b/main.go index 04e9e2a..e4b00f7 100644 --- a/main.go +++ b/main.go @@ -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.