refactor: 分离解析推流和转发流

This commit is contained in:
ydajiang
2025-05-14 16:54:43 +08:00
parent 61e152e8ed
commit 24fc44f9c7
20 changed files with 931 additions and 781 deletions

View File

@@ -11,19 +11,20 @@ import (
func PreparePublishSource(source Source, hook bool) (*http.Response, utils.HookState) {
var response *http.Response
if err := SourceManager.Add(source); err != nil {
return nil, utils.HookStateOccupy
}
if hook && AppConfig.Hooks.IsEnablePublishEvent() {
rep, state := HookPublishEvent(source)
if utils.HookStateOK != state {
_, _ = SourceManager.Remove(source.GetID())
return rep, state
}
response = rep
}
if err := SourceManager.Add(source); err != nil {
return nil, utils.HookStateOccupy
}
source.SetCreateTime(time.Now())
urls := GetStreamPlayUrls(source.GetID())