Skip to content

fix(app): audio pipeline stability, cookie login, discovery filtering, and feed performance - #351

Merged
ajisth69 merged 13 commits into
mainfrom
fix/usb-bitperfect-dac-crashes
Oct 18, 2026
Merged

ajisth69 merged 13 commits into
mainfrom
fix/usb-bitperfect-dac-crashes

Conversation

@ajisth69

@ajisth69 ajisth69 commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

Overview

Comprehensive update resolving audio pipeline stability, YouTube Music authentication, Discovery recommendation quality, Feed queue behavior, and Feed loading performance.


1. Discovery Recommendation Engine

  • Exclude Listened Tracks: Added isAlreadyListened filtering in DiscoverRepository checking across user history (recentTracksRaw, topTracksRaw, ytMusicRecentRaw, ytMusicLikedRaw, ytMusicFeedRaw, and saved playlist keys) by key and normalized artist|title.
  • Prevent Artist Clumping: Set DISCOVER_ARTIST_CAP = 1 (was 3) so batches do not repeatedly surface the same artist.
  • Removed Raw History Injection: Stopped feeding 40 ytMusicFeedRaw listening history tracks directly into discover candidates.
  • Instant Display: Cached discover tracks render immediately on screen open to prevent empty shimmer state.

2. Smart Feed Queues & Radio Continuation

  • Context-Aware Radio on Single Track Click: Tapping an individual track in Quick Picks, Because you listen to, Fresh Finds, or Charts now calls viewModel.playTrack(track, ..., startRadio = true). This generates an intelligent 25+ track context-aware radio queue instead of playing a static 5–10 track slice.
  • Endless Queue for "Play All" / Shuffle: Updated playTracksQueue, shuffleTracksQueue, playRecentQueue, and playGeneratedQueue with enableRadioContinuation = true. When the queue nears its end, MusicPlayer continuously extends the queue with contextually related tracks.

3. Feed Performance & Balance

  • Eliminated Blocking Network Calls: Removed 4 sequential fetchArtistPage calls in artistReleases (saving 2–4s per load), consuming matchedReleases directly from the parallel fetchNewReleases query.
  • Artist Search Cache: Added in-memory artistEntityCache: ConcurrentHashMap<String, FeedArtist> in FeedRepository to avoid duplicate searchArtists calls across feed refreshes.
  • Related Tracks Timeout: Guarded discoveryDef.await() with withTimeoutOrNull(3000L) to prevent slow graph queries from holding up feed rendering.
  • Balanced Quick Picks: Boosted fresh trending tracks and charts alongside personal picks, interleaving familiar tracks with discoveries so the feed is not dominated by past listening history.
  • Instant Feed Display: Cached feed data is emitted immediately on connection updates in FeedViewModel without waiting for network reloads.

4. YouTube Music Cookie Login (Matching Desktop)

  • Added CookieNormalizer.kt (direct port of Desktop InnerTubeMusicApi.normalizeCookies): supports raw Cookie headers, Netscape cookies.txt format, JSON exports from browser extensions (Cookie-Editor, EditThisCookie), and multiline text.
  • Added CookieLoginDialog.kt with clipboard paste helper, real-time validation error alerts, and seamless connection.
  • Integrated Cookie Login into both YouTubeLoginScreen.kt and SettingsScreen.kt.
  • Added unit tests in CookieNormalizerTest.kt.

5. Audio Pipeline & Bit-Perfect Playback

  • Crossfade Audio Focus: Fixed pause loop in handOffCrossfade() by keeping handleAudioFocus = false on the standby player so ExoPlayer doesn't fight LastWave's manual focus management.
  • Poweramp Bit-Perfect Definition Alignment: Updated SignalPath.kt so software gain override does not disqualify bit-perfect mode when sample rate and bit depth match the DAC wire format.
  • Poweramp-Style Signal Path Redesign: Reorganized the Output Detector dialog into Poweramp's 5-stage top-to-bottom pipeline flow (Source $\to$ DSP $\to$ Volume Control $\to$ Output $\to$ Output Device) with status cards.
  • DAC Stability: Reverted forceSoftwareVolume default to false and guarded against ReadOnlyBufferException crashes on read-only MediaCodec buffers.

…ash on read-only buffers

- Revert default of forceSoftwareVolume to false to restore hardware UAC volume control
- Guard scalePcmInPlace against read-only buffers to permanently avoid ReadOnlyBufferException
- Isolate software PCM scaling in ExclusiveUsbOutput to newly allocated write chunks
- Reset pendingVolume to 1.0f across track transitions to eliminate zero-volume traps
- Fallback to 24-bit container alt setting if initial alt setting fails on UAC2 DACs
@ajisth69 ajisth69 changed the title fix(audio): restore bit-perfect USB exclusive playback and prevent crash on read-only buffers fix(app): audio pipeline stability, cookie login, discovery filtering, and feed performance Oct 18, 2026
@ajisth69
ajisth69 merged commit 457b44c into main Oct 18, 2026
1 check passed
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

Successfully merging this pull request may close these issues.

1 participant