Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
* develop:
  Fixing tests.
  We need to emit ongoing result entries in bulk, as the user of the API may decide to consume them accroding to sorting logic we are not aware at this point.
  • Loading branch information
AddictedCS committed Sep 18, 2023
2 parents 22c5eed + 8382eba commit fd64ba7
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/SoundFingerprinting.Tests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("4cac962e-ebc5-4006-a1e0-7ffb3e2483c2")]
[assembly: AssemblyVersion("8.27.1.100")]
[assembly: AssemblyInformationalVersion("8.27.1.100")]
[assembly: AssemblyVersion("8.27.2.100")]
[assembly: AssemblyInformationalVersion("8.27.2.100")]
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public async Task ShouldQueryInRealtime()
}
};
config.OngoingSuccessCallback = _ => { Interlocked.Increment(ref ongoingCalls); };
config.OngoingCallback = _ => { Interlocked.Add(ref ongoingCalls, _.Count()); };
config.ErrorCallback = (error, _) => throw error;
config.RestoredAfterErrorCallback = () => throw new Exception("Downtime callback called");
return config;
Expand Down Expand Up @@ -614,7 +614,7 @@ public async Task ShouldQueryBothAudioAndVideo()
}
};
config.OngoingSuccessCallback = _ => { Interlocked.Increment(ref ongoingCalls); };
config.OngoingCallback = _ => { Interlocked.Add(ref ongoingCalls, _.Count()); };
config.ErrorCallback = (error, _) => throw error;
config.RestoredAfterErrorCallback = () => throw new Exception("Downtime callback called");
return config;
Expand Down
5 changes: 1 addition & 4 deletions src/SoundFingerprinting/Command/RealtimeQueryCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -488,10 +488,7 @@ private async Task<AVQueryResult> GetAvQueryResult(AVHashes hashes)

private void InvokeOngoingCallbackHandler(IEnumerable<AVResultEntry> ongoingResultEntries)
{
foreach (var resultEntry in ongoingResultEntries)
{
configuration?.OngoingSuccessCallback(resultEntry);
}
configuration.OngoingCallback(ongoingResultEntries);
}

private static void InvokeCallbackHandler(IEnumerable<AVQueryResult> results, Action<AVQueryResult>? callback)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public DefaultRealtimeQueryConfiguration(
successCallback,
didNotPassFilterCallback,
new PassThroughRealtimeResultEntryFilter(),
ongoingSuccessCallback: _ => { },
ongoingCallback: _ => { },
errorCallback: onError,
restoredAfterErrorCallback: restoredAfterErrorCallback,
offlineStorage: new EmptyOfflineStorage(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public abstract class RealtimeQueryConfiguration
/// <param name="successCallback">Success callback.</param>
/// <param name="didNotPassFilterCallback">Callback invoked when filter is not passed.</param>
/// <param name="ongoingResultEntryFilter">What is playing right now filter.</param>
/// <param name="ongoingSuccessCallback">What is playing right now success callback.</param>
/// <param name="ongoingCallback">What is playing right now success callback.</param>
/// <param name="errorCallback">Error callback.</param>
/// <param name="restoredAfterErrorCallback">Restore after error callback.</param>
/// <param name="offlineStorage">An instance of the <see cref="IOfflineStorage"/> interface.</param>
Expand All @@ -32,7 +32,7 @@ public RealtimeQueryConfiguration(AVQueryConfiguration queryConfiguration,
Action<AVQueryResult> successCallback,
Action<AVQueryResult> didNotPassFilterCallback,
IRealtimeResultEntryFilter ongoingResultEntryFilter,
Action<AVResultEntry> ongoingSuccessCallback,
Action<IEnumerable<AVResultEntry>> ongoingCallback,
Action<Exception, AVHashes?> errorCallback,
Action restoredAfterErrorCallback,
IOfflineStorage offlineStorage,
Expand All @@ -46,7 +46,7 @@ public RealtimeQueryConfiguration(AVQueryConfiguration queryConfiguration,
SuccessCallback = successCallback;
DidNotPassFilterCallback = didNotPassFilterCallback;
OngoingResultEntryFilter = ongoingResultEntryFilter;
OngoingSuccessCallback = ongoingSuccessCallback;
OngoingCallback = ongoingCallback;
ErrorCallback = errorCallback;
RestoredAfterErrorCallback = restoredAfterErrorCallback;
OfflineStorage = offlineStorage;
Expand Down Expand Up @@ -86,14 +86,14 @@ public RealtimeQueryConfiguration(AVQueryConfiguration queryConfiguration,
/// <remarks>
/// The following implementations are recommended for use: <br />
/// <see cref="OngoingRealtimeResultEntryFilter"/> will emit the result without waiting it to complete.
/// As an example for initialization values <i>minCoverage = 0.2</i> and <i>minTrackLength = 10</i>, a 1-minute long track will be emitted 6 times in the <see cref="OngoingSuccessCallback"/>.
/// As an example for initialization values <i>minCoverage = 0.2</i> and <i>minTrackLength = 10</i>, a 1-minute long track will be emitted 6 times in the <see cref="OngoingCallback"/>.
/// </remarks>
public IRealtimeResultEntryFilter OngoingResultEntryFilter { get; set; }

/// <summary>
/// Gets or sets ongoing success callback that will be invoked on entries that pass <see cref="OngoingResultEntryFilter"/>.
/// </summary>
public Action<AVResultEntry> OngoingSuccessCallback { get; set; }
public Action<IEnumerable<AVResultEntry>> OngoingCallback { get; set; }

/// <summary>
/// Gets or sets error callback which will be invoked in case if an error occurs during query time.
Expand Down
4 changes: 2 additions & 2 deletions src/SoundFingerprinting/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@
[assembly: InternalsVisibleTo("SoundFingerprinting.FFT.FFTW")]
[assembly: InternalsVisibleTo("SoundFingerprinting.FFT.FFTW.Tests")]

[assembly: AssemblyVersion("8.27.1.100")]
[assembly: AssemblyInformationalVersion("8.27.1.100")]
[assembly: AssemblyVersion("8.27.2.100")]
[assembly: AssemblyInformationalVersion("8.27.2.100")]
2 changes: 1 addition & 1 deletion src/SoundFingerprinting/SoundFingerprinting.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<Nullable>enable</Nullable>
<PackageVersion>8.27.1</PackageVersion>
<PackageVersion>8.27.2</PackageVersion>
<Authors>Sergiu Ciumac</Authors>
<PackageDescription>SoundFingerprinting is a C# framework that implements an efficient algorithm of audio fingerprinting and identification. Designed for developers, enthusiasts, researchers in the fields of audio processing, data mining, digital signal processing.</PackageDescription>
<PackageProjectUrl>https://github.com/addictedcs/soundfingerprinting</PackageProjectUrl>
Expand Down

0 comments on commit fd64ba7

Please sign in to comment.