#include <QDateTime>
#include <QMutex>
#include "media.h"
Go to the source code of this file.
Definition at line 102 of file media_linux.cpp.
References lastKnown.
104 static pa_threaded_mainloop* mainLoop =
nullptr;
106 QMutexLocker locker(&mutex);
110 if(mainLoop ==
nullptr){
111 mainLoop = pa_threaded_mainloop_new();
112 if(mainLoop ==
nullptr)
115 if(pa_threaded_mainloop_start(mainLoop) != 0){
116 pa_threaded_mainloop_free(mainLoop);
125 if(paContext ==
nullptr && QDateTime::currentMSecsSinceEpoch() >= reconnectTime){
126 pa_threaded_mainloop_lock(mainLoop);
128 pa_mainloop_api* api = pa_threaded_mainloop_get_api(mainLoop);
129 Q_ASSERT(api !=
nullptr);
131 paContext = pa_context_new(api,
"QPulse");
132 Q_ASSERT(paContext !=
nullptr);
133 pa_context_set_state_callback(paContext, &ContextStateCallback,
nullptr);
134 pa_context_connect(paContext,
nullptr, PA_CONTEXT_NOFAIL,
nullptr);
136 pa_threaded_mainloop_unlock(mainLoop);