diff options
Diffstat (limited to 'indra/newview/llviewerparcelmgr.cpp')
-rw-r--r-- | indra/newview/llviewerparcelmgr.cpp | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp index 06172e366d..56370df751 100644 --- a/indra/newview/llviewerparcelmgr.cpp +++ b/indra/newview/llviewerparcelmgr.cpp @@ -1888,7 +1888,8 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use if (parcel) { // Only update stream if parcel changed (recreated) or music is playing (enabled) - if (!agent_parcel_update || gSavedSettings.getBOOL("MediaTentativeAutoPlay")) + static LLCachedControl<bool> already_playing(gSavedSettings, "MediaTentativeAutoPlay", true); + if (!agent_parcel_update || already_playing) { LLViewerParcelAskPlay::getInstance()->cancelNotification(); std::string music_url_raw = parcel->getMusicURL(); @@ -1906,7 +1907,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use LLViewerRegion *region = LLWorld::getInstance()->getRegion(msg->getSender()); if (region) { - optionally_start_music(music_url, parcel->mLocalID, region->getRegionID()); + optionallyStartMusic(music_url, parcel->mLocalID, region->getRegionID(), !agent_parcel_update); } } else @@ -1943,9 +1944,13 @@ void LLViewerParcelMgr::onStartMusicResponse(const LLUUID ®ion_id, const S32 LL_INFOS("ParcelMgr") << "Starting parcel music " << url << LL_ENDL; LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(url); } + else + { + LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLStringUtil::null); + } } -void LLViewerParcelMgr::optionally_start_music(const std::string &music_url, const S32 &local_id, const LLUUID ®ion_id) +void LLViewerParcelMgr::optionallyStartMusic(const std::string &music_url, const S32 &local_id, const LLUUID ®ion_id, bool switched_parcel) { static LLCachedControl<bool> streaming_music(gSavedSettings, "AudioStreamingMusic", true); if (streaming_music) @@ -1955,25 +1960,35 @@ void LLViewerParcelMgr::optionally_start_music(const std::string &music_url, con // only play music when you enter a new parcel if the UI control for this // was not *explicitly* stopped by the user. (part of SL-4878) LLPanelNearByMedia* nearby_media_panel = gStatusBar->getNearbyMediaPanel(); + LLViewerAudio* viewer_audio = LLViewerAudio::getInstance(); // ask mode //todo constants if (autoplay_mode == 2) { - // stop previous stream - LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLStringUtil::null); - // if user set media to play - ask if ((nearby_media_panel && nearby_media_panel->getParcelAudioAutoStart()) || (!nearby_media_panel && tentative_autoplay)) { - LLViewerParcelAskPlay::getInstance()->askToPlay(region_id, - local_id, - music_url, - onStartMusicResponse); + // user did not stop audio + if (switched_parcel || music_url != viewer_audio->getNextStreamURI()) + { + viewer_audio->startInternetStreamWithAutoFade(LLStringUtil::null); + + LLViewerParcelAskPlay::getInstance()->askToPlay(region_id, + local_id, + music_url, + onStartMusicResponse); + } + // else do nothing: + // Parcel properties changed, but not url. + // We are already playing this url and asked about it when agent entered parcel + // or user started audio manually at some point } else { + // stopped by the user, do not autoplay LLViewerParcelAskPlay::getInstance()->cancelNotification(); + viewer_audio->startInternetStreamWithAutoFade(LLStringUtil::null); } } // autoplay @@ -1985,11 +2000,12 @@ void LLViewerParcelMgr::optionally_start_music(const std::string &music_url, con && tentative_autoplay)) { LL_INFOS("ParcelMgr") << "Starting parcel music " << music_url << LL_ENDL; - LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(music_url); + viewer_audio->startInternetStreamWithAutoFade(music_url); } - else + // autoplay off + else if(switched_parcel || music_url != viewer_audio->getNextStreamURI()) { - LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLStringUtil::null); + viewer_audio->startInternetStreamWithAutoFade(LLStringUtil::null); } } } |