Skip to content

CueControl: Fix previewing regression from PR #2194#3267

Merged
daschuer merged 1 commit intomixxxdj:mainfrom
Holzhaus:saved-loops-previewing
Nov 5, 2020
Merged

CueControl: Fix previewing regression from PR #2194#3267
daschuer merged 1 commit intomixxxdj:mainfrom
Holzhaus:saved-loops-previewing

Conversation

@Holzhaus
Copy link
Copy Markdown
Member

@Holzhaus Holzhaus commented Nov 5, 2020

No description provided.

@Holzhaus Holzhaus added this to the 2.4.0 milestone Nov 5, 2020
@Holzhaus Holzhaus requested a review from daschuer November 5, 2020 11:31
@Holzhaus
Copy link
Copy Markdown
Member Author

Holzhaus commented Nov 5, 2020

@daschuer Please verify if this fixes the issue reported in https://bugs.launchpad.net/mixxx/+bug/1903002.

@daschuer
Copy link
Copy Markdown
Member

daschuer commented Nov 5, 2020

It is still there. I experienced now also the issue when jumping back ward.
Since it happens only rarely in 1 of 10 attempts or so, I am afraid it is a timing issue or race-condition.

Copy link
Copy Markdown
Member

@daschuer daschuer left a comment

Choose a reason for hiding this comment

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

Are you able to reproduce it?

@Holzhaus
Copy link
Copy Markdown
Member Author

Holzhaus commented Nov 5, 2020

Are you able to reproduce it?

Yes, sometimes the m_iCurrentlyPlayingHotcues semaphore is not updated properly:

warning [Main] CueControl::hotcueActivatePreview 1 0
warning [Main] CueControl::hotcueActivatePreview 0 0

@Holzhaus
Copy link
Copy Markdown
Member Author

Holzhaus commented Nov 5, 2020

I'm pretty sure m_iCurrentlyPreviewingHotcues should be an atomic. It's also modified by updateIndicatorsAndModifyPlay which is called from the engine thread.

@daschuer
Copy link
Copy Markdown
Member

daschuer commented Nov 5, 2020

Uh that is problematic, because sometimes the m_iCurrentlyPreviewingHotcues is test to 0 because of an earlier check of the same value. A Atomic allwn will not help. Too bad.

@daschuer
Copy link
Copy Markdown
Member

daschuer commented Nov 5, 2020

We need to refactor isPlayingByPlayButton() to something like.
checkAndResetPreviewing() to allow atomic reset of m_iCurrentlyPreviewingHotcue

@Holzhaus
Copy link
Copy Markdown
Member Author

Holzhaus commented Nov 5, 2020

Here's some log output:

Apparently the issue is in the 3 block where updateIndicatorsAndModifyPlay is called with first argument set to false instead of true.

debug [Main] keyboard press:  "C"
warning [Main] CueControl::hotcueActivatePreview 1 0
warning [Main] updateIndicatorsAndModifyPlay true true 1 false
warning [Engine] updateIndicatorsAndModifyPlay true true 1 false
warning [Main] CueControl::hotcueActivatePreview 0 1
warning [Main] m_iCurrentlyPreviewingHotcues 0
warning [Main] updateIndicatorsAndModifyPlay false true 0 false
warning [Engine] updateIndicatorsAndModifyPlay false true 0 false

debug [Main] keyboard press:  "Z"
warning [Main] CueControl::hotcueActivatePreview 1 0
warning [Main] updateIndicatorsAndModifyPlay true true 1 false
warning [Engine] updateIndicatorsAndModifyPlay true true 1 false
warning [Main] CueControl::hotcueActivatePreview 0 1
warning [Main] m_iCurrentlyPreviewingHotcues 0
warning [Main] updateIndicatorsAndModifyPlay false true 0 false
warning [Engine] updateIndicatorsAndModifyPlay false true 0 false

debug [Main] keyboard press:  "C"
warning [Main] CueControl::hotcueActivatePreview 1 0
warning [Main] updateIndicatorsAndModifyPlay true true 1 false
warning [Engine] updateIndicatorsAndModifyPlay false true 1 false
warning [Engine] m_iCurrentlyPreviewingHotcues = 0
warning [Main] CueControl::hotcueActivatePreview 0 0

@Holzhaus
Copy link
Copy Markdown
Member Author

Holzhaus commented Nov 5, 2020

I have a hunch that this is caused by EngineBuffer::slotControlPlayRequest being triggered after the EngineBuffer::setNewPlayPos is set in the engine thread sometimes.

@Holzhaus Holzhaus marked this pull request as ready for review November 5, 2020 14:34
@Holzhaus
Copy link
Copy Markdown
Member Author

Holzhaus commented Nov 5, 2020

Let's merge this, as it fixes an issue when pressing 2 hotcue buttons concurrently. The other issue is also present in the 2.3 branch and also happens with regular cues, so it was not caused by #2194.

Copy link
Copy Markdown
Member

@daschuer daschuer left a comment

Choose a reason for hiding this comment

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

OK, LGTM

@daschuer daschuer merged commit f8e2265 into mixxxdj:main Nov 5, 2020
@daschuer
Copy link
Copy Markdown
Member

daschuer commented Nov 5, 2020

I can confirm that 2.3 is also affected by the issue. When this happens the hotcue_X_enabled control also sticks with 1, which is somehow correct :-/

@daschuer
Copy link
Copy Markdown
Member

daschuer commented Nov 5, 2020

I got it.

It it:

seekAbs(position);
m_pPlay->set(1.0);

It happens that the engine with higher priority processes the seek before the play is set.
In this case the pause state is verified and treated as a latching.
If we swap the commands, the engine may start playing at the old position which should be also avoided.

I will issue a PR.

@Holzhaus
Copy link
Copy Markdown
Member Author

Holzhaus commented Nov 5, 2020

I did swap it locally but I could still reproduce the issue IIRC. Worth a try anyway.

@daschuer
Copy link
Copy Markdown
Member

daschuer commented Nov 5, 2020

Swapping does not work:
This works for me: #3268

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants