[PR #20] [MERGED] Make AndroidNativeDecoder working again #22

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

📋 Pull Request Information

Original PR: https://github.com/devgianlu/librespot-android/pull/20
Author: @0xf4b1
Created: 1/30/2023
Status: Merged
Merged: 1/31/2023
Merged by: @mitschwimmer

Base: masterHead: android-decoder


📝 Commits (3)

  • 366af36 Prefer AndroidNativeDecoder over built-in librespot-java decoders
  • f974bfd Fix MediaExtractor by adding the initial stream position as offset
  • e3ba666 Use timeout in dequeueOutputBuffer and handle the case

📊 Changes

2 files changed (+8 additions, -6 deletions)

View changed files

📝 app/src/main/java/xyz/gianlu/librespot/android/LibrespotApp.java (+2 -2)
📝 librespot-android-decoder/src/main/java/xyz/gianlu/librespot/player/decoders/AndroidNativeDecoder.java (+6 -4)

📄 Description

Hey, first of all many thanks for this great library and demo! :)
I created this PR, because I had some trouble to get the library working in my music player app, so I was interested in the AndroidNativeDecoder and also encountered some issues.

First, after making sure the app does not use the tremolo decoder for ogg decoding on arm devices, the app prefers the build-in decoders over the AndroidNativeDecoder, so I changed the register part to add them to the front of the list of decoders.

Then, when the AndroidNativeDecoder is being used, I always encountered DecoderException: No tracks found., but interestingly it worked when writing the full stream into a buffer and reading out of it instead. Then I realized the stream is not at position zero when passed to the decoder, so I added the starting position as offset in MediaDataSource to get the MediaExtractor working again.

Lastly, the dequeueOutputBuffer blocks indefinitely for me, but I could get it working by specifying a timeout.

With these changes, the decoder works great again on my Pixel 6!


🔄 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/librespot-android/pull/20 **Author:** [@0xf4b1](https://github.com/0xf4b1) **Created:** 1/30/2023 **Status:** ✅ Merged **Merged:** 1/31/2023 **Merged by:** [@mitschwimmer](https://github.com/mitschwimmer) **Base:** `master` ← **Head:** `android-decoder` --- ### 📝 Commits (3) - [`366af36`](https://github.com/devgianlu/librespot-android/commit/366af3690b5e3c27d698e119e1d0167f70ca62d7) Prefer `AndroidNativeDecoder` over built-in librespot-java decoders - [`f974bfd`](https://github.com/devgianlu/librespot-android/commit/f974bfdd057f0c1d989a766e86f70d00e8b564bd) Fix `MediaExtractor` by adding the initial stream position as offset - [`e3ba666`](https://github.com/devgianlu/librespot-android/commit/e3ba666f4b4ad91c093ad452a16013f85962ce8c) Use timeout in `dequeueOutputBuffer` and handle the case ### 📊 Changes **2 files changed** (+8 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `app/src/main/java/xyz/gianlu/librespot/android/LibrespotApp.java` (+2 -2) 📝 `librespot-android-decoder/src/main/java/xyz/gianlu/librespot/player/decoders/AndroidNativeDecoder.java` (+6 -4) </details> ### 📄 Description Hey, first of all many thanks for this great library and demo! :) I created this PR, because I had some trouble to get the library working in my music player app, so I was interested in the `AndroidNativeDecoder` and also encountered some issues. First, after making sure the app does not use the tremolo decoder for ogg decoding on arm devices, the app prefers the build-in decoders over the `AndroidNativeDecoder`, so I changed the register part to add them to the front of the list of decoders. Then, when the `AndroidNativeDecoder` is being used, I always encountered `DecoderException: No tracks found.`, but interestingly it worked when writing the full stream into a buffer and reading out of it instead. Then I realized the stream is not at position zero when passed to the decoder, so I added the starting position as offset in `MediaDataSource` to get the `MediaExtractor` working again. Lastly, the `dequeueOutputBuffer` blocks indefinitely for me, but I could get it working by specifying a timeout. With these changes, the decoder works great again on my Pixel 6! --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-28 14:24:07 +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/librespot-android#22
No description provided.