[prev in list] [next in list] [prev in thread] [next in thread] 

List:       helix-common-cvs
Subject:    [Common-cvs] fileio/platform/unix mmapdatf.cpp, 1.21,
From:       dcollins () helixcommunity ! org
Date:       2010-10-21 21:52:18
Message-ID: 201010212152.o9LLqjGT002298 () mailer ! progressive-comp ! com
[Download RAW message or body]

Update of /cvsroot/common/fileio/platform/unix
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv18670/platform/unix

Modified Files:
	mmapdatf.cpp mmapdatf.h 
Log Message:
Synopsis
========
Large-File Support updates for mp4ff, server mmapmgr and server http

Branches: HEAD
Reviewers: Chytanya


Description
===========

This contains various updates related to Large-File Support in 64-bit
server builds.  The primary modules/objects updated are mp4ff, 
server memory-mapped I/O, and server HTTP protocol support.

In most cases, 32-bit offsets were changed to HX_OFF_T.  This allows
64-bit server builds to serve large (>4GB) MP4/3GP files via RTSP
streaming and HTTP progressive download.

The main exception was the server's HTTP byte-range code which was
updated to use UINT64's for all server builds, 32-bit and 64-bit.
While a 32-bit build should now be able to parse 64-bit Range headers
without generating bogus offsets, it would still be limited by the 32-bit
file offset limitation of the typical 32-bit builds.

The 64-bit MP4 support in the hxclient_2_1_0_cayenne and
hxclient_4_2_0_brizo branches were reviewed as part of this.  Aside from
being incomplete for the server's needs, these were not very practical to
merge to the HEAD since these broke binary compatability for 32-bit builds
by changing numerous UINT32's to UINT64's.  This is why the approach
used was to leverage the HX_OFF_T type.  It will ease the transition and
provide more flexibility for various builds.  These branches have also
diverged from the HEAD somewhat and a direct merge was not going to work
very well.

Supporting 64-bit large files with 32-bit builds of the server (or
other products) should be able to leverage most of this, though it is
not specifically part of this project so it will not work with these
changes alone.



Files Affected
==============

common/fileio/fdbufdataf.cpp
common/fileio/mmapmgr.cpp
common/fileio/mmapmgr.h
common/fileio/platform/unix/mmapdatf.cpp
common/fileio/platform/unix/mmapdatf.h
common/include/hxprdnld.h
common/runtime/pub/hlxclib/stdlib.h
datatype/mp4/fileformat/atomizer.cpp
datatype/mp4/fileformat/fswtchr.cpp
datatype/mp4/fileformat/pub/atomizer.h
datatype/mp4/fileformat/pub/fswtchr.h
datatype/mp4/fileformat/pub/hxfswch.h
datatype/mp4/fileformat/pub/qtatmmgs.h
datatype/mp4/fileformat/pub/qtatoms.h
datatype/mp4/fileformat/pub/qtatoms_inline.h
datatype/mp4/fileformat/pub/qtbatom.h
datatype/mp4/fileformat/pub/qtffplin.h
datatype/mp4/fileformat/pub/qtmcache.h
datatype/mp4/fileformat/pub/qttrack.h
datatype/mp4/fileformat/qtatoms.cpp
datatype/mp4/fileformat/qtbatom.cpp
datatype/mp4/fileformat/qtffplin.cpp
datatype/mp4/fileformat/qttrack.cpp
datatype_rn/mp4/fileformat/hinttrack/qthinttrack.cpp
datatype_rn/mp4/fileformat/hinttrack/qtsample.h
filesystem/local/full/smplfsys.cpp
protocol/http/httpmsg.cpp
protocol/http/httppars.cpp
protocol/http/pub/httpmsg.h
server/engine/core/dispatchq.cpp
server/engine/dataflow/http.cpp
server/engine/dataflow/pub/http.h
server/protocol/http/httpbaseproto.cpp
server/protocol/http/http_demux.cpp
server/protocol/http/httpprot.cpp
server/protocol/http/pub/httpprot.h
server/protocol/http/servhttppost.cpp
server-restricted/protocol/http/httpallow.cpp
server-restricted/protocol/http/httprange.cpp
server-restricted/protocol/http/pub/httprange.h


Testing Performed
=================

Unit Tests:
- N/A

Integration Tests:
- Tested with Memory-mapped I/O enabled and disabled, using RTSP/UDP and
  HTTP progressive download.  Tested with Mac Quicktime, Windows VLC,
  and RealPlayer SP players with varying degrees of player functionality.
  Also tested byte-ranges retrieval with curl.


Leak Tests:
- N/A

Performance Tests:
- N/A

Platforms Tested: linux-rhel5-x86_64
Builds Verified: linux-rhel5-x86_64, sunos-5.10-sparc64, win-x86_64-vc10


QA Hints
========
- N/A


Index: mmapdatf.h
===================================================================
RCS file: /cvsroot/common/fileio/platform/unix/mmapdatf.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- mmapdatf.h	14 Sep 2010 16:49:47 -0000	1.7
+++ mmapdatf.h	21 Oct 2010 21:52:16 -0000	1.8
@@ -174,8 +174,8 @@
     IHXBuffer*				m_pFilename;
     int					m_nFD;
     void*				MmapHandle;
-    UINT32				m_ulPos;
-    UINT32				m_ulFilePointerPos;
+    HX_OFF_T				m_nPos;
+    HX_OFF_T				m_nFilePointerPos;
     MemoryMapManager*			m_pMMM;
     IUnknown*				m_pContext;
     UINT32				m_ulChunkSize;

