(STORM-380) There is a little delay in sound when gesture first time played
Review Request #231 - Created March 25, 2011 and submitted
Seth ProductEngine | Reviewers | ||
viewer | |||
STORM-380 | |||
None | viewer-development |
Added syncing animations and sounds before the gesture starts playing. The actual playing of animations and sounds of a gesture starts only when all needed animations and sound files are loaded into viewer cache. This reduces the delay between animations and sounds meant to be played simultaneously but may increase the delay between the moment a gesture is triggered and the moment it starts playing. Fixed calling assets callback to clean up the void pointer in getAssetData() and avoid potential memory leaks.
Posted (March 26, 2011, 8:55 a.m.)
Ah, a good issue to tackle! Thanks for looking into it.
-
indra/newview/llgesturemgr.h (Diff revision 1) -
Please use tabs for indentation and spaces for alignment. (Here, that'd be only one tab followed by 32 spaces.) Whatever you did here looks wrong whether I set tab display length to 4 or 8.
-
indra/newview/llgesturemgr.cpp (Diff revision 1) -
If the iterator will not be used outside the loop, please declare it with the assignment in the for's braces.
-
indra/newview/llgesturemgr.cpp (Diff revision 1) -
I'm not sure what you mean by "if it stops". Maybe that the currently handled gesture step stops the animation? If so, maybe write // Don't request the animation if this step stops it or if it is already in Static VFS
-
indra/newview/llgesturemgr.cpp (Diff revision 1) -
Why are STEP_CHAT and STEP_WAIT mentioned when they don't do anything and we do have a default step that also doesn't do anything? If all cases are supposed to be explicitly handled, we might want to make sure of that with: // [...] case STEP_CHAT: case STEP_WAIT: { break; } default: { // We should never get here. llassert(false); } } (... or maybe just some terminal output.)
-
indra/newview/llgesturemgr.cpp (Diff revision 1) -
s/is/if/
-
indra/newview/llgesturemgr.cpp (Diff revision 1) -
Hmm ... so with the current change, a gesture's playback could potentially be delayed forever due to assets for other gestures being loaded?
-
indra/newview/llgesturemgr.cpp (Diff revision 1) -
Can a gesture reference other asset types than animations and sounds? And if it can, shouldn't those be removed from mLoadingAssets, too, once loaded? If it can but shouldn't maybe some terminal output would be appropriate here.
Posted (March 28, 2011, 4:06 a.m.)
-
indra/newview/llgesturemgr.cpp (Diff revision 1) -
I think that there's a race condition here. Wouldn't it be better to insert the id into the mLoadingAssets before requesting it, so that it is sure to be in the list if the onAssetLoadComplete is called immediately?
-
indra/newview/llgesturemgr.cpp (Diff revision 1) -
Same possible race as above
Review request changed
Updated (March 28, 2011, 12:21 p.m.)
-
- added Diff r2
Fixes according to the feedback on revision 1.
Should be fine then, as far as I can tell.
Review request changed
Updated (March 31, 2011, 10:18 a.m.)
-
- added Diff r3
-
First pass implementation of syncing the animations and sounds before the gesture starts playing. The actual playing of animations and sounds of a gesture starts only when all needed animations and sound files are loaded into viewer cache. This reduces the delay between animations and sounds meant to be played simultaneously but may increase the delay between the moment a gesture is triggered and the moment it starts playing.
Added syncing animations and sounds before the gesture starts playing. The actual playing of animations and sounds of a gesture starts only when all needed animations and sound files are loaded into viewer cache. This reduces the delay between animations and sounds meant to be played simultaneously but may increase the delay between the moment a gesture is triggered and the moment it starts playing. Fixed calling assets callback to clean up the void pointer in getAssetData() and avoid potential memory leaks.
- Fixed checking the pending downloads for each playing gesture separately. - Fixed calling assets callback to clean up the void pointer in getAssetData() and avoid potential memory leaks.
Posted (April 1, 2011, 4:22 a.m.)
I'm a bit worried about the loop-nesting. E.g.
-
indra/newview/llgesturemgr.cpp (Diff revisions 2 - 3) -
in update, stepGesture is called in a loop
-
indra/newview/llgesturemgr.cpp (Diff revisions 2 - 3) -
stepGesture calls hasLoadingAssets
-
indra/newview/llgesturemgr.cpp (Diff revisions 2 - 3) -
hasLoadingAssets calls set::find in a loop (which is logarithmic in the set's size) so we have N * M * log(L) behavior for update(). This might not be too bad, as the number of queued gestures N, the number of steps per gesture M and the number of loading assets L are probably all small most of the time, and the inner loop is exited via return once the first match has been found. But I still wonder whether it might pay off to e.g. make the gestures observers of their pending assets.
-
indra/newview/llgesturemgr.h (Diff revision 3) -
Shouldn't this be a (non-static) method of LLMulitGesture taking no argument, rather than a static member of LLGestureMgr taking a pointer to a gesture? Also, the gesture should not be changed by that, should it? If possible, make the argument type pointer-to-const (or, if you make it a method of LLMultiGesture as suggested, make it a const method).
Other reviews