@@ -57,13 +57,16 @@ func (c *Conference) processPeerMessage(message common.Message[ParticipantID, pe
5757 // determine the actual type of the message.
5858 switch msg := message .Content .(type ) {
5959 case peer.JoinedTheCall :
60+ participant .logger .Info ("Joined the call" )
6061 c .resendMetadataToAllExcept (participant .id )
6162
6263 case peer.LeftTheCall :
64+ participant .logger .Info ("Left the call" )
6365 c .removeParticipant (message .Sender )
6466 c .signaling .SendHangup (participant .asMatrixRecipient (), event .CallHangupUnknownError )
6567
6668 case peer.NewTrackPublished :
69+ participant .logger .Infof ("Published new track: %s" , msg .Track .ID ())
6770 key := event.SFUTrackDescription {
6871 StreamID : msg .Track .StreamID (),
6972 TrackID : msg .Track .ID (),
@@ -77,6 +80,7 @@ func (c *Conference) processPeerMessage(message common.Message[ParticipantID, pe
7780 participant .publishedTracks [key ] = msg .Track
7881
7982 case peer.PublishedTrackFailed :
83+ participant .logger .Infof ("Failed published track: %s" , msg .Track .ID ())
8084 delete (participant .publishedTracks , event.SFUTrackDescription {
8185 StreamID : msg .Track .StreamID (),
8286 TrackID : msg .Track .ID (),
@@ -91,6 +95,8 @@ func (c *Conference) processPeerMessage(message common.Message[ParticipantID, pe
9195 }
9296
9397 case peer.NewICECandidate :
98+ participant .logger .Info ("Received a new local ICE candidate" )
99+
94100 // Convert WebRTC ICE candidate to Matrix ICE candidate.
95101 jsonCandidate := msg .Candidate .ToJSON ()
96102 candidates := []event.CallCandidate {{
@@ -101,17 +107,21 @@ func (c *Conference) processPeerMessage(message common.Message[ParticipantID, pe
101107 c .signaling .SendICECandidates (participant .asMatrixRecipient (), candidates )
102108
103109 case peer.ICEGatheringComplete :
110+ participant .logger .Info ("Completed local ICE gathering" )
111+
104112 // Send an empty array of candidates to indicate that ICE gathering is complete.
105113 c .signaling .SendCandidatesGatheringFinished (participant .asMatrixRecipient ())
106114
107115 case peer.RenegotiationRequired :
116+ participant .logger .Info ("Started renegotiation" )
108117 participant .sendDataChannelMessage (event.SFUMessage {
109118 Op : event .SFUOperationOffer ,
110119 SDP : msg .Offer .SDP ,
111120 Metadata : c .getAvailableStreamsFor (participant .id ),
112121 })
113122
114123 case peer.DataChannelMessage :
124+ participant .logger .Info ("Sent data channel message" )
115125 var sfuMessage event.SFUMessage
116126 if err := json .Unmarshal ([]byte (msg .Message ), & sfuMessage ); err != nil {
117127 c .logger .Errorf ("Failed to unmarshal SFU message: %v" , err )
@@ -121,6 +131,7 @@ func (c *Conference) processPeerMessage(message common.Message[ParticipantID, pe
121131 c .handleDataChannelMessage (participant , sfuMessage )
122132
123133 case peer.DataChannelAvailable :
134+ participant .logger .Info ("Connected data channel" )
124135 participant .sendDataChannelMessage (event.SFUMessage {
125136 Op : event .SFUOperationMetadata ,
126137 Metadata : c .getAvailableStreamsFor (participant .id ),
@@ -135,6 +146,8 @@ func (c *Conference) processPeerMessage(message common.Message[ParticipantID, pe
135146func (c * Conference ) handleDataChannelMessage (participant * Participant , sfuMessage event.SFUMessage ) {
136147 switch sfuMessage .Op {
137148 case event .SFUOperationSelect :
149+ participant .logger .Info ("Sent select request over DC" )
150+
138151 // Get the tracks that correspond to the tracks that the participant wants to receive.
139152 for _ , track := range c .getTracks (sfuMessage .Start ) {
140153 if err := participant .peer .SubscribeTo (track ); err != nil {
@@ -144,12 +157,16 @@ func (c *Conference) handleDataChannelMessage(participant *Participant, sfuMessa
144157 }
145158
146159 case event .SFUOperationAnswer :
160+ participant .logger .Info ("Sent SDP answer over DC" )
161+
147162 if err := participant .peer .ProcessSDPAnswer (sfuMessage .SDP ); err != nil {
148163 participant .logger .Errorf ("Failed to set SDP answer: %v" , err )
149164 return
150165 }
151166
152167 case event .SFUOperationPublish :
168+ participant .logger .Info ("Sent SDP offer over DC" )
169+
153170 answer , err := participant .peer .ProcessSDPOffer (sfuMessage .SDP )
154171 if err != nil {
155172 participant .logger .Errorf ("Failed to set SDP offer: %v" , err )
@@ -162,10 +179,14 @@ func (c *Conference) handleDataChannelMessage(participant *Participant, sfuMessa
162179 })
163180
164181 case event .SFUOperationUnpublish :
182+ participant .logger .Info ("Sent unpublish over DC" )
183+
165184 // TODO: Clarify the semantics of unpublish.
166185 case event .SFUOperationAlive :
167186 // FIXME: Handle the heartbeat message here (updating the last timestamp etc).
168187 case event .SFUOperationMetadata :
188+ participant .logger .Info ("Sent metadata over DC" )
189+
169190 participant .streamMetadata = sfuMessage .Metadata
170191 c .resendMetadataToAllExcept (participant .id )
171192 }
0 commit comments