Fix PATCH stream with same name and src
This commit is contained in:
@@ -57,12 +57,22 @@ func Patch(name string, source string) *Stream {
|
|||||||
if u, err := url.Parse(source); err == nil && u.Scheme == "rtsp" && len(u.Path) > 1 {
|
if u, err := url.Parse(source); err == nil && u.Scheme == "rtsp" && len(u.Path) > 1 {
|
||||||
rtspName := u.Path[1:]
|
rtspName := u.Path[1:]
|
||||||
if stream, ok := streams[rtspName]; ok {
|
if stream, ok := streams[rtspName]; ok {
|
||||||
// link (alias) stream[name] to stream[rtspName]
|
if streams[name] != stream {
|
||||||
|
// link (alias) streams[name] to streams[rtspName]
|
||||||
streams[name] = stream
|
streams[name] = stream
|
||||||
|
}
|
||||||
return stream
|
return stream
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if stream, ok := streams[source]; ok {
|
||||||
|
if name != source {
|
||||||
|
// link (alias) streams[name] to streams[source]
|
||||||
|
streams[name] = stream
|
||||||
|
}
|
||||||
|
return stream
|
||||||
|
}
|
||||||
|
|
||||||
// check if src has supported scheme
|
// check if src has supported scheme
|
||||||
if !HasProducer(source) {
|
if !HasProducer(source) {
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in New Issue
Block a user