Do not generate a stream key for URL pull ingress (#1993)

This commit is contained in:
Benjamin Pracht
2023-08-24 12:50:05 -07:00
committed by GitHub
parent 8c99a9e307
commit ce418dc6b3
2 changed files with 11 additions and 4 deletions

View File

@@ -139,7 +139,10 @@ func (s *IngressService) CreateIngressWithUrl(ctx context.Context, urlStr string
urlStr = urlObj.String()
}
sk := utils.NewGuid("")
var sk string
if req.InputType != livekit.IngressInput_URL_INPUT {
sk = utils.NewGuid("")
}
info := &livekit.IngressInfo{
IngressId: utils.NewGuid(utils.IngressPrefix),

View File

@@ -514,7 +514,7 @@ func (s *RedisStore) storeIngress(_ context.Context, info *livekit.IngressInfo)
if info.IngressId == "" {
return errors.New("Missing IngressId")
}
if info.StreamKey == "" {
if info.StreamKey == "" && info.InputType != livekit.IngressInput_URL_INPUT {
return errors.New("Missing StreamKey")
}
@@ -543,7 +543,9 @@ func (s *RedisStore) storeIngress(_ context.Context, info *livekit.IngressInfo)
results, err := tx.TxPipelined(s.ctx, func(p redis.Pipeliner) error {
p.HSet(s.ctx, IngressKey, info.IngressId, data)
p.HSet(s.ctx, StreamKeyKey, info.StreamKey, info.IngressId)
if info.StreamKey != "" {
p.HSet(s.ctx, StreamKeyKey, info.StreamKey, info.IngressId)
}
if oldRoom != info.RoomName {
if oldRoom != "" {
@@ -799,7 +801,9 @@ func (s *RedisStore) UpdateIngressState(ctx context.Context, ingressId string, s
func (s *RedisStore) DeleteIngress(_ context.Context, info *livekit.IngressInfo) error {
tx := s.rc.TxPipeline()
tx.SRem(s.ctx, RoomIngressPrefix+info.RoomName, info.IngressId)
tx.HDel(s.ctx, StreamKeyKey, info.IngressId)
if info.StreamKey != "" {
tx.HDel(s.ctx, StreamKeyKey, info.StreamKey)
}
tx.HDel(s.ctx, IngressKey, info.IngressId)
tx.Del(s.ctx, IngressStatePrefix+info.IngressId)
if _, err := tx.Exec(s.ctx); err != nil {