diff options
-rw-r--r-- | indra/newview/llviewermedia.cpp | 24 | ||||
-rw-r--r-- | indra/newview/llviewermedia.h | 1 | ||||
-rw-r--r-- | indra/newview/llvovolume.cpp | 4 |
3 files changed, 27 insertions, 2 deletions
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 40bf9fb1fe..11c1fcb1ea 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -261,9 +261,18 @@ viewer_media_t LLViewerMedia::updateMediaImpl(LLMediaEntry* media_entry, const s media_impl->mMediaSource->setSize(media_entry->getWidthPixels(), media_entry->getHeightPixels()); } - if((was_loaded || (media_entry->getAutoPlay() && gSavedSettings.getBOOL("AutoPlayMedia"))) && !update_from_self) + if(media_entry->getCurrentURL().empty()) { - if(!media_entry->getCurrentURL().empty()) + // The current media URL is now empty. Unload the media source. + media_impl->unload(); + } + else + { + // The current media URL is not empty. + // If (the media was already loaded OR the media was set to autoplay) AND this update didn't come from this agent, + // do a navigate. + + if((was_loaded || (media_entry->getAutoPlay() && gSavedSettings.getBOOL("AutoPlayMedia"))) && !update_from_self) { needs_navigate = (media_entry->getCurrentURL() != previous_url); } @@ -1261,6 +1270,17 @@ void LLViewerMediaImpl::navigateHome() } ////////////////////////////////////////////////////////////////////////////////////////// +void LLViewerMediaImpl::unload() +{ + // Unload the media impl and clear its state. + destroyMediaSource(); + resetPreviousMediaState(); + mMediaURL.clear(); + mMimeType.clear(); + mCurrentMediaURL.clear(); +} + +////////////////////////////////////////////////////////////////////////////////////////// void LLViewerMediaImpl::navigateTo(const std::string& url, const std::string& mime_type, bool rediscover_type, bool server_request) { if(mMediaURL != url) diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h index 4cb0817735..7cbfb56ffc 100644 --- a/indra/newview/llviewermedia.h +++ b/indra/newview/llviewermedia.h @@ -165,6 +165,7 @@ public: void navigateForward(); void navigateReload(); void navigateHome(); + void unload(); void navigateTo(const std::string& url, const std::string& mime_type = "", bool rediscover_type = false, bool server_request = false); void navigateInternal(); void navigateStop(); diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index a32abf3ab9..c987dd1764 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1733,6 +1733,10 @@ void LLVOVolume::syncMediaData(S32 texture_index, const LLSD &media_data, bool m addMediaImpl(media_impl, texture_index) ; } + else + { + removeMediaImpl(texture_index); + } //llinfos << "AFTER: texture_index = " << texture_index // << " hasMedia = " << te->hasMedia() << " : " |