mirror of
https://github.com/Belphemur/CBZOptimizer.git
synced 2025-10-14 04:28:51 +02:00
fix(webp): fix issue with concurrent preparation of encoder.
This commit is contained in:
@@ -4,11 +4,16 @@ import (
|
|||||||
"github.com/belphemur/go-webpbin/v2"
|
"github.com/belphemur/go-webpbin/v2"
|
||||||
"image"
|
"image"
|
||||||
"io"
|
"io"
|
||||||
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
const libwebpVersion = "1.6.0"
|
const libwebpVersion = "1.6.0"
|
||||||
|
|
||||||
|
var prepareMutex sync.Mutex
|
||||||
|
|
||||||
func PrepareEncoder() error {
|
func PrepareEncoder() error {
|
||||||
|
prepareMutex.Lock()
|
||||||
|
defer prepareMutex.Unlock()
|
||||||
webpbin.SetLibVersion(libwebpVersion)
|
webpbin.SetLibVersion(libwebpVersion)
|
||||||
container := webpbin.NewCWebP()
|
container := webpbin.NewCWebP()
|
||||||
return container.BinWrapper.Run()
|
return container.BinWrapper.Run()
|
||||||
|
Reference in New Issue
Block a user