func (s *server) process(addr, pid, sid, tid, eid string, config []byte) error {
	s.mu.Lock()
	defer s.mu.Unlock()

	c := s.clients[addr]
	// no client yet, create one
	if c == nil {
		var err error
		log.Infof("create a sfu client, addr=%s", addr)
		if c, err = newSFU(addr, s.config, s.nid, s.nrpc); err != nil {
			return err
		}
		c.onClose(func() {
			s.mu.Lock()
			defer s.mu.Unlock()
			log.Infof("sfu client close, addr=%s", addr)
			delete(s.clients, addr)
		})
		s.clients[addr] = c
	} else {
		log.Infof("sfu client exist, addr=%s", addr)
	}

	t, err := c.getTransport(proto.SID(sid))
	if err != nil {
		return err
	}

	return t.Process(pid, tid, eid, config)
}
// process starts a process for a track.
process starts a process for a track.
// process starts a process for a track .
func (s *server) process(addr, pid, sid, tid, eid string, config []byte) error {
	s.mu.Lock()
	defer s.mu.Unlock()
	c := s.clients[addr]
	if c == nil {
		var err error
		log.Infof("create a sfu client, addr=%s", addr)
		if c, err = newSFU(addr, s.config, s.nid, s.nrpc); err != nil {
			return err
		}
		c.onClose(func() {
			s.mu.Lock()
			defer s.mu.Unlock()
			log.Infof("sfu client close, addr=%s", addr)
			delete(s.clients, addr)
		})
		s.clients[addr] = c
	} else {
		log.Infof("sfu client exist, addr=%s", addr)
	}
	t, err := c.getTransport(proto.SID(sid))
	if err != nil {
		return err
	}
	return t.Process(pid, tid, eid, config)
}
func ( s * server ) process ( addr , pid , sid , tid , eid string , config [ ] byte ) error { s . mu . Lock ( ) defer s . mu . Unlock ( ) c := s . clients [ addr ] if c == nil { var err error log . Infof ( " " , addr ) if c , err = newSFU ( addr , s . config , s . nid , s . nrpc ) ; err != nil { return err } c . onClose ( func ( ) { s . mu . Lock ( ) defer s . mu . Unlock ( ) log . Infof ( " " , addr ) delete ( s . clients , addr ) } ) s . clients [ addr ] = c } else { log . Infof ( " " , addr ) } t , err := c . getTransport ( proto . SID ( sid ) ) if err != nil { return err } return t . Process ( pid , tid , eid , config ) }
process starts a process for a track.
process starts a process for a track .
// no client yet, create one