From f26f1ca0f4545e695bfb731abd5d8c078de74e1f Mon Sep 17 00:00:00 2001
From: andreykproductengine <akleshchev@productengine.com>
Date: Thu, 14 Jan 2016 17:26:17 +0200
Subject: MAINT-6042 FIXED Audio/Media automatically starts playing again after
 clicking "Stop All"

---
 indra/newview/llviewerparcelmgr.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

(limited to 'indra/newview/llviewerparcelmgr.cpp')

diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp
index 2a6b105cab..0f5b52c8d6 100755
--- a/indra/newview/llviewerparcelmgr.cpp
+++ b/indra/newview/llviewerparcelmgr.cpp
@@ -1453,6 +1453,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
 	BOOL	region_deny_identified_override = false; // Deprecated
 	BOOL	region_deny_transacted_override = false; // Deprecated
 	BOOL	region_deny_age_unverified_override = false;
+    BOOL	changed_parcel = false;
 
 	S32		other_clean_time = 0;
 
@@ -1571,6 +1572,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
 		if (parcel == parcel_mgr.mAgentParcel)
 		{
 			// new agent parcel
+			changed_parcel = true;
 			S32 bitmap_size =	parcel_mgr.mParcelsPerEdge
 								* parcel_mgr.mParcelsPerEdge
 								/ 8;
@@ -1759,7 +1761,8 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
 				LLStringUtil::trim(music_url);
 
 				// If there is a new music URL and it's valid, play it.
-				if (music_url.size() > 12)
+				const std::string& stream_url = gAudiop->getInternetStreamURL();
+				if (music_url.size() > 12 && (music_url != stream_url || changed_parcel))
 				{
 					if (music_url.substr(0,7) == "http://")
 					{
@@ -1773,7 +1776,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
 						LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLStringUtil::null);
 					}
 				}
