diff options
Diffstat (limited to 'indra/newview/llviewermedia.cpp')
-rw-r--r-- | indra/newview/llviewermedia.cpp | 53 |
1 files changed, 47 insertions, 6 deletions
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 55e4f28e75..69650425cb 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); } @@ -450,12 +459,12 @@ LLViewerMedia::impl_list &LLViewerMedia::getPriorityList() // This is the predicate function used to sort sViewerMediaImplList by priority. bool LLViewerMedia::priorityComparitor(const LLViewerMediaImpl* i1, const LLViewerMediaImpl* i2) { - if(i1->isForcedUnloaded()) + if(i1->isForcedUnloaded() && !i2->isForcedUnloaded()) { // Muted or failed items always go to the end of the list, period. return false; } - else if(i2->isForcedUnloaded()) + else if(i2->isForcedUnloaded() && !i1->isForcedUnloaded()) { // Muted or failed items always go to the end of the list, period. return true; @@ -480,6 +489,16 @@ bool LLViewerMedia::priorityComparitor(const LLViewerMediaImpl* i1, const LLView // i2 is a UI element, i1 is not. This makes i2 "less than" i1, so it sorts earlier in our list. return false; } + else if(i1->isParcelMedia()) + { + // The parcel media impl sorts above all other inworld media, unless one has focus. + return true; + } + else if(i2->isParcelMedia()) + { + // The parcel media impl sorts above all other inworld media, unless one has focus. + return false; + } else { // The object with the larger interest value should be earlier in the list, so we reverse the sense of the comparison here. @@ -658,6 +677,8 @@ LLViewerMediaImpl::LLViewerMediaImpl( const LLUUID& texture_id, mMediaAutoScale(media_auto_scale), mMediaLoop(media_loop), mNeedsNewTexture(true), + mTextureUsedWidth(0), + mTextureUsedHeight(0), mSuspendUpdates(false), mVisible(true), mLastSetCursor( UI_CURSOR_ARROW ), @@ -675,6 +696,7 @@ LLViewerMediaImpl::LLViewerMediaImpl( const LLUUID& texture_id, mPreviousMediaState(MEDIA_NONE), mPreviousMediaTime(0.0f), mIsDisabled(false), + mIsParcelMedia(false), mProximity(-1), mIsUpdated(false) { @@ -1259,6 +1281,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) @@ -1568,8 +1601,11 @@ LLViewerMediaTexture* LLViewerMediaImpl::updatePlaceholderImage() if (mNeedsNewTexture || placeholder_image->getUseMipMaps() - || placeholder_image->getWidth() != mMediaSource->getTextureWidth() - || placeholder_image->getHeight() != mMediaSource->getTextureHeight()) + || (placeholder_image->getWidth() != mMediaSource->getTextureWidth()) + || (placeholder_image->getHeight() != mMediaSource->getTextureHeight()) + || (mTextureUsedWidth > mMediaSource->getWidth()) + || (mTextureUsedHeight > mMediaSource->getHeight()) + ) { LL_DEBUGS("Media") << "initializing media placeholder" << LL_ENDL; LL_DEBUGS("Media") << "movie image id " << mTextureId << LL_ENDL; @@ -1601,6 +1637,11 @@ LLViewerMediaTexture* LLViewerMediaImpl::updatePlaceholderImage() // FIXME // placeholder_image->mIsMediaTexture = true; mNeedsNewTexture = false; + + // If the amount of the texture being drawn by the media goes down in either width or height, + // recreate the texture to avoid leaving parts of the old image behind. + mTextureUsedWidth = mMediaSource->getWidth(); + mTextureUsedHeight = mMediaSource->getHeight(); } return placeholder_image; |