Skip to content
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

Fix current track display/broadcasting/recording when starting auto-DJ #3500

Merged
merged 1 commit into from
Jan 1, 2021

Conversation

daschuer
Copy link
Member

This is a bug that happens due to play changes before track is loaded.

@daschuer daschuer added this to the 2.3.0 milestone Dec 29, 2020
}
}

int PlayerInfo::getCurrentPlayingDeck() {
QMutexLocker locker(&m_mutex);
updateCurrentPlayingDeck();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hiding this heavy-weight mutable operation inside a"getter" function that should actually be idempotent is a code smell. Do we have other options?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change was required to allow fast play/pause toggle via mpris. The 2 sec timer based update is too long.
Would it be OK to rename the function to calcCurrentPlayingDeck()?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updateCurrentPlayingDeck() could also return the deck number/index. The getter should be read-only.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have reverted the this.

emit currentPlayingDeckChanged(maxDeck);
emit currentPlayingTrackChanged(getCurrentPlayingTrack());
TrackPointer track;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could become emit currentPlayingTrackChanged(getCurrentPlayingTrack()) if only getCurrentPlayingDeck() and getCurrentPlayingTrack() would be idempotent and work as expected.

@daschuer
Copy link
Member Author

I have forced pushed and removed the critical changes.
They where unrelated to the bug fix anyway.

@uklotzde
Copy link
Contributor

uklotzde commented Jan 1, 2021

Good idea to defer the changes that are not strictly necessary for this PR.

LGTM Thank you!

@uklotzde uklotzde merged commit f5873fd into mixxxdj:2.3 Jan 1, 2021
@daschuer daschuer deleted the current_track_fix branch September 26, 2021 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants