Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Baballonia/Assets/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 23 additions & 4 deletions src/Baballonia/Services/ProcessingLoopService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ public record struct Expressions(float[]? FaceExpression, float[]? EyeExpression
private readonly EyeProcessingPipeline _eyeProcessingPipeline;
private readonly EyePipelineManager _eyePipelineManager;
private readonly IEyePipelineEventBus _eyePipelineEventBus;
private int _faceTrackingExceptions = 0;
private int _eyeTrackingExceptions = 0;


private readonly DispatcherTimer _drawTimer = new()
{
Expand Down Expand Up @@ -63,11 +66,19 @@ private void TimerEvent(object? s, EventArgs e)
var faceExpression = _faceProcessingPipeline.RunUpdate();
if (faceExpression != null)
expressions.FaceExpression = faceExpression;
_faceTrackingExceptions = 0;
}
catch (Exception ex)
{
_logger.LogError("Unexpected exception in Face Tracking pipeline, stopping... : {}", ex);
_facePipelineManager.StopCamera();
if (_faceTrackingExceptions++ < 3)
{
_logger.LogError("Unexpected exception in Face Tracking pipeline, allowing to continue in case its anomalous... : {}", ex);
}
else
{
_logger.LogError("Unexpected exception in Face Tracking pipeline, stopping due to exceeding failure limit... : {}", ex);
_facePipelineManager.StopCamera();
}
_facePipelineEventBus.Publish(new FacePipelineEvents.ExceptionEvent(ex));
}

Expand All @@ -76,11 +87,19 @@ private void TimerEvent(object? s, EventArgs e)
var eyeExpression = _eyeProcessingPipeline.RunUpdate();
if (eyeExpression != null)
expressions.EyeExpression = eyeExpression;
_eyeTrackingExceptions = 0;
}
catch (Exception ex)
{
_logger.LogError("Unexpected exception in Eye Tracking pipeline, stopping... : {}", ex);
_eyePipelineManager.StopAllCameras();
if (_eyeTrackingExceptions++ < 3)
{
_logger.LogError("Unexpected exception in Eye Tracking pipeline, allowing to continue in case its anomalous... : {}", ex);
}
else
{
_logger.LogError("Unexpected exception in Eye Tracking pipeline, stopping due to exceeding failure limit... : {}", ex);
_eyePipelineManager.StopAllCameras();
}
_eyePipelineEventBus.Publish(new EyePipelineEvents.ExceptionEvent(ex));
}

Expand Down