private IEnumerator UpdateStats() { while (true) { RTCRtpSender sender = pc1Senders.First(); RTCStatsReportAsyncOperation op = sender.GetStats(); yield return(op); if (op.IsError) { Debug.LogErrorFormat("RTCRtpSender.GetStats() is failed {0}", op.Error.errorType); } else { UpdateStatsPacketSize(op.Value); } yield return(new WaitForSeconds(1f)); } }
private IEnumerator UpdateStatsCoroutine() { RTCRtpSender sender = pc1Senders.FirstOrDefault(); if (sender == null) { yield break; } RTCStatsReportAsyncOperation op = sender.GetStats(); yield return(op); if (op.IsError) { Debug.LogErrorFormat("RTCRtpSender.GetStats() is failed {0}", op.Error.errorType); } else { UpdateStatsPacketSize(op.Value); } }