Improve format detection, storefront-aware catalog lookups, and true ALAC bit depth - #8
Merged
Merged
Conversation
Catalog resolver: - Match catalog tracks whose media-session artist is the composer by also comparing the performers and album packed into the album field, so classical tracks resolve to the correct recording without loosening the exact-match requirement. - Strip the leading "By " that the Windows media session adds to the artist. - Detect the storefront from the OS region (overridable in settings) instead of assuming "us". - Log the storefront, search terms, raw result counts, and top scored candidates so matches and misses are diagnosable. Local files: - When the device does not support a file's exact rate, target the highest supported integer submultiple (e.g. 192 kHz -> 96 kHz) rather than giving up, and log when a cache file cannot be parsed. Fallback: - When the real rate cannot be determined, default to 24/44.1 and show a message (tray text always, toast when enabled) instead of guessing a tier-specific rate.
The lost-intro symptom (track starts a few seconds in) reproduces on some machines but not others. Add an "Intro-trace" log line carrying the transport timeline position and the media agent's session peak at each step of the live switch: at mute on track change, just before applying the format, when the render stream rebuilds, and through the schedule realign (start, paused, resumed). This shows whether and where the timeline jumps ahead of the audio across the rebuild and realign, so the divergence can be pinned from a log.
TagLib reports the MP4 sample entry's legacy samplesize field, which is frequently 16 even for 24-bit Hi-Res ALAC, and exposes nothing that distinguishes ALAC from AAC in an .m4a. Walk the atom tree to the ALAC magic cookie for the real depth; its absence identifies the stream as AAC. Local-file resolution now applies the file's true depth (smallest containing depth when the device lacks an exact match) and the lowest supported depth for lossy files instead of inflating to the device max. Probe results carry a codec label so diagnostics can explain which depth path was taken, and .wav/.aiff imports are probed too.
- Bound the submultiple rate preference to one octave of the best supported rate: a 176.4 kHz file on a 44.1/48/96 DAC now lands on 96, not 44.1 for the sake of an integer ratio. - Validate the resolved storefront to two ASCII letters (OS regions can yield M.49 numeric codes; a hand-edited override must not reach a URL path) and fall back through region to 'us'. Region detection is injectable and the storefront tests now cover the real branches. - Log every developer-token acquisition failure: an unacquirable token disables catalog resolution entirely and previously did so silently. - Wrap toast title and message text; the new rate-undetermined message was clipped at 20pt in a 320px window. - Gate per-operation diagnostics (catalog search attempts, playback probes) behind enableVerboseDiagnostics, which was documented but read nowhere. Playback probes now skip their COM session enumeration entirely when off, reuse the transport state the caller decided on instead of re-reading it, and the realign probe is captured before the pause so it cannot lengthen the pause->play window it measures. - Reset TrySplitOnDashSeparator out params before returning false. - Update README (conservative fallback, appleMusicStorefront) and add the unreleased CHANGELOG section for the behavior changes.
The cache keys are storefront-scoped, but after the storefront became region-dependent the reader still keyed on the static "us" default while the writer filed entries under the resolved storefront — a merge of two independently-correct branches that silently missed on every lookup for non-US users. The cache reader now takes the catalog resolver's resolved storefront, and the verification resolver is built with the same value so re-checks search the catalog the entry came from. CatalogResolverVersion bumps to 2: matching now scores performer credits and album parts, so cached results from version 1 may differ and are rebuilt.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lands the
fix/dragonfly-2448-detectionwork, rebased onto main after #5, plus review fixes:appleMusicStorefrontoverride.enableVerboseDiagnosticsand kept out of the timing windows they measure.CatalogResolverVersionbumps to 2 (matching logic changed).Full suite 229/229 green.