All submissions to this site are governed by the Second Life Viewer Contribution Agreement. By submitting patches and other information using this site, you acknowledge that you have read, understood, and agreed to those terms.

Review Board 1.6.11

Welcome to the Second Life Viewer Code Review tool.
See the documentation on our wiki for how to use this site.

(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.

 
Review request changed
Updated (March 31, 2011, 10:18 a.m.)
  • 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.

  1. Looks like making gestures observers of their pending assets will not allow to remove the nested loops completely. When an asset is loaded we still have to iterate through all the gestures for which this asset had been requested and remove it from each gesture's pending asset list. This also increases the memory usage because we store separate lists of assets which may have duplicates.
    
    Also making gesture an observer adds the need in tracking its lifetime. Deriving LLMultiGesture from boost::signals2::trackable for that purpose will require LLAssetStorage refactoring to use boost::signals2 for connecting the callbacks.
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).
  1. It could be a non-static method of LLMulitGesture if a gesture would be an observer of its own pending assets, or if a gesture would check pending assets from the list stored at LLGestureMgr. In this case the LLMulitGesture class becomes more complicated without any gain in performance because this is the same check that LLGestureMgr::hasLoadingAssets() does.
  2. OK. Could you still consider to pass a pointer-to-const?