浏览代码

Update asyncPacketStream.h

irei1as 7 年之前
父节点
当前提交
c3fb349bf2
共有 1 个文件被更改,包括 13 次插入0 次删除
  1. 13 0
      Engine/source/platform/async/asyncPacketStream.h

+ 13 - 0
Engine/source/platform/async/asyncPacketStream.h

@@ -281,9 +281,22 @@ void AsyncPacketBufferedInputStream< Stream, Packet >::_requestNext()
       IResettable* resettable = dynamic_cast< IResettable* >( s );
       if( resettable )
       {
+         IPositionable< U32 >* positionable = dynamic_cast< IPositionable< U32 >* >( &Deref( stream ) );
+         U32 pos;
+         if(positionable)
+            pos = positionable->getPosition();
+         
          resettable->reset();
          isEOS = false;
          this->mNumRemainingSourceElements = mNumTotalSourceElements;
+         
+         if( positionable )
+         {
+            positionable->setPosition(pos);
+            U32 dur = stream->getDuration();
+            if(dur != 0) //avoiding division by zero? not needed, probably
+               this->mNumRemainingSourceElements -= (U32)(mNumTotalSourceElements*(F32)pos/dur);
+         }
       }
    }
    else if( isEOS )