@@ -119,7 +119,6 @@ private static async Task<RTCPeerConnection> SendSDPOffer(WebSocketContext conte
119
119
peerConnection . OnAudioFormatsNegotiated += ( audioFormats ) =>
120
120
windowsAudioEP . SetAudioSinkFormat ( audioFormats . First ( ) ) ;
121
121
peerConnection . OnReceiveReport += RtpSession_OnReceiveReport ;
122
- peerConnection . OnSendReport += RtpSession_OnSendReport ;
123
122
peerConnection . OnSendReportByIndex += RtpSession_OnSendReportByIndex ;
124
123
peerConnection . OnTimeout += ( mediaType ) => logger . LogDebug ( $ "Timeout on media { mediaType } .") ;
125
124
peerConnection . oniceconnectionstatechange += ( state ) => logger . LogDebug ( $ "ICE connection state changed to { state } .") ;
@@ -134,7 +133,7 @@ private static async Task<RTCPeerConnection> SendSDPOffer(WebSocketContext conte
134
133
else if ( state == RTCPeerConnectionState . closed || state == RTCPeerConnectionState . failed )
135
134
{
136
135
peerConnection . OnReceiveReport -= RtpSession_OnReceiveReport ;
137
- peerConnection . OnSendReport -= RtpSession_OnSendReport ;
136
+ peerConnection . OnSendReportByIndex -= RtpSession_OnSendReportByIndex ;
138
137
139
138
await windowsAudioEP . CloseAudio ( ) ;
140
139
}
@@ -182,15 +181,12 @@ private static void WebSocketMessageReceived(RTCPeerConnection peerConnection, s
182
181
}
183
182
}
184
183
185
- private static void RtpSession_OnSendReport ( SDPMediaTypesEnum mediaType , RTCPCompoundPacket sentRtcpReport )
186
- => RtpSession_OnSendReportByIndex ( 0 , mediaType , sentRtcpReport ) ;
187
-
188
184
/// <summary>
189
185
/// Diagnostic handler to print out our RTCP sender/receiver reports.
190
186
/// </summary>
191
187
private static void RtpSession_OnSendReportByIndex ( int index , SDPMediaTypesEnum mediaType , RTCPCompoundPacket sentRtcpReport )
192
188
{
193
- logger . LogDebug ( $ "RTCP report sent for index { index } and media { mediaType } .") ;
189
+ // logger.LogDebug($"RTCP report sent for index {index} and media {mediaType}.");
194
190
195
191
if ( sentRtcpReport . Bye != null )
196
192
{
@@ -206,7 +202,7 @@ private static void RtpSession_OnSendReportByIndex(int index, SDPMediaTypesEnum
206
202
if ( sentRtcpReport . ReceiverReport . ReceptionReports ? . Count > 0 )
207
203
{
208
204
var rrSample = sentRtcpReport . ReceiverReport . ReceptionReports . First ( ) ;
209
- logger . LogDebug ( $ "RTCP sent RR { mediaType } , ssrc { rrSample . SSRC } , seqnum { rrSample . ExtendedHighestSequenceNumber } .") ;
205
+ logger . LogDebug ( $ "RTCP sent RR { mediaType } , ssrc { rrSample . SSRC } , seqnum { rrSample . ExtendedHighestSequenceNumber } , pkts lost { rrSample . PacketsLost } .") ;
210
206
}
211
207
else
212
208
{
@@ -220,22 +216,22 @@ private static void RtpSession_OnSendReportByIndex(int index, SDPMediaTypesEnum
220
216
/// </summary>
221
217
private static void RtpSession_OnReceiveReport ( IPEndPoint remoteEndPoint , SDPMediaTypesEnum mediaType , RTCPCompoundPacket recvRtcpReport )
222
218
{
223
- logger . LogDebug ( $ "RTCP report received for { mediaType } .") ;
219
+ // logger.LogDebug($"RTCP report received for {mediaType}.");
224
220
225
221
if ( recvRtcpReport . Bye != null )
226
222
{
227
223
logger . LogDebug ( $ "RTCP recv BYE { mediaType } .") ;
228
224
}
229
- else
225
+ else if ( recvRtcpReport . ReceiverReport != null )
230
226
{
231
- var rr = recvRtcpReport . ReceiverReport ? . ReceptionReports ? . FirstOrDefault ( ) ;
227
+ var rr = recvRtcpReport . ReceiverReport . ReceptionReports ? . FirstOrDefault ( ) ;
232
228
if ( rr != null )
233
229
{
234
- logger . LogDebug ( $ "RTCP { mediaType } Receiver Report: SSRC { rr . SSRC } , pkts lost { rr . PacketsLost } , delay since SR { rr . DelaySinceLastSenderReport } .") ;
230
+ logger . LogDebug ( $ "RTCP { mediaType } Receiver Report SSRC { rr . SSRC } : pkts lost { rr . PacketsLost } , delay since SR { rr . DelaySinceLastSenderReport } .") ;
235
231
}
236
232
else
237
233
{
238
- logger . LogDebug ( $ "RTCP { mediaType } Receiver Report: empty.") ;
234
+ logger . LogDebug ( $ "RTCP { mediaType } Receiver Report for SSRC { recvRtcpReport . ReceiverReport . SSRC } : empty.") ;
239
235
}
240
236
}
241
237
}
0 commit comments