mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
name confusion Enabled -> Started.
This commit is contained in:
parent
18b6fa0a03
commit
36b7eca43c
@ -16,7 +16,7 @@ type BroadcastStatusPayload struct {
|
||||
func (h *RoomHandler) broadcastStatus(w http.ResponseWriter, r *http.Request) {
|
||||
broadcast := h.capture.Broadcast()
|
||||
utils.HttpSuccess(w, BroadcastStatusPayload{
|
||||
IsActive: broadcast.Enabled(),
|
||||
IsActive: broadcast.Started(),
|
||||
URL: broadcast.Url(),
|
||||
})
|
||||
}
|
||||
@ -33,7 +33,7 @@ func (h *RoomHandler) boradcastStart(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
broadcast := h.capture.Broadcast()
|
||||
if broadcast.Enabled() {
|
||||
if broadcast.Started() {
|
||||
utils.HttpUnprocessableEntity(w, "Server is already broadcasting.")
|
||||
return
|
||||
}
|
||||
@ -46,7 +46,7 @@ func (h *RoomHandler) boradcastStart(w http.ResponseWriter, r *http.Request) {
|
||||
h.sessions.AdminBroadcast(
|
||||
message.BroadcastStatus{
|
||||
Event: event.BORADCAST_STATUS,
|
||||
IsActive: broadcast.Enabled(),
|
||||
IsActive: broadcast.Started(),
|
||||
URL: broadcast.Url(),
|
||||
}, nil)
|
||||
|
||||
@ -55,7 +55,7 @@ func (h *RoomHandler) boradcastStart(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
func (h *RoomHandler) boradcastStop(w http.ResponseWriter, r *http.Request) {
|
||||
broadcast := h.capture.Broadcast()
|
||||
if !broadcast.Enabled() {
|
||||
if !broadcast.Started() {
|
||||
utils.HttpUnprocessableEntity(w, "Server is not broadcasting.")
|
||||
return
|
||||
}
|
||||
@ -65,7 +65,7 @@ func (h *RoomHandler) boradcastStop(w http.ResponseWriter, r *http.Request) {
|
||||
h.sessions.AdminBroadcast(
|
||||
message.BroadcastStatus{
|
||||
Event: event.BORADCAST_STATUS,
|
||||
IsActive: broadcast.Enabled(),
|
||||
IsActive: broadcast.Started(),
|
||||
URL: broadcast.Url(),
|
||||
}, nil)
|
||||
|
||||
|
@ -16,7 +16,7 @@ type BroacastManagerCtx struct {
|
||||
mu sync.Mutex
|
||||
pipelineStr string
|
||||
pipeline *gst.Pipeline
|
||||
enabled bool
|
||||
started bool
|
||||
url string
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@ func broadcastNew(pipelineStr string) *BroacastManagerCtx {
|
||||
return &BroacastManagerCtx{
|
||||
logger: log.With().Str("module", "capture").Str("submodule", "broadcast").Logger(),
|
||||
pipelineStr: pipelineStr,
|
||||
enabled: false,
|
||||
started: false,
|
||||
url: "",
|
||||
}
|
||||
}
|
||||
@ -45,7 +45,7 @@ func (manager *BroacastManagerCtx) Start(url string) error {
|
||||
}
|
||||
|
||||
manager.url = url
|
||||
manager.enabled = true
|
||||
manager.started = true
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -53,12 +53,12 @@ func (manager *BroacastManagerCtx) Stop() {
|
||||
manager.mu.Lock()
|
||||
defer manager.mu.Unlock()
|
||||
|
||||
manager.enabled = false
|
||||
manager.started = false
|
||||
manager.destroyPipeline()
|
||||
}
|
||||
|
||||
func (manager *BroacastManagerCtx) Enabled() bool {
|
||||
return manager.enabled
|
||||
func (manager *BroacastManagerCtx) Started() bool {
|
||||
return manager.started
|
||||
}
|
||||
|
||||
func (manager *BroacastManagerCtx) Url() string {
|
||||
|
@ -70,18 +70,18 @@ func New(desktop types.DesktopManager, config *config.Capture) *CaptureManagerCt
|
||||
}
|
||||
|
||||
func (manager *CaptureManagerCtx) Start() {
|
||||
if manager.broadcast.Enabled() {
|
||||
if manager.broadcast.Started() {
|
||||
if err := manager.broadcast.createPipeline(); err != nil {
|
||||
manager.logger.Panic().Err(err).Msg("unable to create broadcast pipeline")
|
||||
}
|
||||
}
|
||||
|
||||
manager.desktop.OnBeforeScreenSizeChange(func() {
|
||||
if manager.video.Enabled() {
|
||||
if manager.video.Started() {
|
||||
manager.video.destroyPipeline()
|
||||
}
|
||||
|
||||
if manager.broadcast.Enabled() {
|
||||
if manager.broadcast.Started() {
|
||||
manager.broadcast.destroyPipeline()
|
||||
}
|
||||
|
||||
@ -91,13 +91,13 @@ func (manager *CaptureManagerCtx) Start() {
|
||||
})
|
||||
|
||||
manager.desktop.OnAfterScreenSizeChange(func() {
|
||||
if manager.video.Enabled() {
|
||||
if manager.video.Started() {
|
||||
if err := manager.video.createPipeline(); err != nil {
|
||||
manager.logger.Panic().Err(err).Msg("unable to recreate video pipeline")
|
||||
}
|
||||
}
|
||||
|
||||
if manager.broadcast.Enabled() {
|
||||
if manager.broadcast.Started() {
|
||||
if err := manager.broadcast.createPipeline(); err != nil {
|
||||
manager.logger.Panic().Err(err).Msg("unable to recreate broadcast pipeline")
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ type StreamManagerCtx struct {
|
||||
emmiter events.EventEmmiter
|
||||
emitUpdate chan bool
|
||||
emitStop chan bool
|
||||
enabled bool
|
||||
started bool
|
||||
}
|
||||
|
||||
func streamNew(codec codec.RTPCodec, pipelineStr string) *StreamManagerCtx {
|
||||
@ -34,7 +34,7 @@ func streamNew(codec codec.RTPCodec, pipelineStr string) *StreamManagerCtx {
|
||||
emmiter: events.New(),
|
||||
emitUpdate: make(chan bool),
|
||||
emitStop: make(chan bool),
|
||||
enabled: false,
|
||||
started: false,
|
||||
}
|
||||
|
||||
go func() {
|
||||
@ -82,7 +82,7 @@ func (manager *StreamManagerCtx) Start() error {
|
||||
return err
|
||||
}
|
||||
|
||||
manager.enabled = true
|
||||
manager.started = true
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -90,12 +90,12 @@ func (manager *StreamManagerCtx) Stop() {
|
||||
manager.mu.Lock()
|
||||
defer manager.mu.Unlock()
|
||||
|
||||
manager.enabled = false
|
||||
manager.started = false
|
||||
manager.destroyPipeline()
|
||||
}
|
||||
|
||||
func (manager *StreamManagerCtx) Enabled() bool {
|
||||
return manager.enabled
|
||||
func (manager *StreamManagerCtx) Started() bool {
|
||||
return manager.started
|
||||
}
|
||||
|
||||
func (manager *StreamManagerCtx) createPipeline() error {
|
||||
|
@ -11,7 +11,7 @@ type Sample media.Sample
|
||||
type BroadcastManager interface {
|
||||
Start(url string) error
|
||||
Stop()
|
||||
Enabled() bool
|
||||
Started() bool
|
||||
Url() string
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@ type StreamManager interface {
|
||||
|
||||
Start() error
|
||||
Stop()
|
||||
Enabled() bool
|
||||
Started() bool
|
||||
}
|
||||
|
||||
type CaptureManager interface {
|
||||
|
@ -81,7 +81,7 @@ func (h *MessageHandlerCtx) systemAdmin(session types.Session) error {
|
||||
Event: event.SYSTEM_ADMIN,
|
||||
ScreenSizesList: screenSizesList,
|
||||
BroadcastStatus: message.BroadcastStatus{
|
||||
IsActive: broadcast.Enabled(),
|
||||
IsActive: broadcast.Started(),
|
||||
URL: broadcast.Url(),
|
||||
},
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user