Add more logging to createOrUpdate function

It'd be useful to see more of what's going on in here.
This commit is contained in:
Saxon Nelson-Milton 2023-09-17 11:01:22 +00:00
parent 79b0a49994
commit e46ceec991
1 changed files with 4 additions and 0 deletions

View File

@ -399,6 +399,7 @@ func (m *broadcastManager) isActive(ma MAC) bool {
// status field of the broadcast i.e. whether we expect data from a source // status field of the broadcast i.e. whether we expect data from a source
// or write the slate image. // or write the slate image.
func (m *broadcastManager) createOrUpdate(broadcast Broadcast) error { func (m *broadcastManager) createOrUpdate(broadcast Broadcast) error {
m.log.Debug("create or update","mac",broadcast.mac)
m.mu.Lock() m.mu.Lock()
defer m.mu.Unlock() defer m.mu.Unlock()
@ -407,6 +408,7 @@ func (m *broadcastManager) createOrUpdate(broadcast Broadcast) error {
// If there's no old broadcast, we need to create a new revid pipeline. // If there's no old broadcast, we need to create a new revid pipeline.
if !ok { if !ok {
m.log.Debug("no old broadcast, creating new pipeline","mac",broadcast.mac)
var err error var err error
broadcast.rv, err = newRevid(m.log, broadcast.urls) broadcast.rv, err = newRevid(m.log, broadcast.urls)
if err != nil { if err != nil {
@ -418,6 +420,7 @@ func (m *broadcastManager) createOrUpdate(broadcast Broadcast) error {
// If the URLS have changed, we need to update the revid pipeline. // If the URLS have changed, we need to update the revid pipeline.
// We won't enter this if we've just created a new revid pipeline. // We won't enter this if we've just created a new revid pipeline.
if !reflect.DeepEqual(maybeOld.urls, broadcast.urls) { if !reflect.DeepEqual(maybeOld.urls, broadcast.urls) {
m.log.Debug("RTMP URLs have changed, updating pipeline config","mac",broadcast.mac,"old",maybeOld.urls,"new",broadcast.urls)
urls := strings.Join(broadcast.urls, ",") urls := strings.Join(broadcast.urls, ",")
err := maybeOld.rv.Update(map[string]string{"RTMPURL": urls}) err := maybeOld.rv.Update(map[string]string{"RTMPURL": urls})
if err != nil { if err != nil {
@ -429,6 +432,7 @@ func (m *broadcastManager) createOrUpdate(broadcast Broadcast) error {
// i.e. if the status is slate, we need to start writing the slate image. // i.e. if the status is slate, we need to start writing the slate image.
// We won't enter this if we've just created a new revid pipeline. // We won't enter this if we've just created a new revid pipeline.
if maybeOld.status != broadcast.status { if maybeOld.status != broadcast.status {
m.log.Debug("status has changed, starting or stopping slate","mac",broadcast.mac,"old",maybeOld.status,"new",broadcast.status)
switch broadcast.status { switch broadcast.status {
case statusActive, statusPlay, statusCreate: case statusActive, statusPlay, statusCreate:
m.log.Info("updating configuration for mac", "mac", broadcast.mac) m.log.Info("updating configuration for mac", "mac", broadcast.mac)