[xiph-commits] r8387 -
trunk/oggdsf/src/lib/core/directshow/dsfOggDemux
illiminable at motherfish-iii.xiph.org
illiminable at motherfish-iii.xiph.org
Tue Dec 14 07:22:36 PST 2004
Author: illiminable
Date: 2004-12-14 07:22:36 -0800 (Tue, 14 Dec 2004)
New Revision: 8387
Modified:
trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.cpp
trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.h
Log:
* Reeally fixed the boundary case for chunk trasfer (i think !)
Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.cpp 2004-12-14 14:31:38 UTC (rev 8386)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.cpp 2004-12-14 15:22:36 UTC (rev 8387)
@@ -36,6 +36,7 @@
, mIsChunked(false)
, mIsFirstChunk(true)
, mChunkRemains(0)
+ , mNumLeftovers(0)
{
mBufferLock = new CCritSec;
debugLog.open("d:\\zen\\logs\\htttp.log", ios_base::out);
@@ -43,8 +44,8 @@
fileDump.open("d:\\zen\\logs\\filedump.ogg", ios_base::out|ios_base::binary);
rawDump.open("D:\\zen\\logs\\rawdump.out", ios_base::out|ios_base::binary);
+ mInterBuff = new unsigned char[RECV_BUFF_SIZE* 2];
-
}
HTTPFileSource::~HTTPFileSource(void)
@@ -56,6 +57,7 @@
fileDump.close();
rawDump.close();
delete mBufferLock;
+ delete mInterBuff;
}
@@ -65,11 +67,14 @@
debugLog<<"UnChunk"<<endl;
unsigned long locNumBytesLeft = inNumBytes;
- unsigned char* locWorkingBuffPtr = inBuff;
+ memcpy((void*)(mInterBuff + mNumLeftovers), (const void*)inBuff, inNumBytes);
+ locNumBytesLeft += mNumLeftovers;
+ mNumLeftovers = 0;
+ unsigned char* locWorkingBuffPtr = mInterBuff;
debugLog<<"inNumBytes = "<<inNumBytes<<endl;
- while (locNumBytesLeft > 0) {
+ while (locNumBytesLeft > 8) {
debugLog<<"---"<<endl;
debugLog<<"Bytes left = "<<locNumBytesLeft<<endl;
debugLog<<"ChunkRemaining = "<<mChunkRemains<<endl;
@@ -92,14 +97,15 @@
locNumBytesLeft -= 2;
}
- if (mLeftOver != "") {
+ /* if (mLeftOver != "") {
debugLog<<"Sticking the leftovers back together..."<<endl;
locTemp = mLeftOver + locTemp;
mLeftOver = "";
- }
+ }*/
size_t locChunkSizePos = locTemp.find("\r\n");
+
if (locChunkSizePos != string::npos) {
debugLog<<"Found the size bytes "<<endl;
//Get a string representation of the hex string that tells us the size of the chunk
@@ -116,8 +122,8 @@
locWorkingBuffPtr += locGuffSize;
locNumBytesLeft -= locGuffSize;
} else {
- debugLog<<"Setting leftovers to "<<mLeftOver<<endl;
- mLeftOver = locTemp;
+ debugLog<<"************************************** "<<endl;
+
}
}
@@ -147,6 +153,12 @@
}
}
+
+ if (locNumBytesLeft != 0) {
+ debugLog<<"There is a non- zero amount of bytes leftover... buffer them up for next time..."<<endl;
+ memcpy((void*)mInterBuff, (const void*)locWorkingBuffPtr, locNumBytesLeft);
+ mNumLeftovers = locNumBytesLeft;
+ }
}
void HTTPFileSource::DataProcessLoop() {
//debugLog<<"DataProcessLoop: "<<endl;
Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.h
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.h 2004-12-14 14:31:38 UTC (rev 8386)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.h 2004-12-14 15:22:36 UTC (rev 8387)
@@ -84,7 +84,9 @@
fstream fileDump;
fstream rawDump;
- string mLeftOver;
+ unsigned char* mInterBuff;
+ unsigned long mNumLeftovers;
+ static const unsigned long RECV_BUFF_SIZE = 1024;
CCritSec* mBufferLock;
More information about the commits
mailing list