[hxdatatype] CR-Client-Resend: Issue 765 Fixes. (Fix HTTPLite crash. Add progressive download checks for MP4 files)
Aaron Colwell acolwell at real.comI'll check these changes in tomorrow morning if noone objects.
Aaron
On Fri, 5 Dec 2003, Aaron Colwell wrote:
> Revised httpfileobj.cpp diff. The CHXHTTPFileObject::Advise()
> implementation was changed so that it returns a HXR_FAILED for any usage
> other than HX_FILEADVISE_RANDOMACCESS. If HX_FILEADVISE_RANDOMACCESS is
> specified then HXR_ADVISE_PREFER_LINEAR is returned. This is more in line
> with what the full HTTP filesystem plugin does. It also fixes a bug with
> MP4 playback over HTTP. :)
>
> Aaron
>
> Index: httpfileobj.cpp
> ===================================================================
> RCS file: /cvs/filesystem/httplite/httpfileobj.cpp,v
> retrieving revision 1.5
> diff -u -r1.5 httpfileobj.cpp
> --- httpfileobj.cpp 14 Oct 2003 02:55:59 -0000 1.5
> +++ httpfileobj.cpp 5 Dec 2003 22:50:16 -0000
> @@ -190,6 +190,12 @@
> m_pPendingAddBlock = NULL;
> }
>
> + if (m_ulCallbackHandle)
> + {
> + m_pScheduler->Remove(m_ulCallbackHandle);
> + m_ulCallbackHandle = 0;
> + }
> +
> if (m_pContext != NULL)
> {
> m_pContext->Release();
> @@ -566,21 +572,20 @@
> * developing a caching scheme.
> */
> STDMETHODIMP
> -CHXHTTPFileObject::Advise(UINT32 useage)
> +CHXHTTPFileObject::Advise(UINT32 usage)
> {
> - MLOG_HTTP("CHXHTTPFileObject::Advice(%u)\n", useage);
> + MLOG_HTTP("CHXHTTPFileObject::Advice(%u)\n", usage);
> +
> + HX_RESULT res = HXR_FAILED;
>
> - // Bacase of the simple cache, only
> + // Because of the simple cache, only
> // linear useage is allowed.
> - if(useage != HXR_ADVISE_PREFER_LINEAR)
> + if(HX_FILEADVISE_RANDOMACCESS == usage)
> {
> - return HXR_ADVISE_PREFER_LINEAR;
> - }
> - else
> - {
> - return HXR_OK;
> + res = HXR_ADVISE_PREFER_LINEAR;
> }
>
> + return res;
> } // Advise()
>
>
> @@ -1585,7 +1590,7 @@
> }
>
> // Is there any incomplete read pending?
> - if(m_bIncompleteReadPending)
> + if(m_bIncompleteReadPending && m_pCache && m_pFileResponse)
> {
> // Ask the cache if it can supply the next installment for the
> // incomplete read.
> @@ -1606,7 +1611,7 @@
> // Is there any block which was rejected by the cache earlier because
> it
> // was full? If so, let's try inserting into the cache again. Maybe,
> the
> // cache has since freed some space.
> - if(m_bAddBlockPending)
> + if(m_bAddBlockPending && m_pCache)
> {
> m_bAddBlockPending = FALSE;
> m_pCache->AddBlock(m_pPendingAddBlock);
>
> On Fri, 5 Dec 2003, Aaron Colwell wrote:
>
> > Synopsis: Fix HTTPLite crash. Add progressive download checks for MP4 files
> >
> > Overview: - Added code in CHXHTTPFileObject::_Cleanup() to cancel the
> > pending callback.
> >
> > - Added some pointer checks in CHXHTTPFileObject::Func()
> > to avoid dereferencing null pointers.
> >
> > - Added code to determine if the file object prefers linear
> > access.
> >
> > - Added a code to check for files optimized for progressive
> > download when m_bPreferLinearAccess is set. Progressive
> > download files have the moov atom at the beginning of the file
> > and the mdat atom (media data) at the end. The code will
> > report an error if you try to play a file not optimized
> > for progressive download and m_bPreferLinearAccess is set.
> >
> > Files Modified:
> > filesystem/httplite/httpfileobj.cpp
> > datatype/mp4/fileformat/atomizer.cpp
> > datatype/mp4/fileformat/pub/atomizer.h
> >
> > Files Added: none
> >
> > Image Size and Heap Use impact: tiny
> >
> > Platforms and Profiles affected: all
> >
> > Distribution Libraries affected: none
> >
> > Distribution library impact and planned action: none
> >
> > Platforms and Profiles Build Verified: symbian-61-emulator
> >
> > Platforms and Profiles Functionality verified: symbian-61-emulator
> >
> > Branch: HEAD
> >
> > QA Instructions: none
> >
> > Index: filesystem/httplite/httpfileobj.cpp
> > ===================================================================
> > RCS file: /cvs/filesystem/httplite/httpfileobj.cpp,v
> > retrieving revision 1.5
> > diff -u -r1.5 httpfileobj.cpp
> > --- filesystem/httplite/httpfileobj.cpp 14 Oct 2003 02:55:59 -0000
> > 1.5
> > +++ filesystem/httplite/httpfileobj.cpp 5 Dec 2003 20:37:29 -0000
> > @@ -190,6 +190,12 @@
> > m_pPendingAddBlock = NULL;
> > }
> >
> > + if (m_ulCallbackHandle)
> > + {
> > + m_pScheduler->Remove(m_ulCallbackHandle);
> > + m_ulCallbackHandle = 0;
> > + }
> > +
> > if (m_pContext != NULL)
> > {
> > m_pContext->Release();
> > @@ -1585,7 +1591,7 @@
> > }
> >
> > // Is there any incomplete read pending?
> > - if(m_bIncompleteReadPending)
> > + if(m_bIncompleteReadPending && m_pCache && m_pFileResponse)
> > {
> > // Ask the cache if it can supply the next installment for the
> > // incomplete read.
> > @@ -1606,7 +1612,7 @@
> > // Is there any block which was rejected by the cache earlier because
> > it
> > // was full? If so, let's try inserting into the cache again. Maybe,
> > the
> > // cache has since freed some space.
> > - if(m_bAddBlockPending)
> > + if(m_bAddBlockPending && m_pCache)
> > {
> > m_bAddBlockPending = FALSE;
> > m_pCache->AddBlock(m_pPendingAddBlock);
> > Index: datatype/mp4/fileformat/atomizer.cpp
> > ===================================================================
> > RCS file: /cvs/datatype/mp4/fileformat/atomizer.cpp,v
> > retrieving revision 1.6
> > diff -u -r1.6 atomizer.cpp
> > --- datatype/mp4/fileformat/atomizer.cpp 1 Aug 2003 22:43:26 -0000
> > 1.6
> > +++ datatype/mp4/fileformat/atomizer.cpp 5 Dec 2003 20:37:29 -0000
> > @@ -101,6 +101,7 @@
> > , m_ulTotalSize(0)
> > , m_State(ATMZR_Offline)
> > , m_bSyncAccessEnabled(FALSE)
> > + , m_bPreferLinearAccess(FALSE)
> > , m_pRecursionCallback(NULL)
> > , m_ulRecursionCount(0)
> > , m_lRefCount(0)
> > @@ -158,6 +159,14 @@
> > m_bSyncAccessEnabled = TRUE;
> > m_pFileSwitcher->Advise(HX_FILEADVISE_ASYNCACCESS);
> > }
> > +
> > + HX_RESULT adviseRes =
> > + m_pFileSwitcher->Advise(HX_FILEADVISE_RANDOMACCESS);
> > +
> > + if (HXR_ADVISE_PREFER_LINEAR == adviseRes)
> > + {
> > + m_bPreferLinearAccess = TRUE;
> > + }
> > }
> >
> > // Find Output Interface
> > @@ -833,7 +842,31 @@
> > ulAtomSize -
> > ulDataLen;
> > m_State = ATMZR_ProcHeader;
> > - SeekDataCB(m_ulNewAtomOffset);
> > +
> > + /* Check to see if we are trying to skip
> > + * an mdat atom while using a file object
> > + * that prefers linear access (ie. HTTP/1.0)
> > + */
> > + if (m_bPreferLinearAccess && (QT_mdat ==
> > AtomType))
> > + {
> > + HX_RESULT completionRes =
> > HXR_INVALID_FILE;
> > +
> > + if ((m_pCurrentRoot) &&
> > +
> > (m_pCurrentRoot->FindPresentChild(QT_moov)))
> > + {
> > + /* We have the moov atom already so
> > + * this file is likely formatted for
> > + * progressive download
> > + */
> > + completionRes = HXR_OK;
> > + }
> > +
> > + CompleteAtomization(completionRes);
> > + }
> > + else
> > + {
> > + SeekDataCB(m_ulNewAtomOffset);
> > + }
> > return retVal;
> > }
> > else
> > Index: datatype/mp4/fileformat/pub/atomizer.h
> > ===================================================================
> > RCS file: /cvs/datatype/mp4/fileformat/pub/atomizer.h,v
> > retrieving revision 1.3
> > diff -u -r1.3 atomizer.h
> > --- datatype/mp4/fileformat/pub/atomizer.h 14 Jul 2003 18:40:13 -0000
> > 1.3
> > +++ datatype/mp4/fileformat/pub/atomizer.h 5 Dec 2003 20:37:29 -0000
> > @@ -274,6 +274,7 @@
> > IHXScheduler *m_pScheduler;
> >
> > BOOL m_bSyncAccessEnabled;
> > + BOOL m_bPreferLinearAccess;
> >
> > CQTAtom *m_pRoot;
> > CQTAtom *m_pCurrentRoot;
> >
> >
> >
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe at datatype.helixcommunity.org
For additional commands, e-mail: dev-help at datatype.helixcommunity.org