[xiph-commits] r7628 -
trunk/oggdsf/src/lib/core/directshow/dsfOggDemux
illiminable at motherfish-iii.xiph.org
illiminable at motherfish-iii.xiph.org
Tue Aug 24 13:27:24 PDT 2004
Author: illiminable
Date: 2004-08-24 13:27:24 -0700 (Tue, 24 Aug 2004)
New Revision: 7628
Modified:
trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.cpp
trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.h
trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPSocket.cpp
trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPSocket.h
trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggDemuxSourceFilter.cpp
trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/SingleMediaFileCache.cpp
trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/SingleMediaFileCache.h
Log:
* Removed some memory leaks.
* Fixed a problem deleting objects through virtual interfaces.
* Still remains a problem when deleting the network source that the worker thread can be active and seg fault when the object is deleted from under it.
Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.cpp 2004-08-24 18:49:45 UTC (rev 7627)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.cpp 2004-08-24 20:27:24 UTC (rev 7628)
@@ -32,8 +32,7 @@
#include "httpfilesource.h"
HTTPFileSource::HTTPFileSource(void)
- : HTTPSocket()
- , mBufferLock(NULL)
+ : mBufferLock(NULL)
{
mBufferLock = new CCritSec;
debugLog.open("G:\\logs\\httpdebug.log", ios_base::out);
@@ -73,6 +72,7 @@
if (locNumRead == 0) {
debugLog<<"Read last bytes..."<<endl;
mIsEOF = true;
+ delete locBuff;
return;
}
Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.h
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.h 2004-08-24 18:49:45 UTC (rev 7627)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.h 2004-08-24 20:27:24 UTC (rev 7628)
@@ -39,13 +39,14 @@
#include <fstream>
using namespace std;
class OGG_DEMUX_API HTTPFileSource
- : protected HTTPSocket
- , public IFilterDataSource
+ : public IFilterDataSource
, public CAMThread
+ , protected HTTPSocket
+
{
public:
HTTPFileSource(void);
- ~HTTPFileSource(void);
+ virtual ~HTTPFileSource(void);
//Thread commands
static const int THREAD_RUN = 0;
Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPSocket.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPSocket.cpp 2004-08-24 18:49:45 UTC (rev 7627)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPSocket.cpp 2004-08-24 20:27:24 UTC (rev 7628)
@@ -37,7 +37,7 @@
, mIsOpen(false)
, mSeenResponse(false)
{
- debugLog.open("G:\\logs\\httpsocket.log", ios_base::out);
+ debugLog2.open("G:\\logs\\httpsocket.log", ios_base::out);
//Setup the socket API
WORD locWinsockVersion = MAKEWORD(1,1);
@@ -47,18 +47,18 @@
locRet = WSAStartup(locWinsockVersion, &locWinsockData);
if ((locRet != 0) || (locWinsockData.wVersion != locWinsockVersion)) {
//Failed to setup.
- debugLog<<"Failed to start winsock V "<<locWinsockData.wVersion<<endl;
+ debugLog2<<"Failed to start winsock V "<<locWinsockData.wVersion<<endl;
WSACleanup();
throw 0;
}
- debugLog<<"Winsock started"<<endl;
+ debugLog2<<"Winsock started"<<endl;
}
HTTPSocket::~HTTPSocket(void)
{
- debugLog<<"Winsock ended"<<endl;
- debugLog.close();
+ debugLog2<<"Winsock ended"<<endl;
+ debugLog2.close();
WSACleanup();
}
@@ -66,7 +66,7 @@
bool HTTPSocket::setupSocket(string inSourceLocation) {
- debugLog<<"Setup Socket:"<<endl;
+ debugLog2<<"Setup Socket:"<<endl;
IN_ADDR locAddress; //iaHost
LPHOSTENT locHostData;; //lpHost
@@ -84,14 +84,14 @@
if (locHostData == NULL) {
- debugLog<<"LocHostData is NULL"<<endl;
+ debugLog2<<"LocHostData is NULL"<<endl;
//Failed
return false;
}
mSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (mSocket == INVALID_SOCKET) {
- debugLog<<"Socket Invalid"<<endl;
+ debugLog2<<"Socket Invalid"<<endl;
//Failed
return false;
}
@@ -121,7 +121,7 @@
int locRetVal = 0;
locRetVal = connect(mSocket, (LPSOCKADDR)&locServiceSocketAddr, sizeof(SOCKADDR_IN));
if (locRetVal == SOCKET_ERROR) {
- debugLog<<"Failed to connect..."<<endl;
+ debugLog2<<"Failed to connect..."<<endl;
closesocket(mSocket);
return false;
}
@@ -134,16 +134,16 @@
string HTTPSocket::assembleRequest(string inFilePath) {
string retRequest;
retRequest = "GET " + inFilePath+ " HTTP/1.1\n" + "Host: " + mServerName+ "\n\n";
- debugLog<<"Assembled Req : "<<endl<<retRequest<<endl;
+ debugLog2<<"Assembled Req : "<<endl<<retRequest<<endl;
return retRequest;
}
bool HTTPSocket::httpRequest(string inRequest) {
- debugLog<<"Http Request:"<<endl;
+ debugLog2<<"Http Request:"<<endl;
int locRetVal = send(mSocket, inRequest.c_str(), (int)inRequest.length(), 0);
if (locRetVal == SOCKET_ERROR) {
- debugLog<<"Socket error on send"<<endl;
+ debugLog2<<"Socket error on send"<<endl;
closesocket(mSocket);
return false;
}
@@ -151,7 +151,7 @@
}
bool HTTPSocket::splitURL(string inURL) {
- debugLog<<"Split url:"<<endl;
+ debugLog2<<"Split url:"<<endl;
string locProtocol;
string locServerName;
string locPath;
@@ -198,11 +198,11 @@
} else {
mPort = 0;
}
- debugLog<<"Proto : "<<locProtocol<<endl<<"Server : "<<locServerName<<endl<<" Path : "<<mFileName<<" Port : "<<mPort<<endl;
+ debugLog2<<"Proto : "<<locProtocol<<endl<<"Server : "<<locServerName<<endl<<" Path : "<<mFileName<<" Port : "<<mPort<<endl;
return true;
}
void HTTPSocket::closeSocket() {
- debugLog<<"Close Socket:"<<endl;
+ debugLog2<<"Close Socket:"<<endl;
closesocket(mSocket);
}
\ No newline at end of file
Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPSocket.h
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPSocket.h 2004-08-24 18:49:45 UTC (rev 7627)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPSocket.h 2004-08-24 20:27:24 UTC (rev 7628)
@@ -33,7 +33,7 @@
#include <string>
using namespace std;
-class HTTPSocket
+class OGG_DEMUX_API HTTPSocket
{
public:
HTTPSocket(void);
@@ -56,6 +56,6 @@
bool mIsOpen;
bool mSeenResponse;
- fstream debugLog;
+ fstream debugLog2;
};
Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggDemuxSourceFilter.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggDemuxSourceFilter.cpp 2004-08-24 18:49:45 UTC (rev 7627)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggDemuxSourceFilter.cpp 2004-08-24 20:27:24 UTC (rev 7628)
@@ -562,6 +562,7 @@
while (!locIsEOF && locKeepGoing) {
if(CheckRequest(&locCommand) == TRUE) {
//debugLog<<"DataProcessLoop : Thread Command issued... leaving loop."<<endl;
+ delete locBuff;
return S_OK;
}
Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/SingleMediaFileCache.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/SingleMediaFileCache.cpp 2004-08-24 18:49:45 UTC (rev 7627)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/SingleMediaFileCache.cpp 2004-08-24 20:27:24 UTC (rev 7628)
@@ -1,3 +1,33 @@
+//===========================================================================
+//Copyright (C) 2003, 2004 Zentaro Kavanagh
+//
+//Redistribution and use in source and binary forms, with or without
+//modification, are permitted provided that the following conditions
+//are met:
+//
+//- Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+//- Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+//- Neither the name of Zentaro Kavanagh nor the names of contributors
+// may be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+//``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+//PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ORGANISATION OR
+//CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+//EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+//PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+//LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+//NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+//SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//===========================================================================
#include "StdAfx.h"
#include ".\singlemediafilecache.h"
Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/SingleMediaFileCache.h
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/SingleMediaFileCache.h 2004-08-24 18:49:45 UTC (rev 7627)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/SingleMediaFileCache.h 2004-08-24 20:27:24 UTC (rev 7628)
@@ -1,3 +1,33 @@
+//===========================================================================
+//Copyright (C) 2003, 2004 Zentaro Kavanagh
+//
+//Redistribution and use in source and binary forms, with or without
+//modification, are permitted provided that the following conditions
+//are met:
+//
+//- Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+//- Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+//- Neither the name of Zentaro Kavanagh nor the names of contributors
+// may be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+//``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+//PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ORGANISATION OR
+//CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+//EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+//PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+//LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+//NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+//SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//===========================================================================
#pragma once
//This class will be a cache of a single media file.
@@ -12,7 +42,7 @@
#include <string>
#include <fstream>
using namespace std;
-class SingleMediaFileCache
+class OGG_DEMUX_API SingleMediaFileCache
{
public:
SingleMediaFileCache(void);
More information about the commits
mailing list