-
Notifications
You must be signed in to change notification settings - Fork 347
Replay gain is sometimes not applied to remote tracks #1486
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
Conversation
Track metadata, including replay gain, is not retrieved for remote tracks in a random mix under some circumstances. This results in replay gain not being applied to those tracks. Signed-off-by: Sam Y <syahres@gmail.com>
Housecleaning from a previous fix. Populate $song->replayGain outside of (before) the player loop. Signed-off-by: Sam Y <syahres@gmail.com>
…nto public/9.1
…nto public/9.1
Mystery solved. Much of the seemingly random nature of the problem was due to some inefficient logic in Squeezebox.pm, which required a one-line change to resolve. More info in the PR. Signed-off-by: Sam Y <syahres@gmail.com>
|
But would |
It could indeed be called multiple times. In the case of tracks that have expired from the cache, there will be no metadata returned on the first call. That is the reason for adding the call to the |
|
Bonus! Now that I can be confident that the track's metadata will be available in the cache when the Qobuz plugin's protocol handler |
|
I'm not sure calling |
I think you might be missing the point. While |
michaelherger
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, let's give this a try. Thanks!
I haven't grasped this one yet. How would that work? Where would we ever expect |
We wouldn't. The |
Thank YOU! 👍 |
I know |
The function is misnamed, as Perldoc points out: wantarray Returns true if the context of the currently executing subroutine or eval is looking for a list value. Returns false if the context is looking for a scalar. Returns the undefined value if the context is looking for no value (void context). This function should have been named wantlist() instead. Here is the line I am adding to
|
|
Oh... it's not just falsy, it's also differentiating between defined falsy ( |
The problem is that, in the case of streaming services such as Qobuz, track metadata (e.g. Replay gain) is cached for a limited amount of time (30 days for Qobuz) and, if a track whose metadata has been expired from the cache but has been imported into the LMS library is played, that metadata must be refreshed. This is done asynchronously when a call to the Qobuz protocol handler's
getMetadataFor()routine is done. The reason that the correct RG seemed to be applied most of the time proved to be very difficult to track down but, thanks tologBackTrace(), it was determined to be due to some inefficient (if not faulty) code in thestream_s()subroutine in Squeezebox.pm that causedSlim::Player::ReplayGain->trackAlbumMatch()to be called once or twice each time a track (of any kind) is streamed in order to check whether smart fading should be applied during the transition to the next track. This was done for every track, even if the player's Crossfade option was set to "None". In thetrackAlbumMatch()routine, if both tracks are remote,getMetadataFor()is called for both the current and previoius/next track to see if they are from the same album and if, therefore, fading should or shouldn't be applied. All this is totally unnecessary (and the results ignored) when the player's Crossfade option is "None". Eliminating these unnecessary call(s) totrackAlbumMatch()also eliminates the call(s) togetMetadataFor(), which means that the metadata is also not retrieved there (and expired cache data not refreshed) and so this must now be done in a more straightforward manner, and for ALL tracks. Therefore, an explicit call togetMetadataFor()is added to the_getNextTrack()routine for remote tracks in StreamingController.pm in order to ensure that any metadata required later in the logic path (e.g. Replay gain) will be in the associated plugin's cache.