Skip to content
Merged
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
14 changes: 7 additions & 7 deletions src/PdqHash/PdqHasher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,16 @@ private static void ComputeDCTMatrix(Memory<float> memory)

public HashResult? FromStream(Stream input, string source)
{
if (!input.CanSeek)
var stopwatch = Stopwatch.StartNew();

using var bufferedStream = input.CanSeek ? null : new MemoryStream();
if (bufferedStream != null)
{
using var buffered = new MemoryStream();
input.CopyTo(buffered);
buffered.Position = 0;
return FromStream(buffered, source);
input.CopyTo(bufferedStream);
bufferedStream.Position = 0;
input = bufferedStream;
}

var stopwatch = Stopwatch.StartNew();

using var codec = SKCodec.Create(input, out var result);

if (codec == null)
Expand Down