From caadf0be39b844e6bf91c5a302a837d107a1e415 Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Mon, 9 Nov 2009 16:19:33 -0800 Subject: Fix for DEV-42029 (changing media on multiple faces can make a zombie SLPlugin). Made LLViewerMedia::updateMediaImpl() unload the impl's media plugin when the current URL goes empty. Made LLVOVolume::syncMediaData() call removeMediaImpl() if the media data gets deleted. --- indra/newview/llviewermedia.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'indra/newview/llviewermedia.cpp') diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 40bf9fb1fe..91f4ff9b84 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -261,9 +261,19 @@ 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. + if(was_loaded) + media_impl->destroyMediaSource(); + } + 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); } -- cgit v1.2.3 From 312e7d21a4d4996460e84aca478691ac0a4828ea Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Mon, 9 Nov 2009 17:11:13 -0800 Subject: Refinement to my previous commit: Created LLViewerMediaImpl::unload(), which unloads the media and clears internal state (such as the last-navigated URL) to keep it from getting reloaded. LLViewerMedia::updateMediaImpl() now calls unload() on the impl instead of just using destroyMediaSource(). --- indra/newview/llviewermedia.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'indra/newview/llviewermedia.cpp') diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 91f4ff9b84..11c1fcb1ea 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -264,8 +264,7 @@ viewer_media_t LLViewerMedia::updateMediaImpl(LLMediaEntry* media_entry, const s if(media_entry->getCurrentURL().empty()) { // The current media URL is now empty. Unload the media source. - if(was_loaded) - media_impl->destroyMediaSource(); + media_impl->unload(); } else { @@ -1270,6 +1269,17 @@ void LLViewerMediaImpl::navigateHome() navigateTo(mHomeURL, "", true, false); } +////////////////////////////////////////////////////////////////////////////////////////// +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) { -- cgit v1.2.3 From ca1356d4655223781b5e317b430c67fcb081249c Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Mon, 9 Nov 2009 18:41:55 -0800 Subject: LLViewerMediaImpl now keeps track of which instance is the current parcel media instance. The active parcel media instance always gets priority over other inworld media. --- indra/newview/llviewermedia.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'indra/newview/llviewermedia.cpp') diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 11c1fcb1ea..69650425cb 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -459,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; @@ -489,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. @@ -686,6 +696,7 @@ LLViewerMediaImpl::LLViewerMediaImpl( const LLUUID& texture_id, mPreviousMediaState(MEDIA_NONE), mPreviousMediaTime(0.0f), mIsDisabled(false), + mIsParcelMedia(false), mProximity(-1), mIsUpdated(false) { -- cgit v1.2.3 From 2fd31363f747aaf0ec3d3d6b5711e0ecc99b2cf3 Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Tue, 10 Nov 2009 15:57:26 -0800 Subject: Added PluginAttachDebuggerToPlugins debug setting. Added accessors to get platform-specific process ID from LLProcessLauncher. Added an optional "debug" argument to LLPluginClassMedia::init() and LLPluginProcessParent::init() (defaults to false). Mac only: made the state machine in LLPluginProcessParent::idle() open a new window in Terminal.app with a gdb session attached to the plugin process upon successful launch. --- indra/newview/llviewermedia.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llviewermedia.cpp') diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 69650425cb..66d48fadd1 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -847,7 +847,7 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_ { LLPluginClassMedia* media_source = new LLPluginClassMedia(owner); media_source->setSize(default_width, default_height); - if (media_source->init(launcher_name, plugin_name)) + if (media_source->init(launcher_name, plugin_name, gSavedSettings.getBOOL("PluginAttachDebuggerToPlugins"))) { return media_source; } -- cgit v1.2.3 From 9d2102519d88feec434b79e1d9bb7d86ac6e7794 Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Tue, 10 Nov 2009 16:49:57 -0800 Subject: Fix for DEV-42400 (Mouse pointer location does not map correctly to non-square media faces). --- indra/newview/llviewermedia.cpp | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) (limited to 'indra/newview/llviewermedia.cpp') diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 66d48fadd1..605861f1cb 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -1133,11 +1133,15 @@ void LLViewerMediaImpl::mouseMove(S32 x, S32 y, MASK mask) void LLViewerMediaImpl::mouseDown(const LLVector2& texture_coords, MASK mask, S32 button) { if(mMediaSource) - { - mouseDown( - llround(texture_coords.mV[VX] * mMediaSource->getTextureWidth()), - llround((1.0f - texture_coords.mV[VY]) * mMediaSource->getTextureHeight()), - mask, button); + { + // scale x and y to texel units. + S32 x = llround(texture_coords.mV[VX] * mMediaSource->getTextureWidth()); + S32 y = llround((1.0f - texture_coords.mV[VY]) * mMediaSource->getTextureHeight()); + + // Adjust for the difference between the actual texture height and the amount of the texture in use. + y -= (mMediaSource->getTextureHeight() - mMediaSource->getHeight()); + + mouseDown(x, y, mask, button); } } @@ -1145,10 +1149,14 @@ void LLViewerMediaImpl::mouseUp(const LLVector2& texture_coords, MASK mask, S32 { if(mMediaSource) { - mouseUp( - llround(texture_coords.mV[VX] * mMediaSource->getTextureWidth()), - llround((1.0f - texture_coords.mV[VY]) * mMediaSource->getTextureHeight()), - mask, button); + // scale x and y to texel units. + S32 x = llround(texture_coords.mV[VX] * mMediaSource->getTextureWidth()); + S32 y = llround((1.0f - texture_coords.mV[VY]) * mMediaSource->getTextureHeight()); + + // Adjust for the difference between the actual texture height and the amount of the texture in use. + y -= (mMediaSource->getTextureHeight() - mMediaSource->getHeight()); + + mouseUp(x, y, mask, button); } } @@ -1156,10 +1164,14 @@ void LLViewerMediaImpl::mouseMove(const LLVector2& texture_coords, MASK mask) { if(mMediaSource) { - mouseMove( - llround(texture_coords.mV[VX] * mMediaSource->getTextureWidth()), - llround((1.0f - texture_coords.mV[VY]) * mMediaSource->getTextureHeight()), - mask); + // scale x and y to texel units. + S32 x = llround(texture_coords.mV[VX] * mMediaSource->getTextureWidth()); + S32 y = llround((1.0f - texture_coords.mV[VY]) * mMediaSource->getTextureHeight()); + + // Adjust for the difference between the actual texture height and the amount of the texture in use. + y -= (mMediaSource->getTextureHeight() - mMediaSource->getHeight()); + + mouseMove(x, y, mask); } } -- cgit v1.2.3 From 8ec85a68acee6b600320b10eea2b9aa11e434e83 Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Tue, 10 Nov 2009 18:47:03 -0800 Subject: Fix for DEV-42328 (Muting then Unmuting All Nearby Media resets nearby media to Home URL). Fixed by having LLViewerMedia::updateMediaImpl() copy the media entry's current URL into the media impl's mMediaURL in the case where the impl has a non-empty media URL but the function doesn't do a navigate. --- indra/newview/llviewermedia.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'indra/newview/llviewermedia.cpp') diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 605861f1cb..493457704b 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -295,11 +295,21 @@ viewer_media_t LLViewerMedia::updateMediaImpl(LLMediaEntry* media_entry, const s } } - if(media_impl && needs_navigate) + if(media_impl) { std::string url = media_entry->getCurrentURL(); - - media_impl->navigateTo(url, "", true, true); + if(needs_navigate) + { + media_impl->navigateTo(url, "", true, true); + } + else if(!media_impl->mMediaURL.empty() && (media_impl->mMediaURL != url)) + { + // If we already have a non-empty media URL set and we aren't doing a navigate, update the media URL to match the media entry. + media_impl->mMediaURL = url; + + // If this causes a navigate at some point (such as after a reload), it should be considered server-driven so it isn't broadcast. + media_impl->mNavigateServerRequest = true; + } } return media_impl; -- cgit v1.2.3