From 8d34a4f8c12d624deb72878d7a6682e306f71d1a Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 9 Dec 2016 18:49:48 +0200 Subject: MAINT-6840 start and pause doesn't wotk reliably and can get stuck --- indra/media_plugins/libvlc/media_plugin_libvlc.cpp | 17 ++++++++++------- indra/newview/llviewermedia.cpp | 3 +-- 2 files changed, 11 insertions(+), 9 deletions(-) (limited to 'indra') diff --git a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp index 0bd323eb58..ebcdde2960 100644 --- a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp +++ b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp @@ -84,6 +84,7 @@ private: float mCurTime; float mDuration; + EStatus mVlcStatus; }; //////////////////////////////////////////////////////////////////////////////// @@ -111,6 +112,7 @@ MediaPluginBase(host_send_func, host_user_data) mURL = std::string(); + mVlcStatus = STATUS_NONE; setStatus(STATUS_NONE); } @@ -209,28 +211,28 @@ void MediaPluginLibVLC::eventCallbacks(const libvlc_event_t* event, void* ptr) switch (event->type) { case libvlc_MediaPlayerOpening: - parent->setStatus(STATUS_LOADING); + parent->mVlcStatus = STATUS_LOADING; break; case libvlc_MediaPlayerPlaying: parent->mDuration = (float)(libvlc_media_get_duration(parent->mLibVLCMedia)) / 1000.0f; - parent->setStatus(STATUS_PLAYING); + parent->mVlcStatus = STATUS_PLAYING; break; case libvlc_MediaPlayerPaused: - parent->setStatus(STATUS_PAUSED); + parent->mVlcStatus = STATUS_PAUSED; break; case libvlc_MediaPlayerStopped: - parent->setStatus(STATUS_DONE); + parent->mVlcStatus = STATUS_DONE; break; case libvlc_MediaPlayerEndReached: - parent->setStatus(STATUS_DONE); + parent->mVlcStatus = STATUS_DONE; break; case libvlc_MediaPlayerEncounteredError: - parent->setStatus(STATUS_ERROR); + parent->mVlcStatus = STATUS_ERROR; break; case libvlc_MediaPlayerTimeChanged: @@ -446,6 +448,7 @@ void MediaPluginLibVLC::receiveMessage(const char* message_string) } else if (message_name == "idle") { + setStatus(mVlcStatus); } else if (message_name == "cleanup") { @@ -567,7 +570,7 @@ void MediaPluginLibVLC::receiveMessage(const char* message_string) { if (mLibVLCMediaPlayer) { - libvlc_media_player_pause(mLibVLCMediaPlayer); + libvlc_media_player_set_pause(mLibVLCMediaPlayer, 1); } } else if (message_name == "seek") diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index ec06cc432f..bf98650afd 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -810,7 +810,7 @@ void LLViewerMedia::updateMedia(void *dummy_arg) sAnyMediaShowing = true; } - if (!pimpl->getUsedInUI() && pimpl->hasMedia() && (!pimpl->isMediaPaused() || !pimpl->isMediaTimeBased())) + if (!pimpl->getUsedInUI() && pimpl->hasMedia() && pimpl->isMediaPlaying()) { sAnyMediaPlaying = true; } @@ -949,7 +949,6 @@ void LLViewerMedia::setAllMediaPaused(bool val) if (pimpl->isMediaTimeBased() && pimpl->isMediaPaused()) { pimpl->play(); - return; } } else if (pimpl->isMediaTimeBased() && pimpl->mMediaSource) -- cgit v1.2.3