Prove probe feeds reach runtime buffers
This commit is contained in:
parent
17aa027c79
commit
2347495824
10 changed files with 155 additions and 11 deletions
|
|
@ -4,5 +4,7 @@ public interface IMimirStreamSource : IDisposable
|
|||
{
|
||||
MimirStreamDescriptor Descriptor { get; }
|
||||
|
||||
bool ExposesDescriptorBuffer => true;
|
||||
|
||||
bool TryRead(out MimirStreamSample sample);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,8 @@ public sealed class MimirFrameEventProcessStreamSource : IMimirStreamSource
|
|||
|
||||
public MimirFrameEventProcessStreamSourceOptions Options { get; }
|
||||
|
||||
public bool ExposesDescriptorBuffer => Options.AcceptedSourceIds is not { Count: > 0 };
|
||||
|
||||
public bool TryRead(out MimirStreamSample sample)
|
||||
{
|
||||
return samples.TryDequeue(out sample);
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public sealed class MimirRuntimeConfiguration
|
|||
.Where(stream => stream.Enabled)
|
||||
.ToArray();
|
||||
var streams = sourceModels
|
||||
.Select(ToDescriptor)
|
||||
.SelectMany(ToDescriptors)
|
||||
.ToArray();
|
||||
var sources = sourceModels
|
||||
.Select(stream => TryCreateSource(stream, Path.GetDirectoryName(path)))
|
||||
|
|
@ -91,6 +91,24 @@ public sealed class MimirRuntimeConfiguration
|
|||
stream.Enabled);
|
||||
}
|
||||
|
||||
private static IEnumerable<MimirStreamDescriptor> ToDescriptors(MimirStreamConfig stream)
|
||||
{
|
||||
if (stream.AcceptSourceIds.Length == 0)
|
||||
{
|
||||
yield return ToDescriptor(stream);
|
||||
yield break;
|
||||
}
|
||||
|
||||
foreach (var sourceId in stream.AcceptSourceIds.Where(sourceId => !string.IsNullOrWhiteSpace(sourceId)))
|
||||
{
|
||||
yield return new MimirStreamDescriptor(
|
||||
sourceId,
|
||||
ParseKind(stream.Kind),
|
||||
ParseOrigin(stream.Origin),
|
||||
stream.Enabled);
|
||||
}
|
||||
}
|
||||
|
||||
private static IMimirStreamSource? TryCreateSource(MimirStreamConfig stream, string? configDirectory)
|
||||
{
|
||||
if (string.Equals(stream.Adapter, "native", StringComparison.OrdinalIgnoreCase))
|
||||
|
|
|
|||
|
|
@ -27,7 +27,10 @@ public sealed class MimirSynchronizationHub : IDisposable
|
|||
{
|
||||
ObjectDisposedException.ThrowIf(disposed, this);
|
||||
sources.Add(source);
|
||||
Buffers.EnsureBuffer(source.Descriptor);
|
||||
if (source.ExposesDescriptorBuffer)
|
||||
{
|
||||
Buffers.EnsureBuffer(source.Descriptor);
|
||||
}
|
||||
}
|
||||
|
||||
public int PollSources(int maxSamplesPerSource = 256)
|
||||
|
|
|
|||
Loading…
Reference in a new issue