[PR #118] [CLOSED] [WIP] feat: use native Go package for decoding Ogg Vorbis audio #220

Closed
opened 2026-02-28 14:26:17 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/devgianlu/go-librespot/pull/118
Author: @aykevl
Created: 10/6/2024
Status: Closed

Base: masterHead: vorbis-purego


📝 Commits (1)

  • 6068dd4 feat: use native Go package for decoding Ogg Vorbis audio

📊 Changes

7 files changed (+83 additions, -401 deletions)

View changed files

📝 .github/workflows/build_test.yml (+1 -1)
📝 .github/workflows/release.yml (+0 -28)
📝 README.md (+1 -3)
📝 audio/metadata.go (+40 -34)
📝 go.mod (+2 -1)
📝 go.sum (+4 -2)
📝 vorbis/decoder.go (+35 -332)

📄 Description

This is something I'm experimenting with. It's nowhere near finished, though it does work. The main thing that's missing is seek indices (which makes seeking a bit slower than it could be).

Advantages:

  • No need to have libogg and libvorbis installed. This means it's easier to cross compile and easier to port go-librespot to a different OS.
  • Less code to maintain (this PR removes a lot of code!).
  • Maybe faster (see below)

I did some benchmarking, to see whether using a native Go version would perhaps be faster than using libvorbis through cgo because of the CGo call overhead. What I found was that the native version is a lot slower, but not for the reason you might think: the audio decryptor actually becomes twice as slow while the decoder itself is only about 8% slower. So what I'm suspecting is that the new decoder does a lot of unnecessary seeking or reads more data than it actually needs.

I wanted to share this as an experiment. Maybe I'll continue working on it to see whether I can fix the decryptor slowdowns and of course to implement seeking.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/devgianlu/go-librespot/pull/118 **Author:** [@aykevl](https://github.com/aykevl) **Created:** 10/6/2024 **Status:** ❌ Closed **Base:** `master` ← **Head:** `vorbis-purego` --- ### 📝 Commits (1) - [`6068dd4`](https://github.com/devgianlu/go-librespot/commit/6068dd43899442a1e734cbe6d83810f27c6353a1) feat: use native Go package for decoding Ogg Vorbis audio ### 📊 Changes **7 files changed** (+83 additions, -401 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/build_test.yml` (+1 -1) 📝 `.github/workflows/release.yml` (+0 -28) 📝 `README.md` (+1 -3) 📝 `audio/metadata.go` (+40 -34) 📝 `go.mod` (+2 -1) 📝 `go.sum` (+4 -2) 📝 `vorbis/decoder.go` (+35 -332) </details> ### 📄 Description This is something I'm experimenting with. It's nowhere near finished, though it does work. The main thing that's missing is seek indices (which makes seeking a bit slower than it could be). Advantages: * No need to have libogg and libvorbis installed. This means it's easier to cross compile and easier to port go-librespot to a different OS. * Less code to maintain (this PR removes a lot of code!). * _Maybe_ faster (see below) I did some benchmarking, to see whether using a native Go version would perhaps be faster than using libvorbis through cgo because of the CGo call overhead. What I found was that the native version is a lot slower, but not for the reason you might think: the audio decryptor actually becomes twice as slow while the decoder itself is only about 8% slower. So what I'm suspecting is that the new decoder does a lot of unnecessary seeking or reads more data than it actually needs. I wanted to share this as an experiment. Maybe I'll continue working on it to see whether I can fix the decryptor slowdowns and of course to implement seeking. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-28 14:26:17 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/go-librespot#220
No description provided.