Analysis Fixes#1289
Conversation
...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.
|
This fixes both bugs with the waveform analyses for me. Thanks. |
|
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: |
|
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 |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
| 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, |
There was a problem hiding this comment.
Typo here. Did you mean "other" or "outer"?
|
Thank you very much! LGTM |
Fixes the following bugs that have recently been reported:
Might also fix the following bug if it is related to missing waveform analysis:
I wasn't able to reproduce the reported behavior, which might depend on user preference settings.