Index: mmapdatf.cpp
===================================================================
RCS file: /cvsroot/common/fileio/platform/unix/mmapdatf.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- mmapdatf.cpp	14 Sep 2010 16:49:47 -0000	1.21
+++ mmapdatf.cpp	21 Oct 2010 21:52:16 -0000	1.22
@@ -137,8 +137,8 @@
 , m_ulLastError(HXR_OK)
 , m_pFilename(NULL)
 , m_nFD(-1)
-, m_ulPos(0)
-, m_ulFilePointerPos(0)
+, m_nPos(0)
+, m_nFilePointerPos(0)
 , MmapHandle(0)
 , m_pMMM((MemoryMapManager*)pPersistantObject)
 , m_ulChunkSize(ulChunkSize)
@@ -339,8 +339,8 @@
      * This class doesn't need to keep the original file open if we 
      * are using mmap() on the file.
      */
-    m_ulPos = 0;
-    m_ulFilePointerPos = 0;
+    m_nPos = 0;
+    m_nFilePointerPos = 0;
 
     return HXR_OK;
 }
@@ -425,18 +425,22 @@
     switch (fromWhere)
     {
     case SEEK_CUR:
-	m_ulPos += offset;
-	m_ulFilePointerPos += offset;
+	m_nPos += offset;
+	m_nFilePointerPos += offset;
 	break;
     case SEEK_SET:
+#ifdef _LONG_IS_64
+	if (((INT64) offset) < 0)
+#else
 	if (((LONG32) offset) < 0)
+#endif
 	{
 	    offset2 = (offset & 0x01);
 	    offset = (offset >> 1);
 	    offset2 += offset;
 	}
-	m_ulPos = offset;
-	m_ulFilePointerPos = offset;
+	m_nPos = offset;
+	m_nFilePointerPos = offset;
 	break;
     default:
 	ASSERT(0);
@@ -475,7 +479,7 @@
     HX_OFF_T offset = (HX_OFF_T)-1;
     if (MmapHandle)
     {
-	return m_ulPos;
+	return m_nPos;
     }
     if (m_nFD > 0)
     {
@@ -496,7 +500,7 @@
 	return;
     m_pMMM->CloseMap(MmapHandle);
     MmapHandle = 0;
-    Seek(m_ulPos, SEEK_SET);
+    Seek(m_nPos, SEEK_SET);
 }
 
 /* Read reads up to count bytes of data into buf.
@@ -505,12 +509,12 @@
 STDMETHODIMP_(ULONG32)
 MemoryMapDataFile::Read(REF(IHXBuffer *) pBuf, ULONG32 count)
 {
-    UINT32 ncnt = 0;           // number of bytes read
+    HX_OFF_T ncnt = 0;           // number of bytes read
     m_ulLastError = HXR_OK;
 
     if (MmapHandle)
     {
-	ncnt = m_pMMM->GetBlock(pBuf, MmapHandle, m_ulPos, count);
+	ncnt = m_pMMM->GetBlock(pBuf, MmapHandle, m_nPos, count);
 	if (ncnt >= MMAP_EXCEPTION)
 	{
 	    if (ncnt != MMAP_EOF_EXCEPTION)
@@ -519,15 +523,15 @@
 	    }
 	    else
 	    {
-		Seek(m_ulPos, SEEK_SET);
+		Seek(m_nPos, SEEK_SET);
 	    }
 
 	    goto normal_read;
 	}
 	if (ncnt > 0)
 	{
-	    m_ulPos += ncnt;
-	    m_ulFilePointerPos += ncnt;
+	    m_nPos += ncnt;
+	    m_nFilePointerPos += ncnt;
 	}
 	return (ULONG32)ncnt;
     }
@@ -543,10 +547,10 @@
 
     if (m_nFD > 0)
     { 
-	ULONG32 tmpCheck = Tell();
-	if (tmpCheck != m_ulPos)
+	HX_OFF_T tmpCheck = Tell();
+	if (tmpCheck != m_nPos)
 	{
-	    if (lseek(m_nFD, m_ulPos, SEEK_SET) < 0)
+	    if (lseek(m_nFD, m_nPos, SEEK_SET) < 0)
             {
                 m_ulLastError = errno;
                 return 0;
@@ -566,7 +570,7 @@
 	}
 	else
 	{
-	    m_ulPos += ncnt;
+	    m_nPos += ncnt;
 	}
 	if (ncnt < count)
 	{
@@ -585,9 +589,9 @@
 MemoryMapDataFile::Write(REF(IHXBuffer *) pBuf)
 {
 
-    if (m_ulPos != m_ulFilePointerPos)
+    if (m_nPos != m_nFilePointerPos)
     {
-	Seek(m_ulPos, SEEK_SET);
+	Seek(m_nPos, SEEK_SET);
     }
 
     /*
@@ -611,8 +615,8 @@
 	}
 	else
 	{
-	    m_ulPos += ncnt;
-	    m_ulFilePointerPos += ncnt;
+	    m_nPos += ncnt;
+	    m_nFilePointerPos += ncnt;
 	}
     }
     pBuf->Release();
@@ -669,6 +673,7 @@
 inline INT16
 MemoryMapDataFile::GetFd()
 {
+    //XXX This API returns INT16 which is not sufficient
     return m_nFD;
 }
 


_______________________________________________
Common-cvs mailing list
Common-cvs@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/common-cvs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic