diff options
Diffstat (limited to 'linden/indra/llaudio/audioengine.cpp')
-rw-r--r-- | linden/indra/llaudio/audioengine.cpp | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/linden/indra/llaudio/audioengine.cpp b/linden/indra/llaudio/audioengine.cpp index 7bb65e9..438aefc 100644 --- a/linden/indra/llaudio/audioengine.cpp +++ b/linden/indra/llaudio/audioengine.cpp | |||
@@ -191,39 +191,43 @@ void LLAudioEngine::startInternetStream(const std::string& url) | |||
191 | if (mgr) | 191 | if (mgr) |
192 | { | 192 | { |
193 | mInternetStreamMedia = mgr->createSourceFromMimeType(LLURI(url).scheme(), "audio/mpeg"); // assumes that whatever media implementation supports mp3 also supports vorbis. | 193 | mInternetStreamMedia = mgr->createSourceFromMimeType(LLURI(url).scheme(), "audio/mpeg"); // assumes that whatever media implementation supports mp3 also supports vorbis. |
194 | //LL_INFOS("AudioEngine") << "mInternetStreamMedia is now " << mInternetStreamMedia << llendl; | 194 | LL_INFOS("AudioEngine") << "mInternetStreamMedia is now " << mInternetStreamMedia << llendl; |
195 | } | 195 | } |
196 | } | 196 | } |
197 | 197 | ||
198 | if(!mInternetStreamMedia) | 198 | if(!mInternetStreamMedia) |
199 | { | ||
199 | return; | 200 | return; |
200 | 201 | } | |
201 | // Check for a dead stream, just in case | 202 | // Check for a dead stream from gstreamer, just in case |
202 | if(getStatus() == LLMediaBase::STATUS_DEAD) | 203 | else if(getStatus() == LLMediaBase::STATUS_DEAD) |
203 | { | 204 | { |
204 | LL_INFOS("AudioEngine") << "don't play dead stream urls"<< llendl; | 205 | LL_INFOS("AudioEngine") << "don't play dead stream urls"<< llendl; |
205 | mInternetStreamURL.clear(); | 206 | mInternetStreamURL.clear(); |
206 | mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_STOP); | 207 | mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_STOP); |
207 | mInternetStreamMedia->updateMedia(); | 208 | mInternetStreamMedia->updateMedia(); |
208 | stopInternetStream(); | 209 | stopInternetStream(); |
209 | return; | ||
210 | } | 210 | } |
211 | 211 | else if (url.empty()) | |
212 | if (!url.empty()) | ||
213 | { | 212 | { |
214 | LL_INFOS("AudioEngine") << "Starting internet stream: " << url << llendl; | 213 | LL_INFOS("AudioEngine") << "url is emptly. Setting stream to NULL"<< llendl; |
215 | mInternetStreamURL = url; | 214 | mInternetStreamURL.clear(); |
216 | mInternetStreamMedia->navigateTo ( url ); | 215 | mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_STOP); |
217 | LL_INFOS("AudioEngine") << "Playing....." << llendl; | ||
218 | mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_START); | ||
219 | mInternetStreamMedia->updateMedia(); | 216 | mInternetStreamMedia->updateMedia(); |
220 | } | 217 | } |
218 | // Stream appears to be good, attempting to play | ||
221 | else | 219 | else |
222 | { | 220 | { |
223 | LL_INFOS("AudioEngine") << "setting stream to NULL"<< llendl; | 221 | // stop any other stream first |
224 | mInternetStreamURL.clear(); | 222 | stopInternetStream(); |
225 | mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_STOP); | 223 | |
224 | LL_INFOS("AudioEngine") << "Starting internet stream: " << url << llendl; | ||
225 | mInternetStreamURL = url; | ||
226 | mInternetStreamMedia->navigateTo(url); | ||
227 | //LL_INFOS("AudioEngine") << "Playing....." << llendl; | ||
228 | mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_START); | ||
226 | mInternetStreamMedia->updateMedia(); | 229 | mInternetStreamMedia->updateMedia(); |
230 | mStatus = LLMediaBase::STATUS_STARTED; | ||
227 | } | 231 | } |
228 | } | 232 | } |
229 | 233 | ||
@@ -231,7 +235,8 @@ void LLAudioEngine::startInternetStream(const std::string& url) | |||
231 | void LLAudioEngine::stopInternetStream() | 235 | void LLAudioEngine::stopInternetStream() |
232 | { | 236 | { |
233 | LL_INFOS("AudioEngine") << "entered stopInternetStream()" << llendl; | 237 | LL_INFOS("AudioEngine") << "entered stopInternetStream()" << llendl; |
234 | 238 | mInternetStreamURL.clear(); | |
239 | |||
235 | if(mInternetStreamMedia) | 240 | if(mInternetStreamMedia) |
236 | { | 241 | { |
237 | if(!mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_STOP)) | 242 | if(!mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_STOP)) |
@@ -240,8 +245,6 @@ void LLAudioEngine::stopInternetStream() | |||
240 | } | 245 | } |
241 | mInternetStreamMedia->updateMedia(); | 246 | mInternetStreamMedia->updateMedia(); |
242 | } | 247 | } |
243 | |||
244 | mInternetStreamURL.clear(); | ||
245 | } | 248 | } |
246 | 249 | ||
247 | // virtual | 250 | // virtual |
@@ -879,7 +882,8 @@ void LLAudioEngine::triggerSound(const LLUUID &audio_uuid, const LLUUID& owner_i | |||
879 | // Create a new source (since this can't be associated with an existing source. | 882 | // Create a new source (since this can't be associated with an existing source. |
880 | //LL_INFOS("AudioEngine") << "Localized: " << audio_uuid << llendl; | 883 | //LL_INFOS("AudioEngine") << "Localized: " << audio_uuid << llendl; |
881 | 884 | ||
882 | if (mMuted) | 885 | //If we cannot hear it, dont even try to load the sound. |
886 | if (mMuted || gain == 0.0) | ||
883 | { | 887 | { |
884 | return; | 888 | return; |
885 | } | 889 | } |