mirror of
https://gitlab.crans.org/nounous/ghostream.git
synced 2025-06-30 04:21:07 +02:00
WebRTC offers multiple quality
This commit is contained in:
@ -10,6 +10,12 @@ import (
|
||||
// Quality holds a specific stream quality.
|
||||
// It makes packages able to subscribe to an incoming stream.
|
||||
type Quality struct {
|
||||
// Type of the quality
|
||||
Name string
|
||||
|
||||
// Source Stream
|
||||
Stream *Stream
|
||||
|
||||
// Incoming data come from this channel
|
||||
Broadcast chan<- []byte
|
||||
|
||||
@ -27,8 +33,9 @@ type Quality struct {
|
||||
WebRtcRemoteSdp chan webrtc.SessionDescription
|
||||
}
|
||||
|
||||
func newQuality() (q *Quality) {
|
||||
q = &Quality{}
|
||||
func newQuality(name string, stream *Stream) (q *Quality) {
|
||||
q = &Quality{Name: name}
|
||||
q.Stream = stream
|
||||
broadcast := make(chan []byte, 1024)
|
||||
q.Broadcast = broadcast
|
||||
q.outputs = make(map[chan []byte]struct{})
|
||||
|
@ -40,7 +40,7 @@ func (s *Stream) CreateQuality(name string) (quality *Quality, err error) {
|
||||
}
|
||||
|
||||
s.lockQualities.Lock()
|
||||
quality = newQuality()
|
||||
quality = newQuality(name, s)
|
||||
s.qualities[name] = quality
|
||||
s.lockQualities.Unlock()
|
||||
return quality, nil
|
||||
|
Reference in New Issue
Block a user