mirror of
https://github.com/AlexxIT/go2rtc.git
synced 2025-10-05 16:26:50 +08:00
Make new stream function public
This commit is contained in:
@@ -15,7 +15,7 @@ type Stream struct {
|
|||||||
consumers []*Consumer
|
consumers []*Consumer
|
||||||
}
|
}
|
||||||
|
|
||||||
func newStream(source interface{}) *Stream {
|
func NewStream(source interface{}) *Stream {
|
||||||
s := new(Stream)
|
s := new(Stream)
|
||||||
|
|
||||||
switch source := source.(type) {
|
switch source := source.(type) {
|
||||||
@@ -28,7 +28,7 @@ func newStream(source interface{}) *Stream {
|
|||||||
s.producers = append(s.producers, prod)
|
s.producers = append(s.producers, prod)
|
||||||
}
|
}
|
||||||
case map[string]interface{}:
|
case map[string]interface{}:
|
||||||
return newStream(source["url"])
|
return NewStream(source["url"])
|
||||||
default:
|
default:
|
||||||
panic("wrong source type")
|
panic("wrong source type")
|
||||||
}
|
}
|
||||||
|
@@ -115,7 +115,7 @@ func TestRouting(t *testing.T) {
|
|||||||
assert.Len(t, cons.Medias, 3)
|
assert.Len(t, cons.Medias, 3)
|
||||||
|
|
||||||
// setup stream with one producer
|
// setup stream with one producer
|
||||||
stream := newStream("fake:")
|
stream := NewStream("fake:")
|
||||||
|
|
||||||
// main check:
|
// main check:
|
||||||
err := stream.AddConsumer(cons)
|
err := stream.AddConsumer(cons)
|
||||||
|
@@ -17,7 +17,7 @@ func Init() {
|
|||||||
log = app.GetLogger("streams")
|
log = app.GetLogger("streams")
|
||||||
|
|
||||||
for name, item := range cfg.Mod {
|
for name, item := range cfg.Mod {
|
||||||
Streams[name] = newStream(item)
|
Streams[name] = NewStream(item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user