Formerly KrillinAI, VideoTranslation and Dubbing Tool for 120+ Languages. Open-source AI workspace for creators, powered by Codex. Video downloader, video translation, create videos, images, audios, and edits with Agents in one place. For your Social Media like YouTube, TikTok, Instagram, etc.
TypeScript agent-skillscodex-clideskop-appdubbingimage-generationlocalizationskillsttsvideo-editingvideo-generationvideo-transcriptionvideo-translation
chore: remove unnecessary mutex
沈浩a70db46adbbd
diff --git a/internal/service/audio2subtitle.go b/internal/service/audio2subtitle.goindex 2926faa4..6142c4f4 100644--- a/internal/service/audio2subtitle.go+++ b/internal/service/audio2subtitle.go@@ -5,6 +5,8 @@ import ("context""errors""fmt"+ "go.uber.org/zap"+ "golang.org/x/sync/errgroup""krillin-ai/config""krillin-ai/internal/storage""krillin-ai/internal/types"@@ -17,10 +19,6 @@ import ("runtime/debug""strconv""strings"- "sync"-- "go.uber.org/zap"- "golang.org/x/sync/errgroup")// 翻译结果数据结构@@ -260,7 +258,6 @@ func (s Service) audioToSrt(ctx context.Context, stepParam *types.SubtitleTaskSt}// 处理转录和翻译结果- var mu sync.Mutexeg.Go(func() error {stepNum := 0for {@@ -268,21 +265,17 @@ func (s Service) audioToSrt(ctx context.Context, stepParam *types.SubtitleTaskStcase <-ctx.Done():return nilcase transcribedItem := <-transcribedQueue:- mu.Lock()stepNum++// 更新字幕任务信息processPct := uint8(20 + 70*stepNum/len(stepParam.SmallAudios)/2)stepParam.TaskPtr.ProcessPct = processPct- mu.Unlock()// 处理转录结果stepParam.SmallAudios[transcribedItem.Id].TranscriptionData = transcribedItem.Datacase translatedItems := <-translatedQueue:- mu.Lock()stepNum++// 更新字幕任务信息processPct := uint8(20 + 70*stepNum/len(stepParam.SmallAudios)/2)stepParam.TaskPtr.ProcessPct = processPct- mu.Unlock()// 处理翻译结果,保存不带时间戳的原始字幕originNoTsSrtFileName := filepath.Join(stepParam.TaskBasePath, fmt.Sprintf(types.SubtitleTaskSplitSrtNoTimestampFileNamePattern, translatedItems.Id))originNoTsSrtFile, err := os.Create(originNoTsSrtFileName)