From a7011655227fbeb417dbbb9631c6dff40093d5d5 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 18 Oct 2021 17:36:14 +0300 Subject: [PATCH 01/10] SL-16047 Strip unused includes --- indra/media_plugins/cef/CMakeLists.txt | 3 --- indra/media_plugins/cef/media_plugin_cef.cpp | 5 +---- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/indra/media_plugins/cef/CMakeLists.txt b/indra/media_plugins/cef/CMakeLists.txt index ce6278963d..854ba55731 100644 --- a/indra/media_plugins/cef/CMakeLists.txt +++ b/indra/media_plugins/cef/CMakeLists.txt @@ -5,7 +5,6 @@ project(media_plugin_cef) include(Boost) include(00-Common) include(LLCommon) -include(LLImage) include(LLPlugin) include(LLMath) include(LLRender) @@ -13,7 +12,6 @@ include(LLWindow) include(Linking) include(PluginAPI) include(MediaPluginBase) -include(OpenGL) include(CEFPlugin) @@ -22,7 +20,6 @@ include_directories( ${MEDIA_PLUGIN_BASE_INCLUDE_DIRS} ${LLCOMMON_INCLUDE_DIRS} ${LLMATH_INCLUDE_DIRS} - ${LLIMAGE_INCLUDE_DIRS} ${LLRENDER_INCLUDE_DIRS} ${LLWINDOW_INCLUDE_DIRS} ${CEF_INCLUDE_DIR} diff --git a/indra/media_plugins/cef/media_plugin_cef.cpp b/indra/media_plugins/cef/media_plugin_cef.cpp index 8465285d2b..11dec63cd3 100644 --- a/indra/media_plugins/cef/media_plugin_cef.cpp +++ b/indra/media_plugins/cef/media_plugin_cef.cpp @@ -29,7 +29,7 @@ #include "linden_common.h" #include "indra_constants.h" // for indra keyboard codes -#include "llgl.h" +#include "llglheaders.h" // for GL_* constants #include "llsdutil.h" #include "llplugininstance.h" #include "llpluginmessage.h" @@ -37,9 +37,6 @@ #include "volume_catcher.h" #include "media_plugin_base.h" -#include -#include - #include "dullahan.h" //////////////////////////////////////////////////////////////////////////////// From a95d846a5c2ba681c165e62699a163780f5d4b75 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Mon, 25 Oct 2021 15:15:02 +0300 Subject: [PATCH 02/10] SL-16218 treat texture selection similar to diffuse map handling. --- indra/newview/llpanelface.cpp | 4 ++-- indra/newview/llpanelvolume.cpp | 26 +++++++++++++++++----- indra/newview/llpanelvolume.h | 3 +++ indra/newview/llselectmgr.cpp | 38 +++++++++++++++++++++++++++++---- indra/newview/llselectmgr.h | 4 ++-- 5 files changed, 62 insertions(+), 13 deletions(-) diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 23394b26f2..71657239a6 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -361,7 +361,7 @@ void LLPanelFace::sendBump(U32 bumpiness) // LLSelectedTEMaterial::setNormalID(this, current_normal_map); - LLSelectMgr::getInstance()->selectionSetBumpmap( bump ); + LLSelectMgr::getInstance()->selectionSetBumpmap( bump, bumpytexture_ctrl->getImageItemID() ); } void LLPanelFace::sendTexGen() @@ -390,7 +390,7 @@ void LLPanelFace::sendShiny(U32 shininess) LLSelectedTEMaterial::setSpecularID(this, specmap); - LLSelectMgr::getInstance()->selectionSetShiny( shiny ); + LLSelectMgr::getInstance()->selectionSetShiny( shiny, texture_ctrl->getImageItemID() ); updateShinyControls(!specmap.isNull(), true); diff --git a/indra/newview/llpanelvolume.cpp b/indra/newview/llpanelvolume.cpp index 05d9346f89..89c558e4f8 100644 --- a/indra/newview/llpanelvolume.cpp +++ b/indra/newview/llpanelvolume.cpp @@ -50,6 +50,7 @@ //#include "llfirstuse.h" #include "llfocusmgr.h" #include "llmanipscale.h" +#include "llinventorymodel.h" #include "llpreviewscript.h" #include "llresmgr.h" #include "llselectmgr.h" @@ -57,6 +58,7 @@ #include "lltextbox.h" #include "lltool.h" #include "lltoolcomp.h" +#include "lltooldraganddrop.h" #include "lltoolmgr.h" #include "lltrans.h" #include "llui.h" @@ -780,7 +782,7 @@ void LLPanelVolume::onLightCancelTexture(const LLSD& data) // selection of "None" texture. LLUUID tex_id = LightTextureCtrl->getImageAssetID(); bool is_spotlight = volobjp->isLightSpotlight(); - volobjp->setLightTextureID(tex_id); //updates spotlight + setLightTextureID(tex_id, LightTextureCtrl->getImageItemID(), volobjp); //updates spotlight if (!is_spotlight && tex_id.notNull()) { @@ -825,7 +827,7 @@ void LLPanelVolume::onLightSelectTexture(const LLSD& data) if(LightTextureCtrl) { LLUUID id = LightTextureCtrl->getImageAssetID(); - volobjp->setLightTextureID(id); + setLightTextureID(id, LightTextureCtrl->getImageItemID(), volobjp); } } @@ -888,11 +890,12 @@ void LLPanelVolume::onCommitLight( LLUICtrl* ctrl, void* userdata ) if(LightTextureCtrl) { LLUUID id = LightTextureCtrl->getImageAssetID(); + LLUUID item_id = LightTextureCtrl->getImageItemID(); if (id.notNull()) { if (!volobjp->isLightSpotlight()) { //this commit is making this a spot light, set UI to default params - volobjp->setLightTextureID(id); + setLightTextureID(id, item_id, volobjp); LLVector3 spot_params = volobjp->getSpotLightParams(); self->getChild("Light FOV")->setValue(spot_params.mV[0]); self->getChild("Light Focus")->setValue(spot_params.mV[1]); @@ -902,7 +905,7 @@ void LLPanelVolume::onCommitLight( LLUICtrl* ctrl, void* userdata ) { //modifying existing params, this time volobjp won't change params on its own. if (volobjp->getLightTextureID() != id) { - volobjp->setLightTextureID(id); + setLightTextureID(id, item_id, volobjp); } LLVector3 spot_params; @@ -914,7 +917,7 @@ void LLPanelVolume::onCommitLight( LLUICtrl* ctrl, void* userdata ) } else if (volobjp->isLightSpotlight()) { //no longer a spot light - volobjp->setLightTextureID(id); + setLightTextureID(id, item_id, volobjp); //self->getChildView("Light FOV")->setEnabled(FALSE); //self->getChildView("Light Focus")->setEnabled(FALSE); //self->getChildView("Light Ambiance")->setEnabled(FALSE); @@ -931,6 +934,19 @@ void LLPanelVolume::onCommitIsLight( LLUICtrl* ctrl, void* userdata ) self->sendIsLight(); } +// static +void LLPanelVolume::setLightTextureID(const LLUUID &asset_id, const LLUUID &item_id, LLVOVolume* volobjp) +{ + if (volobjp) + { + LLViewerInventoryItem* item = gInventory.getItem(item_id); + if (item && !item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID())) + { + LLToolDragAndDrop::handleDropTextureProtections(volobjp, item, LLToolDragAndDrop::SOURCE_AGENT, LLUUID::null); + } + volobjp->setLightTextureID(asset_id); + } +} //---------------------------------------------------------------------------- // static diff --git a/indra/newview/llpanelvolume.h b/indra/newview/llpanelvolume.h index 66117316cf..6e49ccb742 100644 --- a/indra/newview/llpanelvolume.h +++ b/indra/newview/llpanelvolume.h @@ -40,6 +40,7 @@ class LLButton; class LLViewerObject; class LLComboBox; class LLColorSwatchCtrl; +class LLVOVolume; class LLPanelVolume : public LLPanel { @@ -73,6 +74,8 @@ public: void onLightCancelTexture(const LLSD& data); void onLightSelectTexture(const LLSD& data); + static void setLightTextureID(const LLUUID &asset_id, const LLUUID &item_id, LLVOVolume* volobjp); + protected: void getState(); diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 5bbdeb1f98..b0a566755f 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -1936,7 +1936,7 @@ BOOL LLSelectMgr::selectionRevertTextures() return revert_successful; } -void LLSelectMgr::selectionSetBumpmap(U8 bumpmap) +void LLSelectMgr::selectionSetBumpmap(U8 bumpmap, const LLUUID &image_id) { struct f : public LLSelectedTEFunctor { @@ -1952,7 +1952,22 @@ void LLSelectMgr::selectionSetBumpmap(U8 bumpmap) return true; } } setfunc(bumpmap); - getSelection()->applyToTEs(&setfunc); + + LLViewerInventoryItem* item = gInventory.getItem(image_id); + if(item + && !item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID()) + && (mSelectedObjects->getNumNodes() > 1) ) + { + LL_WARNS() << "Attempted to apply no-copy texture to multiple objects" << LL_ENDL; + return; + } + if (item && !item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID())) + { + LLViewerObject *object = mSelectedObjects->getFirstRootObject(); + if (!object) return; + LLToolDragAndDrop::handleDropTextureProtections(object, item, LLToolDragAndDrop::SOURCE_AGENT, LLUUID::null); + } + getSelection()->applyToTEs(&setfunc); LLSelectMgrSendFunctor sendfunc; getSelection()->applyToObjects(&sendfunc); @@ -1981,7 +1996,7 @@ void LLSelectMgr::selectionSetTexGen(U8 texgen) } -void LLSelectMgr::selectionSetShiny(U8 shiny) +void LLSelectMgr::selectionSetShiny(U8 shiny, const LLUUID &image_id) { struct f : public LLSelectedTEFunctor { @@ -1997,7 +2012,22 @@ void LLSelectMgr::selectionSetShiny(U8 shiny) return true; } } setfunc(shiny); - getSelection()->applyToTEs(&setfunc); + + LLViewerInventoryItem* item = gInventory.getItem(image_id); + if(item + && !item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID()) + && (mSelectedObjects->getNumNodes() > 1) ) + { + LL_WARNS() << "Attempted to apply no-copy texture to multiple objects" << LL_ENDL; + return; + } + if (item && !item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID())) + { + LLViewerObject *object = mSelectedObjects->getFirstRootObject(); + if (!object) return; + LLToolDragAndDrop::handleDropTextureProtections(object, item, LLToolDragAndDrop::SOURCE_AGENT, LLUUID::null); + } + getSelection()->applyToTEs(&setfunc); LLSelectMgrSendFunctor sendfunc; getSelection()->applyToObjects(&sendfunc); diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h index 57fdfce152..2b00fa1595 100644 --- a/indra/newview/llselectmgr.h +++ b/indra/newview/llselectmgr.h @@ -609,9 +609,9 @@ public: void selectionRevertColors(); void selectionRevertShinyColors(); BOOL selectionRevertTextures(); - void selectionSetBumpmap( U8 bumpmap ); + void selectionSetBumpmap( U8 bumpmap, const LLUUID &image_id ); void selectionSetTexGen( U8 texgen ); - void selectionSetShiny( U8 shiny ); + void selectionSetShiny( U8 shiny, const LLUUID &image_id ); void selectionSetFullbright( U8 fullbright ); void selectionSetMedia( U8 media_type, const LLSD &media_data ); void selectionSetClickAction(U8 action); From 8acce67f95bab5bfae06a2f5d9de8bf9234c8b21 Mon Sep 17 00:00:00 2001 From: Andrey Lihatskiy Date: Thu, 28 Oct 2021 00:05:47 +0300 Subject: [PATCH 03/10] SL-16247 Post-d520 libvlc plugin fixes by Callum --- .../libvlc/media_plugin_libvlc.cpp | 39 +++++-------------- 1 file changed, 10 insertions(+), 29 deletions(-) diff --git a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp index 5d4a488e64..ce0947a1bc 100644 --- a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp +++ b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp @@ -283,35 +283,16 @@ void MediaPluginLibVLC::playMedia() return; } + // A new call to play the media is received after the initial one. Typically + // this is due to a size change request either as the media naturally resizes + // to the size of the prim container, or else, as a 2D window is resized by the + // user. Stopping the media, helps avoid a race condition where the media pixel + // buffer size is out of sync with the declared size (width/height) for a frame + // or two and the plugin crashes as VLC tries to decode a frame into unallocated + // memory. if (mLibVLCMediaPlayer) { - // stop listening to events while we reset things - libvlc_event_manager_t* em = libvlc_media_player_event_manager(mLibVLCMediaPlayer); - if (em) - { - libvlc_event_detach(em, libvlc_MediaPlayerOpening, eventCallbacks, NULL); - libvlc_event_detach(em, libvlc_MediaPlayerPlaying, eventCallbacks, NULL); - libvlc_event_detach(em, libvlc_MediaPlayerPaused, eventCallbacks, NULL); - libvlc_event_detach(em, libvlc_MediaPlayerStopped, eventCallbacks, NULL); - libvlc_event_detach(em, libvlc_MediaPlayerEndReached, eventCallbacks, NULL); - libvlc_event_detach(em, libvlc_MediaPlayerEncounteredError, eventCallbacks, NULL); - libvlc_event_detach(em, libvlc_MediaPlayerTimeChanged, eventCallbacks, NULL); - libvlc_event_detach(em, libvlc_MediaPlayerPositionChanged, eventCallbacks, NULL); - libvlc_event_detach(em, libvlc_MediaPlayerLengthChanged, eventCallbacks, NULL); - libvlc_event_detach(em, libvlc_MediaPlayerTitleChanged, eventCallbacks, NULL); - }; - libvlc_media_player_stop(mLibVLCMediaPlayer); - libvlc_media_player_release(mLibVLCMediaPlayer); - - mLibVLCMediaPlayer = 0; - } - - if (mLibVLCMedia) - { - libvlc_media_release(mLibVLCMedia); - - mLibVLCMedia = 0; } mLibVLCMedia = libvlc_media_new_location(mLibVLC, mURL.c_str()); @@ -345,6 +326,9 @@ void MediaPluginLibVLC::playMedia() libvlc_event_attach(em, libvlc_MediaPlayerTitleChanged, eventCallbacks, this); } + libvlc_video_set_callbacks(mLibVLCMediaPlayer, lock, unlock, display, &mLibVLCCallbackContext); + libvlc_video_set_format(mLibVLCMediaPlayer, "RV32", mWidth, mHeight, mWidth * mDepth); + mLibVLCCallbackContext.parent = this; mLibVLCCallbackContext.texture_pixels = mPixels; mLibVLCCallbackContext.mp = mLibVLCMediaPlayer; @@ -366,9 +350,6 @@ void MediaPluginLibVLC::playMedia() setStatus(STATUS_LOADED); - libvlc_video_set_callbacks(mLibVLCMediaPlayer, lock, unlock, display, &mLibVLCCallbackContext); - libvlc_video_set_format(mLibVLCMediaPlayer, "RV32", mWidth, mHeight, mWidth * mDepth); - // note this relies on the "set_loop" message arriving before the "start" (play) one // but that appears to always be the case if (mIsLooping) From 404e69e5945d357d70bd2da684b7a3dbedd1579d Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 28 Oct 2021 18:41:10 +0300 Subject: [PATCH 04/10] SL-15462 Convert waitForChannel() into state machine --- indra/newview/llappviewer.cpp | 6 + indra/newview/llvoicevivox.cpp | 238 +++++++++++++++++++++++---------- 2 files changed, 174 insertions(+), 70 deletions(-) diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 3ec6d3f90e..f668dc754d 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1520,6 +1520,12 @@ bool LLAppViewer::doFrame() { pauseMainloopTimeout(); saveFinalSnapshot(); + + if (LLVoiceClient::instanceExists()) + { + LLVoiceClient::getInstance()->terminate(); + } + disconnectViewer(); resumeMainloopTimeout(); } diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 4aa6f2c6b2..c7a544f8eb 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -400,6 +400,11 @@ void LLVivoxVoiceClient::init(LLPumpIO *pump) void LLVivoxVoiceClient::terminate() { + if (sShuttingDown) + { + return; + } + // needs to be done manually here since we will not get another pass in // coroutines... that mechanism is long since gone. if (mIsLoggedIn) @@ -1126,6 +1131,11 @@ bool LLVivoxVoiceClient::provisionVoiceAccount() LLVoiceVivoxStats::getInstance()->provisionAttemptStart(); result = httpAdapter->postAndSuspend(httpRequest, url, LLSD(), httpOpts); + if (sShuttingDown) + { + return false; + } + LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -1133,14 +1143,12 @@ bool LLVivoxVoiceClient::provisionVoiceAccount() { F32 timeout = pow(PROVISION_RETRY_TIMEOUT, static_cast(retryCount)); LL_WARNS("Voice") << "Provision CAP 404. Retrying in " << timeout << " seconds. Retries: " << (S32)retryCount << LL_ENDL; + llcoro::suspendUntilTimeout(timeout); + if (sShuttingDown) { return false; } - else - { - llcoro::suspendUntilTimeout(timeout); - } } else if (!status) { @@ -1515,6 +1523,11 @@ bool LLVivoxVoiceClient::requestParcelVoiceInfo() LLSD result = httpAdapter->postAndSuspend(httpRequest, url, LLSD()); + if (sShuttingDown) + { + return false; + } + LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -1620,6 +1633,11 @@ bool LLVivoxVoiceClient::addAndJoinSession(const sessionStatePtr_t &nextSession) llcoro::suspend(); + if (sShuttingDown) + { + return false; + } + LLSD result; if (mSpatialJoiningNum == MAX_NORMAL_JOINING_SPATIAL_NUM) @@ -1685,7 +1703,6 @@ bool LLVivoxVoiceClient::addAndJoinSession(const sessionStatePtr_t &nextSession) if (sShuttingDown) { - mIsJoiningSession = false; return false; } @@ -1808,6 +1825,11 @@ bool LLVivoxVoiceClient::terminateAudioSession(bool wait) result = llcoro::suspendUntilEventOnWithTimeout(mVivoxPump, LOGOUT_ATTEMPT_TIMEOUT, timeoutResult); + if (sShuttingDown) + { + return false; + } + LL_DEBUGS("Voice") << "event=" << ll_stream_notation_sd(result) << LL_ENDL; if (result.has("session")) { @@ -1870,54 +1892,76 @@ bool LLVivoxVoiceClient::terminateAudioSession(bool wait) return status; } + +typedef enum e_voice_wait_for_channel_state +{ + VOICE_CHANNEL_STATE_LOGIN = 0, // entry point + VOICE_CHANNEL_STATE_CHECK_EFFECTS, + VOICE_CHANNEL_STATE_START_CHANNEL_PROCESSING, + VOICE_CHANNEL_STATE_PROCESS_CHANNEL, + VOICE_CHANNEL_STATE_NEXT_CHANNEL_DELAY, + VOICE_CHANNEL_STATE_NEXT_CHANNEL_CHECK, + VOICE_CHANNEL_STATE_LOGOUT, + VOICE_CHANNEL_STATE_RELOG, + VOICE_CHANNEL_STATE_DONE, +} EVoiceWaitForChannelState; + bool LLVivoxVoiceClient::waitForChannel() { LL_INFOS("Voice") << "Waiting for channel" << LL_ENDL; + EVoiceWaitForChannelState state = VOICE_CHANNEL_STATE_LOGIN; + do { - if (!loginToVivox()) - { - return false; - } - if (sShuttingDown) { + // terminate() forcefully disconects voice, no need for cleanup return false; } - if (LLVoiceClient::instance().getVoiceEffectEnabled()) + switch (state) { - retrieveVoiceFonts(); - - if (sShuttingDown) + case VOICE_CHANNEL_STATE_LOGIN: + if (!loginToVivox()) { return false; } + state = VOICE_CHANNEL_STATE_CHECK_EFFECTS; + break; - // Request the set of available voice fonts. - refreshVoiceEffectLists(false); - } - -#if USE_SESSION_GROUPS - // Rider: This code is completely unchanged from the original state machine - // It does not seem to be in active use... but I'd rather not rip it out. - // create the main session group - setState(stateCreatingSessionGroup); - sessionGroupCreateSendMessage(); -#endif - - do - { - mIsProcessingChannels = true; - llcoro::suspend(); - - if (sShuttingDown) + case VOICE_CHANNEL_STATE_CHECK_EFFECTS: + if (LLVoiceClient::instance().getVoiceEffectEnabled()) { - mRelogRequested = false; - break; + retrieveVoiceFonts(); + + if (sShuttingDown) + { + return false; + } + + // Request the set of available voice fonts. + refreshVoiceEffectLists(false); } +#if USE_SESSION_GROUPS + // Rider: This code is completely unchanged from the original state machine + // It does not seem to be in active use... but I'd rather not rip it out. + // create the main session group + setState(stateCreatingSessionGroup); + sessionGroupCreateSendMessage(); +#endif + + state = VOICE_CHANNEL_STATE_START_CHANNEL_PROCESSING; + break; + + case VOICE_CHANNEL_STATE_START_CHANNEL_PROCESSING: + mIsProcessingChannels = true; + llcoro::suspend(); + state = VOICE_CHANNEL_STATE_PROCESS_CHANNEL; + break; + + case VOICE_CHANNEL_STATE_PROCESS_CHANNEL: if (mTuningMode) { performMicTuning(); @@ -1958,63 +2002,91 @@ bool LLVivoxVoiceClient::waitForChannel() } } - if (!mNextAudioSession && !sShuttingDown) + state = VOICE_CHANNEL_STATE_NEXT_CHANNEL_DELAY; + break; + + case VOICE_CHANNEL_STATE_NEXT_CHANNEL_DELAY: + if (!mNextAudioSession) { llcoro::suspendUntilTimeout(1.0); } + state = VOICE_CHANNEL_STATE_NEXT_CHANNEL_CHECK; + break; - if (sShuttingDown) + case VOICE_CHANNEL_STATE_NEXT_CHANNEL_CHECK: + if (mVoiceEnabled && !mRelogRequested) { - mRelogRequested = false; + state = VOICE_CHANNEL_STATE_START_CHANNEL_PROCESSING; + break; + } + else + { + mIsProcessingChannels = false; + LL_DEBUGS("Voice") + << "leaving inner waitForChannel loop" + << " RelogRequested=" << mRelogRequested + << " VoiceEnabled=" << mVoiceEnabled + << LL_ENDL; + state = VOICE_CHANNEL_STATE_LOGOUT; break; } - } while (!sShuttingDown && mVoiceEnabled && !mRelogRequested); + case VOICE_CHANNEL_STATE_LOGOUT: + logoutOfVivox(true /*bool wait*/); + if (mRelogRequested) + { + state = VOICE_CHANNEL_STATE_RELOG; + } + else + { + state = VOICE_CHANNEL_STATE_DONE; + } + break; - if (!sShuttingDown) - { - LL_DEBUGS("Voice") - << "leaving inner waitForChannel loop" - << " RelogRequested=" << mRelogRequested - << " VoiceEnabled=" << mVoiceEnabled - << LL_ENDL; - } - else - { - // if sShuttingDown is set, we already logged out - LL_DEBUGS("Voice") << "leaving inner waitForChannel loop." << LL_ENDL; - return false; - } - - mIsProcessingChannels = false; - - logoutOfVivox(!sShuttingDown /*bool wait*/); - - if (mRelogRequested && !sShuttingDown) - { + case VOICE_CHANNEL_STATE_RELOG: LL_DEBUGS("Voice") << "Relog Requested, restarting provisioning" << LL_ENDL; if (!provisionVoiceAccount()) { + if (sShuttingDown) + { + return false; + } LL_WARNS("Voice") << "provisioning voice failed; giving up" << LL_ENDL; giveUp(); return false; } + if (mVoiceEnabled && mRelogRequested && isGatewayRunning()) + { + state = VOICE_CHANNEL_STATE_LOGIN; + } + else + { + state = VOICE_CHANNEL_STATE_DONE; + } + break; + case VOICE_CHANNEL_STATE_DONE: + LL_DEBUGS("Voice") + << "exiting" + << " RelogRequested=" << mRelogRequested + << " VoiceEnabled=" << mVoiceEnabled + << LL_ENDL; + return !sShuttingDown; } - } while (!sShuttingDown && mVoiceEnabled && mRelogRequested && isGatewayRunning()); - - LL_DEBUGS("Voice") - << "exiting" - << " RelogRequested=" << mRelogRequested - << " VoiceEnabled=" << mVoiceEnabled - << LL_ENDL; - return !sShuttingDown; + } while (true); } bool LLVivoxVoiceClient::runSession(const sessionStatePtr_t &session) { LL_INFOS("Voice") << "running new voice session " << session->mHandle << LL_ENDL; - if (!addAndJoinSession(session)) + bool joined_session = addAndJoinSession(session); + + if (sShuttingDown) + { + return false; + } + + if (!joined_session) { notifyStatusObservers(LLVoiceClientStatusObserver::ERROR_UNKNOWN); @@ -2038,9 +2110,19 @@ bool LLVivoxVoiceClient::runSession(const sessionStatePtr_t &session) mIsInChannel = true; mMuteMicDirty = true; - while (mVoiceEnabled && isGatewayRunning() && !mSessionTerminateRequested && !mTuningMode) + while (!sShuttingDown + && mVoiceEnabled + && isGatewayRunning() + && !mSessionTerminateRequested + && !mTuningMode) { sendCaptureAndRenderDevices(); // suspends + + if (sShuttingDown) + { + return false; + } + if (mSessionTerminateRequested) { break; @@ -2070,10 +2152,15 @@ bool LLVivoxVoiceClient::runSession(const sessionStatePtr_t &session) // cap for the parcel voice info. If we can't request it // then we don't have the cap URL so we do nothing and will // recheck next time around - if (requestParcelVoiceInfo()) + if (requestParcelVoiceInfo()) // suspends { // The parcel voice URI has changed.. break out and reconnect. break; } + + if (sShuttingDown) + { + return false; + } } // Do the calculation that enforces the listener<->speaker tether (and also updates the real camera position) enforceTether(); @@ -2092,6 +2179,12 @@ bool LLVivoxVoiceClient::runSession(const sessionStatePtr_t &session) mIsInitialized = true; LLSD result = llcoro::suspendUntilEventOnWithTimeout(mVivoxPump, UPDATE_THROTTLE_SECONDS, timeoutEvent); + + if (sShuttingDown) + { + return false; + } + if (!result.has("timeout")) // logging the timeout event spams the log { LL_DEBUGS("Voice") << "event=" << ll_stream_notation_sd(result) << LL_ENDL; @@ -2134,6 +2227,11 @@ bool LLVivoxVoiceClient::runSession(const sessionStatePtr_t &session) } } + if (sShuttingDown) + { + return false; + } + mIsInChannel = false; LL_DEBUGS("Voice") << "terminating at end of runSession" << LL_ENDL; terminateAudioSession(true); From 6921edcc39a4559ec267602b818c4fef9c974349 Mon Sep 17 00:00:00 2001 From: Andrey Lihatskiy Date: Mon, 1 Nov 2021 21:23:12 +0200 Subject: [PATCH 05/10] SL-16293 Updated vlc to CT build 565299 --- autobuild.xml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/autobuild.xml b/autobuild.xml index fb9314f1a1..59d65972f5 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -3172,9 +3172,9 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors archive hash - b639d0035f4a8c9b4973be428a1b7e61 + 738688816ebd76958e49772712a6b972 url - http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/69569/671323/vlc_bin-3.0.9.549888-darwin64-549888.tar.bz2 + https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/90004/820701/vlc_bin-3.0.16.565299-darwin64-565299.tar.bz2 name darwin64 @@ -3196,9 +3196,9 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors archive hash - 4f50b0c47daa081dd4fcb83763d5b0b2 + 6801f91f3f27e626898bab90d40fc1c3 url - http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/69567/671314/vlc_bin-3.0.9.549888-windows-549888.tar.bz2 + https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/90005/820712/vlc_bin-3.0.16.565299-windows-565299.tar.bz2 name windows @@ -3208,16 +3208,16 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors archive hash - c2f8c01fb6c261b72beb07f0c4cd423f + 7f66982d6edf3c38f3493e28826d58e8 url - http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/69568/671315/vlc_bin-3.0.9.549888-windows64-549888.tar.bz2 + https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/90006/820713/vlc_bin-3.0.16.565299-windows64-565299.tar.bz2 name windows64 version - 3.0.9.549888 + 3.0.16.565299 xmlrpc-epi From e70415f1d77f6ad4ab1e581900d2b42436118bd9 Mon Sep 17 00:00:00 2001 From: Andrey Lihatskiy Date: Wed, 3 Nov 2021 20:01:57 +0200 Subject: [PATCH 06/10] SL-16299 Added entitlements for the app bundle signing --- indra/newview/slplugin.entitlements | 12 ++++++++++++ indra/newview/viewer_manifest.py | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/indra/newview/slplugin.entitlements b/indra/newview/slplugin.entitlements index a1c430a57a..1c2f2e5d2c 100644 --- a/indra/newview/slplugin.entitlements +++ b/indra/newview/slplugin.entitlements @@ -4,5 +4,17 @@ com.apple.security.cs.allow-unsigned-executable-memory + com.apple.security.automation.apple-events + + com.apple.security.cs.allow-jit + + com.apple.security.cs.disable-library-validation + + com.apple.security.device.audio-input + + com.apple.security.device.camera + + com.apple.security.cs.allow-dyld-environment-variables + diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index b932f43141..1d82e95e98 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -1309,7 +1309,7 @@ class DarwinManifest(ViewerManifest): self.run_command(['codesign', '--force', '--timestamp', '--keychain', viewer_keychain, '--sign', identity, cef_path]) self.run_command(['codesign', '--force', '--timestamp', '--keychain', viewer_keychain, '--sign', identity, greenlet_path]) self.run_command(['codesign', '--verbose', '--deep', '--force', '--entitlements', self.src_path_of("slplugin.entitlements"), '--options', 'runtime', '--keychain', viewer_keychain, '--sign', identity, slplugin_path]) - self.run_command(['codesign', '--verbose', '--deep', '--force', '--options', 'runtime', '--keychain', viewer_keychain, '--sign', identity, app_in_dmg]) + self.run_command(['codesign', '--verbose', '--deep', '--force', '--entitlements', self.src_path_of("slplugin.entitlements"), '--options', 'runtime', '--keychain', viewer_keychain, '--sign', identity, app_in_dmg]) signed=True # if no exception was raised, the codesign worked except ManifestError as err: if sign_attempts: From a37a36c40886ab8435da6c5b5dbe7bdb47803484 Mon Sep 17 00:00:00 2001 From: Andrey Lihatskiy Date: Thu, 4 Nov 2021 01:10:03 +0200 Subject: [PATCH 07/10] SL-16299 Updated dullahan to CT build 565428; entitlements cleanup --- autobuild.xml | 14 +++++++------- indra/newview/slplugin.entitlements | 4 ---- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/autobuild.xml b/autobuild.xml index 59d65972f5..f43b277264 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -580,9 +580,9 @@ archive hash - 45dedb5b09995cd794304150e94fcf21 + 2653c3627fd8687ff9e003425fd14834 url - https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/87950/806969/dullahan-1.12.2.202109170444_91.1.21_g9dd45fe_chromium-91.0.4472.114-darwin64-563968.tar.bz2 + https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/90199/821852/dullahan-1.12.3.202111032211_91.1.21_g9dd45fe_chromium-91.0.4472.114-darwin64-565428.tar.bz2 name darwin64 @@ -592,9 +592,9 @@ archive hash - d0fd9d7086699da4bb5ccc935622a717 + b4003772562a5dd40bc112eec7cba5f5 url - https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/88276/809277/dullahan-1.12.2.202109230751_91.1.21_g9dd45fe_chromium-91.0.4472.114-windows-563968.tar.bz2 + https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/90201/821871/dullahan-1.12.3.202111032221_91.1.21_g9dd45fe_chromium-91.0.4472.114-windows-565428.tar.bz2 name windows @@ -604,16 +604,16 @@ archive hash - 7e8c3ccd420ff5aef24ff72d609ba394 + d9030d7a7390b3bda7de2adcc27e535a url - https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/88275/809281/dullahan-1.12.2.202109230751_91.1.21_g9dd45fe_chromium-91.0.4472.114-windows64-563968.tar.bz2 + https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/90200/821876/dullahan-1.12.3.202111032221_91.1.21_g9dd45fe_chromium-91.0.4472.114-windows64-565428.tar.bz2 name windows64 version - 1.12.2.202109230751_91.1.21_g9dd45fe_chromium-91.0.4472.114 + 1.12.3.202111032221_91.1.21_g9dd45fe_chromium-91.0.4472.114 elfio diff --git a/indra/newview/slplugin.entitlements b/indra/newview/slplugin.entitlements index 1c2f2e5d2c..a72c6bc82c 100644 --- a/indra/newview/slplugin.entitlements +++ b/indra/newview/slplugin.entitlements @@ -10,10 +10,6 @@ com.apple.security.cs.disable-library-validation - com.apple.security.device.audio-input - - com.apple.security.device.camera - com.apple.security.cs.allow-dyld-environment-variables From 0a7a367088232ed175d4a41aad83363536f205a3 Mon Sep 17 00:00:00 2001 From: Brad Kittenbrink Date: Thu, 4 Nov 2021 14:35:12 -0700 Subject: [PATCH 08/10] SL-16299 fix warning about CFBundleIdentifier not matching PRODUCT_BUNDLE_IDENTIFIER --- indra/newview/CMakeLists.txt | 4 ++-- indra/newview/Info-SecondLife.plist | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 68b5969ff1..1969c498f0 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -2183,8 +2183,8 @@ if (DARWIN) # SIGH, as of 2018-05-24 (cmake 3.11.1) the INSTALL_RPATH property simply # does not work. Try this: LINK_FLAGS "-rpath @loader_path/../Frameworks" - MACOSX_BUNDLE_INFO_PLIST - "${CMAKE_CURRENT_SOURCE_DIR}/Info-SecondLife.plist" + MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info-SecondLife.plist" + XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "${MACOSX_BUNDLE_GUI_IDENTIFIER}" ) set(VIEWER_APP_BUNDLE "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${product}.app") diff --git a/indra/newview/Info-SecondLife.plist b/indra/newview/Info-SecondLife.plist index cfe9d991c5..09b0e1ec1b 100644 --- a/indra/newview/Info-SecondLife.plist +++ b/indra/newview/Info-SecondLife.plist @@ -11,7 +11,7 @@ CFBundleIconFile ${MACOSX_BUNDLE_ICON_FILE} CFBundleIdentifier - ${MACOSX_BUNDLE_GUI_IDENTIFIER} + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleLongVersionString From 60f2bffa7c4a55f62c34c867afd83b1225e24b7f Mon Sep 17 00:00:00 2001 From: Andrey Lihatskiy Date: Sun, 7 Nov 2021 03:44:08 +0200 Subject: [PATCH 09/10] SL-16299 Added the correct @rpath for libvlc --- indra/newview/viewer_manifest.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 1d82e95e98..6fcd1e84e8 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -1176,8 +1176,10 @@ class DarwinManifest(ViewerManifest): [newpath, self.dst_path_of(dylibexecutable)]) # copy LibVLC plugin itself - self.path2basename("../media_plugins/libvlc/" + self.args['configuration'], - "media_plugin_libvlc.dylib") + dylibexecutable = 'media_plugin_libvlc.dylib' + self.path2basename("../media_plugins/libvlc/" + self.args['configuration'], dylibexecutable) + # add @rpath for the correct LibVLC subfolder + self.run_command(['install_name_tool', '-add_rpath', '@loader_path/lib', self.dst_path_of(dylibexecutable)]) # copy LibVLC dynamic libraries with self.prefix(src=relpkgdir, dst="lib"): From 8dd9554eb504e43e392b858003914be3210ba91e Mon Sep 17 00:00:00 2001 From: Andrey Lihatskiy Date: Tue, 9 Nov 2021 02:38:58 +0200 Subject: [PATCH 10/10] SL-16333 VLC 3 doesn't support -1 == infinity for input-repeat by Callum --- indra/media_plugins/libvlc/media_plugin_libvlc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp index ce0947a1bc..1afe25e9a1 100644 --- a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp +++ b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp @@ -354,7 +354,7 @@ void MediaPluginLibVLC::playMedia() // but that appears to always be the case if (mIsLooping) { - libvlc_media_add_option(mLibVLCMedia, "input-repeat=-1"); + libvlc_media_add_option(mLibVLCMedia, "input-repeat=65535"); } libvlc_media_player_play(mLibVLCMediaPlayer);