refactor: 优化流订阅处理逻辑

This commit is contained in:
ydajiang
2025-05-14 19:50:12 +08:00
parent 24fc44f9c7
commit 7486fc1491
6 changed files with 58 additions and 59 deletions

View File

@@ -3,7 +3,9 @@ package stream
import (
"encoding/binary"
"fmt"
"github.com/lkmio/avformat/utils"
"net"
"net/url"
"strconv"
)
@@ -63,3 +65,14 @@ func ExecuteSyncEventOnTransStreamPublisher(sourceId string, event func()) bool
return false
}
func SubscribeStream(sink Sink, values url.Values) utils.HookState {
return SubscribeStreamWithRead(sink, values, true)
}
func SubscribeStreamWithRead(sink Sink, values url.Values, ready bool) utils.HookState {
sink.SetReady(ready)
sink.SetUrlValues(values)
_, state := PreparePlaySink(sink)
return state
}