dpwe / audfprint

Landmark-based audio fingerprinting
MIT License
547 stars 123 forks source link

Removing the last hash from a database #15

Closed slifty closed 8 years ago

slifty commented 8 years ago

Apologies for the sparsely written issue, I can add more details after an impending deadline!

I noticed that when I removed the only hash from a database I get a division by zero error at the line where the percentage of dropped hashes.

Steps to reproduce: 1) Add a file to a new database 2) Remove it from that database (without adding any others)

dpwe commented 8 years ago

It turns out that removing the first item added to a database is a special case, because empty hash table entries look like they belong to ID 0. I could fix this, but I'm already worried that this operation could exhaust memory, and the bug is not fatal at the moment, it just reports that it has removed a very large number of hashes (and it's slow).

However, the actual crash reported above is now fixed. Thanks for the clear report!

dpwe commented 8 years ago

Closed via https://github.com/dpwe/audfprint/commit/dd0b2b981b8aa9ed315d4c96ca0450ccddbd4910