Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
e729910e
Commit
e729910e
authored
3 years ago
by
Andrey Kleshchev
Browse files
Options
Downloads
Patches
Plain Diff
SL-14992 fmod shutdown crash
parent
ac2135a4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
indra/llaudio/llstreamingaudio_fmodstudio.cpp
+57
-16
57 additions, 16 deletions
indra/llaudio/llstreamingaudio_fmodstudio.cpp
indra/llaudio/llstreamingaudio_fmodstudio.h
+2
-0
2 additions, 0 deletions
indra/llaudio/llstreamingaudio_fmodstudio.h
with
59 additions
and
16 deletions
indra/llaudio/llstreamingaudio_fmodstudio.cpp
+
57
−
16
View file @
e729910e
...
@@ -84,9 +84,64 @@ mRetryCount(0)
...
@@ -84,9 +84,64 @@ mRetryCount(0)
LLStreamingAudio_FMODSTUDIO
::~
LLStreamingAudio_FMODSTUDIO
()
LLStreamingAudio_FMODSTUDIO
::~
LLStreamingAudio_FMODSTUDIO
()
{
{
// nothing interesting/safe to do.
if
(
mCurrentInternetStreamp
)
{
// Isn't supposed to hapen, stream should be clear by now,
// and if it does, we are likely going to crash.
LL_WARNS
(
"FMOD"
)
<<
"mCurrentInternetStreamp not null on shutdown!"
<<
LL_ENDL
;
stop
();
}
// Kill dead internet streams, if possible
killDeadStreams
();
if
(
!
mDeadStreams
.
empty
())
{
// LLStreamingAudio_FMODSTUDIO was inited on startup
// and should be destroyed on shutdown, it should
// wait for streams to die to not cause crashes or
// leaks.
// Ideally we need to wait on some kind of callback
// to release() streams correctly, but 200 ms should
// be enough and we can't wait forever.
LL_INFOS
(
"FMOD"
)
<<
"Waiting for "
<<
(
S32
)
mDeadStreams
.
size
()
<<
" streams to stop"
<<
LL_ENDL
;
for
(
S32
i
=
0
;
i
<
20
;
i
++
)
{
const
U32
ms_delay
=
10
;
ms_sleep
(
ms_delay
);
// rude, but not many options here
killDeadStreams
();
if
(
mDeadStreams
.
empty
())
{
LL_INFOS
(
"FMOD"
)
<<
"All streams stopped after "
<<
(
S32
)((
i
+
1
)
*
ms_delay
)
<<
"ms"
<<
LL_ENDL
;
break
;
}
}
}
if
(
!
mDeadStreams
.
empty
())
{
LL_WARNS
(
"FMOD"
)
<<
"Failed to kill some audio streams"
<<
LL_ENDL
;
}
}
}
void
LLStreamingAudio_FMODSTUDIO
::
killDeadStreams
()
{
std
::
list
<
LLAudioStreamManagerFMODSTUDIO
*>::
iterator
iter
;
for
(
iter
=
mDeadStreams
.
begin
();
iter
!=
mDeadStreams
.
end
();)
{
LLAudioStreamManagerFMODSTUDIO
*
streamp
=
*
iter
;
if
(
streamp
->
stopStream
())
{
LL_INFOS
(
"FMOD"
)
<<
"Closed dead stream"
<<
LL_ENDL
;
delete
streamp
;
mDeadStreams
.
erase
(
iter
++
);
}
else
{
iter
++
;
}
}
}
void
LLStreamingAudio_FMODSTUDIO
::
start
(
const
std
::
string
&
url
)
void
LLStreamingAudio_FMODSTUDIO
::
start
(
const
std
::
string
&
url
)
{
{
...
@@ -118,21 +173,7 @@ void LLStreamingAudio_FMODSTUDIO::start(const std::string& url)
...
@@ -118,21 +173,7 @@ void LLStreamingAudio_FMODSTUDIO::start(const std::string& url)
void
LLStreamingAudio_FMODSTUDIO
::
update
()
void
LLStreamingAudio_FMODSTUDIO
::
update
()
{
{
// Kill dead internet streams, if possible
// Kill dead internet streams, if possible
std
::
list
<
LLAudioStreamManagerFMODSTUDIO
*>::
iterator
iter
;
killDeadStreams
();
for
(
iter
=
mDeadStreams
.
begin
();
iter
!=
mDeadStreams
.
end
();)
{
LLAudioStreamManagerFMODSTUDIO
*
streamp
=
*
iter
;
if
(
streamp
->
stopStream
())
{
LL_INFOS
(
"FMOD"
)
<<
"Closed dead stream"
<<
LL_ENDL
;
delete
streamp
;
mDeadStreams
.
erase
(
iter
++
);
}
else
{
iter
++
;
}
}
// Don't do anything if there are no streams playing
// Don't do anything if there are no streams playing
if
(
!
mCurrentInternetStreamp
)
if
(
!
mCurrentInternetStreamp
)
...
...
This diff is collapsed.
Click to expand it.
indra/llaudio/llstreamingaudio_fmodstudio.h
+
2
−
0
View file @
e729910e
...
@@ -59,6 +59,8 @@ class LLStreamingAudio_FMODSTUDIO : public LLStreamingAudioInterface
...
@@ -59,6 +59,8 @@ class LLStreamingAudio_FMODSTUDIO : public LLStreamingAudioInterface
/*virtual*/
bool
supportsAdjustableBufferSizes
(){
return
true
;}
/*virtual*/
bool
supportsAdjustableBufferSizes
(){
return
true
;}
/*virtual*/
void
setBufferSizes
(
U32
streambuffertime
,
U32
decodebuffertime
);
/*virtual*/
void
setBufferSizes
(
U32
streambuffertime
,
U32
decodebuffertime
);
private
:
private
:
void
killDeadStreams
();
FMOD
::
System
*
mSystem
;
FMOD
::
System
*
mSystem
;
LLAudioStreamManagerFMODSTUDIO
*
mCurrentInternetStreamp
;
LLAudioStreamManagerFMODSTUDIO
*
mCurrentInternetStreamp
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment