Commits

Liam Staskawicz committed c189a76

session: prelim incorporate member table/sources, and start preliminarily tracking data sources

  • Participants
  • Parent commits 00fe426

Comments (0)

Files changed (1)

File rtp/session.go

 package rtp
 
 import (
-	// "time"
 	"log"
 )
 
 	RtcpHandler      RtcpHandler
 	CtrlEventHandler CtrlEventHandler
 	Transport        Transport
+	members          *memberTable
 	state            sessionState
 }
 
 func NewSession(t Transport) *Session {
 	s := &Session{
 		Transport: t,
+		members:   newMemberTable(),
 	}
 	t.SetHandler(s)
 	return s
 		return
 	}
 
+	s.members.Lock() // ----------------------------
+
+	src, ok := s.members.m[hdr.SyncSrc]
+	if !ok {
+		log.Println("new source:", hdr.SyncSrc)
+		src = s.members.newSource(hdr) // unknown stream, make a new one
+	}
+
+	for _, csrc := range hdr.CsrcList {
+		log.Println("Csrc:", csrc)
+	}
+
+	src.valid = src.updateSeq(hdr.SeqNum)
+	s.members.Unlock() // --------------------------
+
 	// forward packet to application
 	if s.RtpHandler != nil {
 		s.RtpHandler.HandleRtp(p)