irei1as 7 лет назад
Родитель
Сommit
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 );
       IResettable* resettable = dynamic_cast< IResettable* >( s );
       if( resettable )
       if( resettable )
       {
       {
+         IPositionable< U32 >* positionable = dynamic_cast< IPositionable< U32 >* >( &Deref( stream ) );
+         U32 pos;
+         if(positionable)
+            pos = positionable->getPosition();
+         
          resettable->reset();
          resettable->reset();
          isEOS = false;
          isEOS = false;
          this->mNumRemainingSourceElements = mNumTotalSourceElements;
          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 )
    else if( isEOS )