Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playback hiccups with FLAC decoder #507

Closed
jlama opened this issue Jan 8, 2025 · 8 comments
Closed

Playback hiccups with FLAC decoder #507

jlama opened this issue Jan 8, 2025 · 8 comments

Comments

@jlama
Copy link
Contributor

jlama commented Jan 8, 2025

I randomly get a single audio hiccup (short pause) at the start of playback with the FLAC decoder.

Insufficient audio in ring buffer: 432 frames available, 470 requested

Not sure how to track this down. Any advice?

@sbooth
Copy link
Owner

sbooth commented Jan 8, 2025

Can you define hiccup? Does the decoding queue seem to starve the rendering block or does the decoder just take a minute to get started? Is this using debug or release mode?

@jlama
Copy link
Contributor Author

jlama commented Jan 8, 2025

The hiccup is a very small pause in the audio. I guess it's the extra padding added in the render block.
I only tested in debug mode so far. Last time it happened with the very first track played, so it's not a queuing issue.

The logs look like this when it happens:

Decoding started for <SFBFLACDecoder 0x60000217c480: "01 - Overture.flac">
Now playing changed to <SFBFLACDecoder 0x60000217c480: "01 - Overture.flac">
playback state changed: .playing
Rendering will start in 12.31 msec for <SFBFLACDecoder 0x60000217c480: "01 - Overture.flac">
Created <SFBFLACFile 0x6000009b3b80: "01 - Overture.flac"> based on score of 95
Rendering started notification for <SFBFLACDecoder 0x60000217c480: "01 - Overture.flac"> arrived 0.53 msec late
Insufficient audio in ring buffer: 96 frames available, 471 requested

It already happened 4-5 times but it's hard to reproduce.

@sbooth
Copy link
Owner

sbooth commented Jan 8, 2025

It's interesting that only 96 frames are in the ring buffer. Normally writes are chunked so that number seems a bit strange. The FLAC decoder should always produce the number of frames requested if they're in the file.

@jlama
Copy link
Contributor Author

jlama commented Jan 17, 2025

I'm closing this for now as I could not reproduce the issue with recent changes.

@jlama jlama closed this as completed Jan 17, 2025
@jlama
Copy link
Contributor Author

jlama commented Jan 22, 2025

Sorry this definitively still happen. Interestingly it always occurred about 2s after starting playback.

14:55:10.700759: Now playing changed to <SFBFLACDecoder 0x600001655000>
14:55:12.253917: Insufficient audio in ring buffer: 384 frames available, 512 requested
...
15:22:25.676766: Now playing changed to <SFBFLACDecoder 0x6000016d2a80>
15:22:27.782493: Insufficient audio in ring buffer: 292 frames available, 512 requested
...
15:34:30.977276: Now playing changed to <SFBFLACDecoder 0x600001658d00>
15:34:33.160399: Insufficient audio in ring buffer: 72 frames available, 512 requested

@jlama jlama reopened this Jan 22, 2025
@jlama
Copy link
Contributor Author

jlama commented Jan 22, 2025

I think I nailed down the culprits: network I/O delay and the ring buffer being too small. Increasing the ring buffer size seems to have fixed the issue.

@sbooth
Copy link
Owner

sbooth commented Jan 22, 2025

I was going to suggest increasing the ring buffer size to see if that helps. Are you playing from a network file system?

@jlama
Copy link
Contributor Author

jlama commented Jan 22, 2025

Yes it was playing from a network share.

@jlama jlama closed this as completed Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants