[xiph-commits] r10769 -
branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2
illiminable at svn.xiph.org
illiminable at svn.xiph.org
Sun Jan 29 06:33:23 PST 2006
Author: illiminable
Date: 2006-01-29 06:33:16 -0800 (Sun, 29 Jan 2006)
New Revision: 10769
Modified:
branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/DataSourceFactory.cpp
branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/DataSourceFactory.h
branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/HTTPStreamingFileSource.cpp
branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/HTTPStreamingFileSource.h
Log:
* More fixes to the threading and caching via http
* Hook the new stream cache up as the default handler for http.
* Allows web streams to be properly stopped and restarted
* Actually works(mostly!)
* Has trouble dealing with end of stream at the moment.
Modified: branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/DataSourceFactory.cpp
===================================================================
--- branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/DataSourceFactory.cpp 2006-01-29 13:18:03 UTC (rev 10768)
+++ branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/DataSourceFactory.cpp 2006-01-29 14:33:16 UTC (rev 10769)
@@ -50,7 +50,8 @@
return new FilterFileSource;
} else if (locType == "http") {
//Http stream
- return new HTTPFileSource;
+ //return new HTTPFileSource;
+ return new HTTPStreamingFileSource;
} else {
//Something else
return NULL;
Modified: branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/DataSourceFactory.h
===================================================================
--- branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/DataSourceFactory.h 2006-01-29 13:18:03 UTC (rev 10768)
+++ branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/DataSourceFactory.h 2006-01-29 14:33:16 UTC (rev 10769)
@@ -32,6 +32,8 @@
#include "IFilterDataSource.h"
#include "FilterFileSource.h"
#include "HTTPFileSource.h"
+
+#include "HTTPStreamingFileSource.h"
class OGG_DEMUX2_API DataSourceFactory
{
public:
Modified: branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/HTTPStreamingFileSource.cpp
===================================================================
--- branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/HTTPStreamingFileSource.cpp 2006-01-29 13:18:03 UTC (rev 10768)
+++ branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/HTTPStreamingFileSource.cpp 2006-01-29 14:33:16 UTC (rev 10769)
@@ -40,6 +40,7 @@
, mNumLeftovers(0)
, mMemoryBuffer(NULL)
, mContentLength(-1)
+ , mIsBufferFilling(false)
{
mBufferLock = new CCritSec;
#ifdef OGGCODECS_LOGGING
@@ -179,6 +180,8 @@
bool locSeenAny = false;
debugLog<<"Starting dataprocessloop"<<endl;
+ mIsBufferFilling = false;
+
locBuff = new char[RECV_BUFF_SIZE];
while(true) {
@@ -190,11 +193,14 @@
delete[] locBuff;
return;
} else {
+
Reply(S_OK);
}
}
} else {
//Got enough data, wait for a new job
+
+ mIsBufferFilling = false;
if (GetRequest() == THREAD_EXIT) { //Block until we have a new job
debugLog<<"Thread Data Process loop received breakout signal..."<<endl;
delete[] locBuff;
@@ -203,6 +209,8 @@
Reply(S_OK);
}
}
+
+ mIsBufferFilling = true;
//if(CheckRequest(&locCommand) == TRUE) {
// debugLog<<"Thread Data Process loop received breakout signal..."<<endl;
// delete[] locBuff;
@@ -483,8 +491,8 @@
mIsEOF = false;
mWasError = false;
mRetryAt = "";
- mSourceLocation = "";
- mContentLength = -1;
+ //mSourceLocation = "";
+ //mContentLength = -1;
}
bool HTTPStreamingFileSource::isError()
{
@@ -510,26 +518,36 @@
//Reads from the buffer, will return 0 if nothing in buffer.
// If it returns 0 check the isEOF flag to see if it was the end of file or the network is just slow.
+ unsigned long locNumRead = 0;
{ //CRITICAL SECTION - PROTECTING STREAM BUFFER
CAutoLock locLock(mBufferLock);
//debugLog<<"Read:"<<endl;
if((mMemoryBuffer->numBytesAvail() == 0) || mWasError) {
//debugLog<<"read : Can't read is error or eof"<<endl;
- return 0;
+ //return 0;
} else {
//debugLog<<"Reading from buffer"<<endl;
- unsigned long locNumRead = mMemoryBuffer->read((unsigned char*)outBuffer, inNumBytes);
+ if (mMemoryBuffer->numBytesAvail() < inNumBytes) {
+ locNumRead = 0;
+ } else {
+ locNumRead = mMemoryBuffer->read((unsigned char*)outBuffer, inNumBytes);
+ }
if (locNumRead > 0) {
debugLog<<locNumRead<<" bytes read from buffer"<<endl;
}
- if (mMemoryBuffer->numBytesAvail() <= MEMORY_BUFFER_LOW_TIDE) {
- CallWorker(THREAD_RUN);
- }
- return locNumRead;
+ //if (mMemoryBuffer->numBytesAvail() <= MEMORY_BUFFER_LOW_TIDE) {
+ // CallWorker(THREAD_RUN);
+ //}
+ //return locNumRead;
}
} //END CRITICAL SECTION
+
+ if ((mMemoryBuffer->numBytesAvail() <= MEMORY_BUFFER_LOW_TIDE) && (!mIsBufferFilling)) {
+ CallWorker(THREAD_RUN);
+ }
+ return locNumRead;
}
Modified: branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/HTTPStreamingFileSource.h
===================================================================
--- branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/HTTPStreamingFileSource.h 2006-01-29 13:18:03 UTC (rev 10768)
+++ branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/HTTPStreamingFileSource.h 2006-01-29 14:33:16 UTC (rev 10769)
@@ -84,6 +84,8 @@
bool mIsChunked;
unsigned long mChunkRemains;
+ bool mIsBufferFilling;
+
bool mIsFirstChunk;
string mRetryAt;
More information about the commits
mailing list