diff --git a/src/components/core/CoreManager.cpp b/src/components/core/CoreManager.cpp index 8ce99d21d..6270e76e9 100644 --- a/src/components/core/CoreManager.cpp +++ b/src/components/core/CoreManager.cpp @@ -247,16 +247,13 @@ void CoreManager::createLinphoneCore (const QString &configPath) { // Migration of configuration and database files from GTK version of Linphone. Paths::migrate(); - setResourcesPaths(); - mCore = linphone::Factory::get()->createCore( Paths::getConfigFilePath(configPath), Paths::getFactoryConfigFilePath(), nullptr ); mCore->addListener(mHandlers); - mCore->setVideoDisplayFilter("MSOGL"); mCore->usePreviewWindow(true); mCore->setUserAgent( @@ -268,7 +265,6 @@ void CoreManager::createLinphoneCore (const QString &configPath) { ), mCore->getVersion() ); - // Force capture/display. // Useful if the app was built without video support. // (The capture/display attributes are reset by the core in this case.) @@ -277,12 +273,9 @@ void CoreManager::createLinphoneCore (const QString &configPath) { config->setInt("video", "capture", 1); config->setInt("video", "display", 1); } - mCore->start(); - setDatabasesPaths(); setOtherPaths(); - mCore->enableFriendListSubscription(true); } diff --git a/src/components/sound-player/SoundPlayer.cpp b/src/components/sound-player/SoundPlayer.cpp index 7d5d933bc..2036d3f48 100644 --- a/src/components/sound-player/SoundPlayer.cpp +++ b/src/components/sound-player/SoundPlayer.cpp @@ -43,7 +43,6 @@ public: private: void onEofReached (const shared_ptr &) override { QMutex &mutex = mSoundPlayer->mForceCloseMutex; - // Workaround. // This callback is called in a standard thread of mediastreamer, not a QThread. // Signals, connect functions, timers... are unavailable. @@ -51,7 +50,6 @@ private: mSoundPlayer->mForceClose = true; mutex.unlock(); } - SoundPlayer *mSoundPlayer; }; @@ -59,14 +57,12 @@ private: SoundPlayer::SoundPlayer (QObject *parent) : QObject(parent) { CoreManager *coreManager = CoreManager::getInstance(); - SettingsModel *settingsModel = coreManager->getSettingsModel(); + SettingsModel *settingsModel = coreManager->getSettingsModel(); mForceCloseTimer = new QTimer(this); + mForceCloseTimer->setInterval(ForceCloseTimerInterval); - QObject::connect(mForceCloseTimer, &QTimer::timeout, this, &SoundPlayer::handleEof); - mHandlers = make_shared(this); - QObject::connect(settingsModel, &SettingsModel::ringerDeviceChanged, this, [this] { rebuildInternalPlayer(); }); @@ -83,15 +79,13 @@ SoundPlayer::~SoundPlayer () { void SoundPlayer::pause () { if (mPlaybackState == SoundPlayer::PausedState) return; - if (mInternalPlayer->pause()) { setError(QStringLiteral("Unable to pause: `%1`").arg(mSource)); return; } - mForceCloseTimer->stop(); mPlaybackState = SoundPlayer::PausedState; - + emit paused(); emit playbackStateChanged(mPlaybackState); } @@ -99,7 +93,6 @@ void SoundPlayer::pause () { void SoundPlayer::play () { if (mPlaybackState == SoundPlayer::PlayingState) return; - if ( (mPlaybackState == SoundPlayer::StoppedState || mPlaybackState == SoundPlayer::ErrorState) && mInternalPlayer->open(Utils::appStringToCoreString(mSource)) @@ -107,16 +100,14 @@ void SoundPlayer::play () { qWarning() << QStringLiteral("Unable to open: `%1`").arg(mSource); return; } - if (mInternalPlayer->start() ) { setError(QStringLiteral("Unable to play: `%1`").arg(mSource)); return; } - mForceCloseTimer->start(); mPlaybackState = SoundPlayer::PlayingState; - + emit playing(); emit playbackStateChanged(mPlaybackState); } @@ -157,12 +148,10 @@ void SoundPlayer::rebuildInternalPlayer () { void SoundPlayer::stop (bool force) { if (mPlaybackState == SoundPlayer::StoppedState && !force) return; - mForceCloseTimer->stop(); mPlaybackState = SoundPlayer::StoppedState; mInternalPlayer->close(); - - + emit stopped(); emit playbackStateChanged(mPlaybackState); } diff --git a/src/utils/MediastreamerUtils.cpp b/src/utils/MediastreamerUtils.cpp index 4f530da2e..890803a3c 100644 --- a/src/utils/MediastreamerUtils.cpp +++ b/src/utils/MediastreamerUtils.cpp @@ -45,11 +45,9 @@ SimpleCaptureGraph::~SimpleCaptureGraph() } void SimpleCaptureGraph::init() { - if (!audioCapture) { audioCapture = ms_snd_card_create_reader(captureCard); } - if (!audioSink) { audioSink = ms_snd_card_create_writer(playbackCard); } @@ -67,9 +65,7 @@ void SimpleCaptureGraph::init() { //Mute playback float muteGain = 0.0f; ms_filter_call_method(playbackVolumeFilter, static_cast(MS_VOLUME_SET_GAIN), &muteGain); - ticker = ms_ticker_new(); - running = false; } @@ -92,11 +88,9 @@ void SimpleCaptureGraph::destroy() { stop(); } ms_ticker_destroy(ticker); - ms_filter_unlink(playbackVolumeFilter, 0, audioSink, 0); ms_filter_unlink(captureVolumeFilter, 0, playbackVolumeFilter, 0); ms_filter_unlink(audioCapture, 0, captureVolumeFilter, 0); - ms_filter_destroy(playbackVolumeFilter); ms_filter_destroy(captureVolumeFilter); ms_filter_destroy(audioSink);