diff options
Diffstat (limited to 'indra/newview/llviewermedia.h')
-rw-r--r-- | indra/newview/llviewermedia.h | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h index 71cec5125d..c2e6564166 100644 --- a/indra/newview/llviewermedia.h +++ b/indra/newview/llviewermedia.h @@ -197,7 +197,10 @@ public: U8 media_loop); ~LLViewerMediaImpl(); - + + static void initClass(LLWindow* window, bool multi_threaded = false); + static void cleanupClass(); + // Override inherited version from LLViewerMediaEventEmitter virtual void emitEvent(LLPluginClassMedia* self, LLViewerMediaObserver::EMediaEvent event); @@ -266,6 +269,9 @@ public: void scaleTextureCoords(const LLVector2& texture_coords, S32 *x, S32 *y); void update(); + bool preUpdateMediaTexture(); + void doMediaTexUpdate(); + bool postUpdateMediaTexture(); void updateImagesMediaStreams(); LLUUID getMediaTextureID() const; @@ -490,6 +496,34 @@ private: private: LLViewerMediaTexture *updatePlaceholderImage(); + LL::WorkQueue::weak_t mMainQueue; + LL::WorkQueue::weak_t mTexUpdateQueue; + +}; + +// Define a worker thread pool for media updates ( LLImageGLThread) +class LLMediaTextureUpdateThread : public LLSimpleton<LLMediaTextureUpdateThread>, LL::ThreadPool +{ +public: + // follows gSavedSettings "RenderGLMultiThreaded" + static bool sEnabled; + + LLMediaTextureUpdateThread(LLWindow* window); + + // post a function to be executed on the LLMediaTextureUpdateThread background thread + template <typename CALLABLE> + bool post(CALLABLE&& func) + { + return getQueue().postIfOpen(std::forward<CALLABLE>(func)); + } + + void run() override; + +private: + LLWindow* mWindow; + void* mContext = nullptr; + LLAtomicBool mFinished; }; + #endif // LLVIEWERMEDIA_H |