PlayerThread::~PlayerThread()
{
SLOG(LOG_INFO, tts_tag(), "[PlayerThread] Destructor");
- unique_lock<mutex> controlLock(mControlMutex);
+ lock_guard<mutex> controlLock(mControlMutex);
mPlayerAvailable = false;
mPlayUtterance = nullptr;
SLOG(LOG_INFO, tts_tag(), "[PlayerThread] Thread is stopped or waiting");
mThreadCond.notify_all();
- mPlayerThread.join();
+ if (mPlayerThread.joinable()) {
+ mPlayerThread.join();
+ }
SLOG(LOG_INFO, tts_tag(), "[PlayerThread] Finish thread");
}
app.utt_id_stopped = 0;
app.state = g_app_list[i].state;
- temp_app_list.push_back(app);
+ temp_app_list.push_back(std::move(app));
}
lock.unlock();
/* Set default voice */
if (temp->default_lang) {
free(temp->default_lang);
+ temp->default_lang = NULL;
}
temp->default_lang = strdup(TTS_BASE_LANGUAGE);
temp->default_vctype = TTSE_VOICE_TYPE_FEMALE;
result = true;
}
}
- } else if (0 == strncmp(lang, "default", strlen("default")) && 0 != type) {
+ } else if (0 == strncmp(lang, "default", strlen("default") + 1) && 0 != type) {
/* Only lang is default */
if (type == g_engine_info->default_vctype) { // default type != personal_type
*out_lang = strdup(g_engine_info->default_lang);