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

Analysis Fixes #1289

Merged
merged 9 commits into from
Jun 22, 2017
Merged

Analysis Fixes #1289

merged 9 commits into from
Jun 22, 2017

Conversation

uklotzde
Copy link
Contributor

Fixes the following bugs that have recently been reported:

Might also fix the following bug if it is related to missing waveform analysis:

...even if SoundSources should limit the requested amount if needed.
This allows to conditionally create a DbConnectionPooler within a nested
scope.
The initialization of the AnalysisDao with the thread-local database
connection was missing. The restricted design of the analyzer API
required to move the AnalysisDao from AnalyzeWaveform to AnalyzerQueue.
@Be-ing
Copy link
Contributor

Be-ing commented Jun 20, 2017

This fixes both bugs with the waveform analyses for me. Thanks.

@Be-ing
Copy link
Contributor

Be-ing commented Jun 20, 2017

There is a new issue which is minor and not reliably reproducable. Sometimes, I see the waveform loaded from cache immediately, then it seems to be regenerated with a new analysis:

Debug [Main]: SqlTransaction - Started new SQL database transaction on "MIXXX-1" 
Debug [Main]: SoundSourceProxy - SoundSourceProvider "libsndfile" created a SoundSource for file "file:///home/be/music/Mixxx/Recordings/2017-06-17_01h03m42s.wav" of type "wav" 
Debug [Main]: Reading tags from file "/home/be/music/Mixxx/Recordings/2017-06-17_01h03m42s.wav" of type 7 : parsing track metadata , ignoring cover art 
Debug [Main]: TrackDAO: Adding track "/home/be/music/Mixxx/Recordings/2017-06-17_01h03m42s.wav" 
Debug [Main]: SqlTransaction - Committed SQL database transaction on "MIXXX-1" 
Debug [Main]: BaseTrackCache(0x463c9f0) updateIndexWithQuery took 0 ms 
Debug [Thread (pooled)]: SoundSourceProxy - SoundSourceProvider "libsndfile" created a SoundSource for file "file:///home/be/music/Mixxx/Recordings/2017-06-17_01h03m42s.wav" of type "wav" 
Debug [Thread (pooled)]: Reading tags from file "/home/be/music/Mixxx/Recordings/2017-06-17_01h03m42s.wav" of type 7 : ignoring track metadata , parsing cover art 
Debug [Thread (pooled)]: CoverArtUtils::guessCover didn't find art  "CoverInfo(NONE,GUESSED,,0x0,/home/be/music/Mixxx/Recordings/2017-06-17_01h03m42s.wav,)" 
Debug [Main]: BaseTrackPlayerImpl::slotLoadTrack 
Debug [CachingReaderWorker 1]: SoundSourceProxy - SoundSourceProvider "libsndfile" created a SoundSource for file "file:///home/be/music/Mixxx/Recordings/2017-06-17_01h03m42s.wav" of type "wav" 
Debug [CachingReaderWorker 1]: SoundSourceProxy - Opening file "file:///home/be/music/Mixxx/Recordings/2017-06-17_01h03m42s.wav" with provider "libsndfile" 
Debug [Main]: BaseTrackPlayerImpl::slotTrackLoaded 
Debug [Main]: SoundSourceProxy - SoundSourceProvider "libsndfile" created a SoundSource for file "file:///home/be/music/Mixxx/Recordings/2017-06-17_01h03m42s.wav" of type "wav" 
Debug [Main]: SoundSourceProxy - Skip parsing of track metadata from file "file:///home/be/music/Mixxx/Recordings/2017-06-17_01h03m42s.wav" 
Debug [Main]: WSpinny::slotCoverFound WSpinny(0x391f27d0, name = "SpinnySingletonWithCover[Channel1]")  "CoverInfo(NONE,GUESSED,,0x0,/home/be/music/Mixxx/Recordings/2017-06-17_01h03m42s.wav,)" QSize(0, 0) 
Debug [Main]: WSpinny::slotCoverFound WSpinny(0x3a2e2f50, name = "SpinnySingletonNoCover[Channel1]")  "CoverInfo(NONE,GUESSED,,0x0,/home/be/music/Mixxx/Recordings/2017-06-17_01h03m42s.wav,)" QSize(0, 0) 
Debug [Main]: WCoverArt::slotCoverFound WCoverArt(0x499b2290, name = "DeckCoverArt")  "CoverInfo(NONE,GUESSED,,0x0,/home/be/music/Mixxx/Recordings/2017-06-17_01h03m42s.wav,)" QSize(0, 0) 
Debug [AnalyzerQueue 1]: AnalysisDAO fetched 0 analyses, 0 bytes for track 5894 in 0 ms 
Debug [AnalyzerQueue 1]: AnalyzerQueue - Interrupting analysis to give preference to a loaded track. 
Debug [AnalyzerQueue 1]: AnalyzerQueue - Prioritizing "2017-06-17 01h03m42s" "/home/be/music/Mixxx/Recordings/2017-06-17_01h03m42s.wav" 
Debug [AnalyzerQueue 1]: AnalyzerQueue - Analyzing "2017-06-17 01h03m42s" "/home/be/music/Mixxx/Recordings/2017-06-17_01h03m42s.wav" 
Debug [AnalyzerQueue 1]: SoundSourceProxy - SoundSourceProvider "libsndfile" created a SoundSource for file "file:///home/be/music/Mixxx/Recordings/2017-06-17_01h03m42s.wav" of type "wav" 
Debug [AnalyzerQueue 1]: SoundSourceProxy - Opening file "file:///home/be/music/Mixxx/Recordings/2017-06-17_01h03m42s.wav" with provider "libsndfile" 
Debug [AnalyzerQueue 1]: AnalysisDAO fetched 0 analyses, 0 bytes for track 5894 in 0 ms 
Debug [AnalyzerQueue 1]: Vampanalyzer BlockSize:  1024 
Debug [AnalyzerQueue 1]: Vampanalyzer StepSize:  512 
Debug [AnalyzerQueue 1]: Beat calculation started with plugin "qm-tempotracker:0" 
Debug [AnalyzerQueue 1]: Vampanalyzer BlockSize:  32768 
Debug [AnalyzerQueue 1]: Vampanalyzer StepSize:  32768 
Debug [AnalyzerQueue 1]: Key calculation started with plugin "qm-keydetector:2"

