Comments (3)
All crc mismatch messages lead to a program abort, which is not ideal.
Turning CRC mismatches into warnings, rather than fatal errors seems reasonable. We'll push this change momentarily.
Do you agree that making the decoder more robust against damaged flac files is a reasonable goal?
As for CRC, sure. However, for the later two cases, it seems better to try to get a working FLAC file when it is broken is incorrectly encoded. Otherwise we may end up with something similar to quirks mode in HTML, which is a mess. Better to stay true to the FLAC standard.
As far as I'm aware, it should never be the case that a valid FLAC file has different number of samples in the side and left channels (i.e. in correlate
). So, the FLAC files exhibiting this property must be incorrectly encoded or damaged.
For the LPC case, it seems your file does not have subframe.NSamples == len(subframe.Samples)
which is strange. Would you please verify if this is the case?
I.e. add the following to decodeLPC
:
if subframe.NSamples != len(subframe.Samples) {
log.Fatalf("subframe sample count mismatch; expected %d, got %d", subframe.NSamples, len(subframe.Samples))
}
from flac.
Turning CRC mismatches into warnings, rather than fatal errors seems reasonable. We'll push this change momentarily.
Done as of rev 8c55685.
from flac.
for the later two cases, it seems better to try to get a working FLAC file when it is broken is incorrectly encoded. Otherwise we may end up with something similar to quirks mode in HTML, which is a mess. Better to stay true to the FLAC standard.
Let us not call it quirks mode. Quirks mode is about dealing with human ignorance. Here we have flipping bits. Why not call it error correction? Or maybe better "error resilience". Apparently mp3 decoders never panic on such issues. They attempt to be robust about damages and try to (sometimes audibly) skip over. I find this preferable.
Turning CRC mismatches into warnings
Thank you. However, this change alone may not be sufficient. What this does is that...
frame, err := flacstream.ParseNext()
may now return incomplete number of subframes or samples. You either get "len(frame.Subframes) < channels" or "len(frame.Subframes[n].Samples) < int(frame.BlockSize). Without any precaution this will likely crash the consumer of the API. Some guidance is expedient.
Btw, you can use this to find damaged flac files (I just learned):
find "path2musicfolder" -name \*.flac -type f -exec flac -t "$1" {} \+
from flac.
Related Issues (20)
- 24/96 flac content HOT 21
- Roadmap towards 2.x HOT 2
- High bitrate, small devices HOT 8
- Implement LPC encoding of audio samples
- Any plans for replaygain scanning support? HOT 2
- Audio Compression HOT 7
- Convert problem in the flac2wav HOT 3
- Error when downloading package HOT 2
- Re-Implement the flac.Encode(f, stream) function HOT 5
- Sample with Rice parameter escape codes HOT 5
- Reason for using sized integer types in `StreamInfo` and `frame.Header` HOT 2
- Update seek API to use absolute rather than relative sample number HOT 2
- Flac plays slowly HOT 1
- `flac.parseStreamInfo` reports wrong type when first block is not `STREAMINFO` HOT 3
- FLAC decoder testbench HOT 7
- Last call on FLAC spec HOT 3
- IETF test cases - 3 of 64 FAIL (61 of 64 PASS) in flac.TestDecode HOT 6
- "frame.Frame.parseHeader: The flac library test cases do not yet include any audio files with block size 192." HOT 2
- flac.Parse funcs are prone to data races HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flac.