-				else if (!gAudiop->getInternetStreamURL().empty())
+				else if (!stream_url.empty())
 				{
 					LL_INFOS() << "Stopping parcel music (parcel stream URL is empty)" << LL_ENDL;
 					// null value causes fade out
-- 
cgit v1.2.3


From dab96aad7f0af2017cb931eb4cdaf5367f835e29 Mon Sep 17 00:00:00 2001
From: andreykproductengine <none@none>
Date: Sun, 24 Jan 2016 23:54:46 +0200
Subject: MAINT-6042 FIXED Regular agent-parcel updates should not restart
 stopped audio

---
 indra/newview/llviewerparcelmgr.cpp | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

(limited to 'indra/newview/llviewerparcelmgr.cpp')

diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp
index 0f5b52c8d6..e4d24823f7 100755
--- a/indra/newview/llviewerparcelmgr.cpp
+++ b/indra/newview/llviewerparcelmgr.cpp
@@ -1453,7 +1453,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
 	BOOL	region_deny_identified_override = false; // Deprecated
 	BOOL	region_deny_transacted_override = false; // Deprecated
 	BOOL	region_deny_age_unverified_override = false;
-    BOOL	changed_parcel = false;
+    BOOL	agent_teleported = false;
 
 	S32		other_clean_time = 0;
 
@@ -1572,7 +1572,6 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
 		if (parcel == parcel_mgr.mAgentParcel)
 		{
 			// new agent parcel
-			changed_parcel = true;
 			S32 bitmap_size =	parcel_mgr.mParcelsPerEdge
 								* parcel_mgr.mParcelsPerEdge
 								/ 8;
@@ -1590,6 +1589,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
 
 			if (instance->mTeleportInProgress)
 			{
+				agent_teleported = true;
 				instance->mTeleportInProgress = FALSE;
 				if(instance->mTeleportInProgressPosition.isNull())
 				{
@@ -1755,14 +1755,18 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
 			if (parcel)
 			{
 				std::string music_url_raw = parcel->getMusicURL();
+				const std::string& stream_url = gAudiop->getInternetStreamURL();
 
 				// Trim off whitespace from front and back
 				std::string music_url = music_url_raw;
 				LLStringUtil::trim(music_url);
 
-				// If there is a new music URL and it's valid, play it.
-				const std::string& stream_url = gAudiop->getInternetStreamURL();
-				if (music_url.size() > 12 && (music_url != stream_url || changed_parcel))
+				static std::string last_url = "";
+
+				// If music url is valid and url is a new or teleport was performed  - play music.
+				// If url is empty or not usable and there is stream playing - stop music
+				// In all other cases maintain previous state
+				if (music_url.size() > 12 && (music_url != last_url || agent_teleported))
 				{
 					if (music_url.substr(0,7) == "http://")
 					{
@@ -1776,12 +1780,13 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
 						LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLStringUtil::null);
 					}
 				}
-				else if (!stream_url.empty())
+				else if (!stream_url.empty() && (music_url != last_url || music_url.empty()))
 				{
 					LL_INFOS() << "Stopping parcel music (parcel stream URL is empty)" << LL_ENDL;
 					// null value causes fade out
 					LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLStringUtil::null);
 				}
+				last_url = music_url;
 			}
 			else
 			{
-- 
cgit v1.2.3


From 6c218c076b03b73a2c1e7dd68e8c875ea747395f Mon Sep 17 00:00:00 2001
From: andreykproductengine <akleshchev@productengine.com>
Date: Mon, 25 Jan 2016 18:50:57 +0200
Subject: MAINT-6042 region crossing in any form should trigger music check

---
 indra/newview/llviewerparcelmgr.cpp | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

(limited to 'indra/newview/llviewerparcelmgr.cpp')

diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp
index e4d24823f7..abdbaaca03 100755
--- a/indra/newview/llviewerparcelmgr.cpp
+++ b/indra/newview/llviewerparcelmgr.cpp
@@ -1756,17 +1756,22 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
 			{
 				std::string music_url_raw = parcel->getMusicURL();
 				const std::string& stream_url = gAudiop->getInternetStreamURL();
+				LLUUID region_id = gAgent.getRegion()->getRegionID();
 
 				// Trim off whitespace from front and back
 				std::string music_url = music_url_raw;
 				LLStringUtil::trim(music_url);
 
 				static std::string last_url = "";
+				static LLUUID last_region_id = LLUUID::null;
 
-				// If music url is valid and url is a new or teleport was performed  - play music.
+				// If music url is valid and url is a new or teleport/region cross was performed  - play music.
 				// If url is empty or not usable and there is stream playing - stop music
 				// In all other cases maintain previous state
-				if (music_url.size() > 12 && (music_url != last_url || agent_teleported))
+				if (music_url.size() > 12
+					&& (music_url != last_url
+						|| agent_teleported
+						|| last_region_id != region_id))
 				{
 					if (music_url.substr(0,7) == "http://")
 					{
@@ -1787,6 +1792,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
 					LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLStringUtil::null);
 				}
 				last_url = music_url;
+				last_region_id = region_id;
 			}
 			else
 			{
-- 
cgit v1.2.3


From 3ae2ffad75c94c4c8034f11366b776abdb720158 Mon Sep 17 00:00:00 2001
From: andreykproductengine <akleshchev@productengine.com>
Date: Mon, 1 Feb 2016 16:42:30 +0200
Subject: MAINT-6042 FIXED Audio/Media automatically starts playing again after
 clicking "Stop All"

---
 indra/newview/llviewerparcelmgr.cpp | 97 ++++++++++++++++++-------------------
 1 file changed, 47 insertions(+), 50 deletions(-)

(limited to 'indra/newview/llviewerparcelmgr.cpp')

diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp
index abdbaaca03..e72ae88ba2 100755
--- a/indra/newview/llviewerparcelmgr.cpp
+++ b/indra/newview/llviewerparcelmgr.cpp
@@ -1453,7 +1453,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
 	BOOL	region_deny_identified_override = false; // Deprecated
 	BOOL	region_deny_transacted_override = false; // Deprecated
 	BOOL	region_deny_age_unverified_override = false;
-    BOOL	agent_teleported = false;
+    BOOL	agent_parcel_update = false; // updating previous(existing) agent parcel
 
 	S32		other_clean_time = 0;
 
@@ -1543,6 +1543,18 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
 	// Actually extract the data.
 	if (parcel)
 	{
+        if (local_id == parcel_mgr.mAgentParcel->getLocalID())
+        {
+            // Parcels in different regions can have same ids.
+            LLViewerRegion* parcel_region = LLWorld::getInstance()->getRegion(msg->getSender());
+            LLViewerRegion* agent_region = gAgent.getRegion();
+            if (parcel_region && agent_region && parcel_region->getRegionID() == agent_region->getRegionID())
+            {
+                // we got an updated version of agent parcel
+                agent_parcel_update = true;
+            }
+        }
+
 		parcel->init(owner_id,
 			FALSE, FALSE, FALSE,
 			claim_date, claim_price_per_meter, rent_price_per_meter,
@@ -1589,7 +1601,6 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
 
 			if (instance->mTeleportInProgress)
 			{
-				agent_teleported = true;
 				instance->mTeleportInProgress = FALSE;
 				if(instance->mTeleportInProgressPosition.isNull())
 				{
@@ -1602,16 +1613,10 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
 				}
 			}
 		}
-		else if (local_id == parcel_mgr.mAgentParcel->getLocalID())
+		else if (agent_parcel_update)
 		{
-			// Parcels in different regions can have same ids.
-			LLViewerRegion* parcel_region = LLWorld::getInstance()->getRegion( msg->getSender() );
-			LLViewerRegion* agent_region = gAgent.getRegion();
-			if (parcel_region && agent_region && parcel_region->getRegionID() == agent_region->getRegionID())
-			{
-				// updated agent parcel
-				parcel_mgr.mAgentParcel->unpackMessage(msg);
-			}
+			// updated agent parcel
+			parcel_mgr.mAgentParcel->unpackMessage(msg);
 		}
 	}
 
@@ -1754,45 +1759,37 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
 		{
 			if (parcel)
 			{
-				std::string music_url_raw = parcel->getMusicURL();
-				const std::string& stream_url = gAudiop->getInternetStreamURL();
-				LLUUID region_id = gAgent.getRegion()->getRegionID();
-
-				// Trim off whitespace from front and back
-				std::string music_url = music_url_raw;
-				LLStringUtil::trim(music_url);
-
-				static std::string last_url = "";
-				static LLUUID last_region_id = LLUUID::null;
-
-				// If music url is valid and url is a new or teleport/region cross was performed  - play music.
-				// If url is empty or not usable and there is stream playing - stop music
-				// In all other cases maintain previous state
-				if (music_url.size() > 12
-					&& (music_url != last_url
-						|| agent_teleported
-						|| last_region_id != region_id))
-				{
-					if (music_url.substr(0,7) == "http://")
-					{
-						optionally_start_music(music_url);
-					}
-					else
-					{
-						LL_INFOS() << "Stopping parcel music (invalid audio stream URL)" << LL_ENDL;
-						// clears the URL 
-						// null value causes fade out
-						LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLStringUtil::null);
-					}
-				}
-				else if (!stream_url.empty() && (music_url != last_url || music_url.empty()))
-				{
-					LL_INFOS() << "Stopping parcel music (parcel stream URL is empty)" << LL_ENDL;
-					// null value causes fade out
-					LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLStringUtil::null);
-				}
-				last_url = music_url;
-				last_region_id = region_id;
+                // Only update stream if parcel changed (recreated) or music is playing (enabled)
+                if (!agent_parcel_update || gSavedSettings.getBOOL("MediaTentativeAutoPlay"))
+                {
+                    std::string music_url_raw = parcel->getMusicURL();
+
+                    // Trim off whitespace from front and back
+                    std::string music_url = music_url_raw;
+                    LLStringUtil::trim(music_url);
+
+                    // If there is a new music URL and it's valid, play it.
+                    if (music_url.size() > 12)
+                    {
+                        if (music_url.substr(0, 7) == "http://")
+                        {
+                            optionally_start_music(music_url);
+                        }
+                        else
+                        {
+                            LL_INFOS() << "Stopping parcel music (invalid audio stream URL)" << LL_ENDL;
+                            // clears the URL
+                            // null value causes fade out
+                            LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLStringUtil::null);
+                        }
+                    }
+                    else if (!gAudiop->getInternetStreamURL().empty())
+                    {
+                        LL_INFOS() << "Stopping parcel music (parcel stream URL is empty)" << LL_ENDL;
+                        // null value causes fade out
+                        LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLStringUtil::null);
+                    }
+                }
 			}
 			else
 			{
-- 
cgit v1.2.3


From 30f9287645c789b4ad5e9523e520896fe71ed65b Mon Sep 17 00:00:00 2001
From: andreykproductengine <none@none>
Date: Thu, 3 Mar 2016 00:15:33 +0200
Subject: MAINT-2199 reverted previous change, refixed missing cloud and ban
 line

---
 indra/newview/llviewerparcelmgr.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'indra/newview/llviewerparcelmgr.cpp')

diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp
index e72ae88ba2..aafb6b4d12 100755
--- a/indra/newview/llviewerparcelmgr.cpp
+++ b/indra/newview/llviewerparcelmgr.cpp
@@ -143,8 +143,8 @@ LLViewerParcelMgr::LLViewerParcelMgr()
 	// JC: Resolved a merge conflict here, eliminated
 	// mBlockedImage->setAddressMode(LLTexUnit::TAM_WRAP);
 	// because it is done in llviewertexturelist.cpp
-	mBlockedImage = LLViewerTextureManager::getFetchedTextureFromFile("world/NoEntryLines.png");
-	mPassImage = LLViewerTextureManager::getFetchedTextureFromFile("world/NoEntryPassLines.png");
+	mBlockedImage = LLViewerTextureManager::getFetchedTextureFromFile("world/NoEntryLines.png", FTT_LOCAL_FILE, TRUE, LLGLTexture::BOOST_UI);
+	mPassImage = LLViewerTextureManager::getFetchedTextureFromFile("world/NoEntryPassLines.png", FTT_LOCAL_FILE, TRUE, LLGLTexture::BOOST_UI);
 
 	S32 overlay_size = mParcelsPerEdge * mParcelsPerEdge / PARCEL_OVERLAY_CHUNKS;
 	sPackedOverlay = new U8[overlay_size];
-- 
cgit v1.2.3