diff options
author | Monroe Linden <monroe@lindenlab.com> | 2010-06-15 10:53:02 -0700 |
---|---|---|
committer | Monroe Linden <monroe@lindenlab.com> | 2010-06-15 10:53:02 -0700 |
commit | d6af2d0985951f5863620bfc6d6e763769cc07fa (patch) | |
tree | 5da98c77afc0e36910a23f860fefc0d07c1e4019 | |
parent | da078d9a35e256a59652f6ed545b3cb09f384bb0 (diff) |
Fix for EXT-7414 (Jumping to a specific time in a video stream does not work in Viewer 2.)
This was a race condition. In the repro case, LLViewerMediaImpl::seek() was getting called before the media source got a chance to be loaded (since the load is now delayed at least 1 frame due to the priority calculations), so the seek command was being dropped.
The fix is to save the seek time in mPreviousMediaTime in this case, and rearrange the code in LLViewerMediaImpl::loadURI() so that it gets used whenever it's non-zero. I've also added similar code in LLViewerMediaImpl::pause() and LLViewerMediaImpl::start() to set mPreviousMediaState. (If there are any cases where content wants parcel media to start out paused, they would have had a similar issue.)
Reviewed by Callum and Richard at http://codereview.lindenlab.com/2478002 .
-rw-r--r-- | indra/newview/llviewermedia.cpp | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 14e58f4167..d7190f26a3 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -1776,29 +1776,22 @@ void LLViewerMediaImpl::loadURI() llinfos << "Asking media source to load URI: " << uri << llendl; mMediaSource->loadURI( uri ); - + + // A non-zero mPreviousMediaTime means that either this media was previously unloaded by the priority code while playing/paused, + // or a seek happened before the media loaded. In either case, seek to the saved time. + if(mPreviousMediaTime != 0.0f) + { + seek(mPreviousMediaTime); + } + if(mPreviousMediaState == MEDIA_PLAYING) { // This media was playing before this instance was unloaded. - - if(mPreviousMediaTime != 0.0f) - { - // Seek back to where we left off, if possible. - seek(mPreviousMediaTime); - } - start(); } else if(mPreviousMediaState == MEDIA_PAUSED) { // This media was paused before this instance was unloaded. - - if(mPreviousMediaTime != 0.0f) - { - // Seek back to where we left off, if possible. - seek(mPreviousMediaTime); - } - pause(); } else @@ -1857,6 +1850,10 @@ void LLViewerMediaImpl::pause() { mMediaSource->pause(); } + else + { + mPreviousMediaState = MEDIA_PAUSED; + } } ////////////////////////////////////////////////////////////////////////////////////////// @@ -1866,6 +1863,10 @@ void LLViewerMediaImpl::start() { mMediaSource->start(); } + else + { + mPreviousMediaState = MEDIA_PLAYING; + } } ////////////////////////////////////////////////////////////////////////////////////////// @@ -1875,6 +1876,11 @@ void LLViewerMediaImpl::seek(F32 time) { mMediaSource->seek(time); } + else + { + // Save the seek time to be set when the media is loaded. + mPreviousMediaTime = time; + } } ////////////////////////////////////////////////////////////////////////////////////////// |