@uklotzde
Copy link
Contributor Author

The implementation of AnalyzerQueue is not thread-safe. Small changes in timings between the threads might have unintended side effects. Unfortunately this is not the only piece of code in Mixxx that needs to be fixed eventually.

mixxx::DbConnectionPooler dbConnectionPooler;
if (m_pAnalysisDao) {
// Only create/open a new database connection for when needed
// for storing waveform analyses
Copy link
Member

Choose a reason for hiding this comment

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

How about:
// m_pAnalysisDao ramains null if no analyzer needs database access.
// currently only waveform analyses makes use of it.

m_pDbConnectionPool = std::move(other.m_pDbConnectionPool);
// Move assignment should transfer ownership by invalidating
// the other instance.
DEBUG_ASSERT(!other);
Copy link
Member

@daschuer daschuer Jun 21, 2017

Choose a reason for hiding this comment

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

This is hard to understand here, the drawback of operator overloads.
How about replace it by a named function like
DEBUG_ASSERT(!other.initalized());
Or just by
DEBUG_ASSERT(!other.m_pDbConnectionPool)
or just remove the Assert, because it is obvious that it works.

@@ -302,21 +302,22 @@ void AnalyzerQueue::run() {
}

void AnalyzerQueue::execThread() {
// The thread-local database connection for waveform anylsis must not
// be closed before returning from this function. Therefore the
// DbConnectionPooler is defined at the outher function scope,
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo here. Did you mean "other" or "outer"?

@daschuer
Copy link
Member

Thank you very much! LGTM

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.

3 participants