[xiph-commits] r10278 - branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder

illiminable at svn.xiph.org illiminable at svn.xiph.org
Sun Oct 23 10:13:00 PDT 2005


Author: illiminable
Date: 2005-10-23 10:12:57 -0700 (Sun, 23 Oct 2005)
New Revision: 10278

Modified:
   branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.cpp
Log:
* Fix bug with long buffers, incorrectly setting the size field in the sample

Modified: branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.cpp
===================================================================
--- branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.cpp	2005-10-23 16:41:26 UTC (rev 10277)
+++ branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.cpp	2005-10-23 17:12:57 UTC (rev 10278)
@@ -171,6 +171,8 @@
 				*locShortBuffer = tempInt;
 				locShortBuffer++;
 			}
+
+			locThis->mDecodedByteCount += locActualSize;
 			
 			return 0;
 		} else {
@@ -359,12 +361,12 @@
 						return locHR;
 					}
 
-					locBytesToCopy = (mDecodedByteCount <= locSample->GetSize()) ? mDecodedByteCount : locSample->GetSize();
+					locBytesToCopy = ((mDecodedByteCount - locBytesCopied) <= locSample->GetSize()) ? (mDecodedByteCount - locBytesCopied) : locSample->GetSize();
 
 					memcpy((void*)locBuffer, (const void*)&mDecodedBuffer[locBytesCopied], locBytesToCopy);
 					locBytesCopied += locBytesToCopy;
 
-					locSampleDuration = (((locBytesCopied/mFrameSize) * UNITS) / mSampleRate);
+					locSampleDuration = (((locBytesToCopy/mFrameSize) * UNITS) / mSampleRate);
 					locEnd = locStart + locSampleDuration;
 
 					//Write the sample meta data
@@ -372,7 +374,7 @@
 					locSample->SetTime(&locStart, &locEnd);
 					locSample->SetMediaTime(&locStart, &locEnd);
 					locSample->SetSyncPoint(TRUE);
-					locSample->SetActualDataLength(locBytesCopied);
+					locSample->SetActualDataLength(locBytesToCopy);
 					locHR = ((VorbisDecodeOutputPin*)(mOutputPin))->mDataQueue->Receive(locSample);
 					if (locHR != S_OK) {
 						return locHR;



More information about the commits mailing list