Propagate Fensalir texture leases to video drivers
This commit is contained in:
parent
daf1d4ef8a
commit
7202d30ef1
10 changed files with 85 additions and 3 deletions
|
|
@ -0,0 +1,6 @@
|
|||
namespace Mimir.Runtime.Synchronization;
|
||||
|
||||
public interface IMimirFensalirTextureLeaseReceiver
|
||||
{
|
||||
void AttachTextureLeaseClient(MimirFensalirTextureLeaseClient? client);
|
||||
}
|
||||
|
|
@ -9,6 +9,7 @@ public sealed class MimirSynchronizationHub : IDisposable
|
|||
private readonly Dictionary<string, MimirAudioSynchronizationReport> audioSynchronizationReports = new(StringComparer.Ordinal);
|
||||
private readonly Dictionary<string, MimirAudioSynchronizationReport> complexContourReports = new(StringComparer.Ordinal);
|
||||
private readonly MimirChirpBinCalibrationModel? chirpBinCalibrationModel;
|
||||
private MimirFensalirTextureLeaseClient? textureLeaseClient;
|
||||
private ulong ingestedSamples;
|
||||
private int nextAudioSynchronizationCandidate;
|
||||
|
||||
|
|
@ -64,6 +65,23 @@ public sealed class MimirSynchronizationHub : IDisposable
|
|||
{
|
||||
Buffers.EnsureBuffer(source.Descriptor);
|
||||
}
|
||||
|
||||
if (source is IMimirFensalirTextureLeaseReceiver receiver)
|
||||
{
|
||||
receiver.AttachTextureLeaseClient(textureLeaseClient);
|
||||
}
|
||||
}
|
||||
|
||||
public void AttachTextureLeaseClient(MimirFensalirTextureLeaseClient? client)
|
||||
{
|
||||
textureLeaseClient = client;
|
||||
foreach (var source in sources)
|
||||
{
|
||||
if (source is IMimirFensalirTextureLeaseReceiver receiver)
|
||||
{
|
||||
receiver.AttachTextureLeaseClient(client);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int PollSources(int maxSamplesPerSource = 8192)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
namespace Mimir.Runtime.Synchronization;
|
||||
|
||||
public sealed class MimirVideoCaptureDriverSource : IMimirStreamSource
|
||||
public sealed class MimirVideoCaptureDriverSource : IMimirStreamSource, IMimirFensalirTextureLeaseReceiver
|
||||
{
|
||||
private readonly IMimirVideoCaptureDriver driver;
|
||||
private readonly MimirNativeIngestStreamSource nativeSource;
|
||||
|
|
@ -25,6 +25,14 @@ public sealed class MimirVideoCaptureDriverSource : IMimirStreamSource
|
|||
|
||||
public Func<long> ReadArrivalNs { get; }
|
||||
|
||||
public void AttachTextureLeaseClient(MimirFensalirTextureLeaseClient? client)
|
||||
{
|
||||
if (driver is IMimirFensalirTextureLeaseReceiver receiver)
|
||||
{
|
||||
receiver.AttachTextureLeaseClient(client);
|
||||
}
|
||||
}
|
||||
|
||||
public bool TryRead(out MimirStreamSample sample)
|
||||
{
|
||||
if (nativeSource.TryRead(out sample))
|
||||
|
|
|
|||
Loading…
Reference in a new issue