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

List:       helix-filesystem-cvs
Subject:    [Filesystem-cvs] local/full progdown.cpp, 1.7, 1.8 smplfsys.cpp,
From:       ehodge () helixcommunity ! org
Date:       2004-11-16 7:18:09
[Download RAW message or body]

Update of /cvsroot/filesystem/local/full
In directory cvs-new:/tmp/cvs-serv4337/full

Modified Files:
	progdown.cpp smplfsys.cpp smplfsys.h 
Log Message:
Progressive Download enhancements:

(1) IHXPDStatusObserver::SrcClaimsSeekSupport() now passes the
    IHXStreamSource along so the receiver can distinguish between
    multiple calls from multiple sources

(2) IHXPDStatusObserver::OnDownloadProgress() now includes an
    additional argument, an INT32, that provides the following:
   - When negative, the absolute value of it is the estimated
     # of milliseconds of wall-clock time that need to pass while
     downloading continues before reaching the point at which
     playback can resume and play the remainder of the stream
     without having to buffer, assuming that playback is stopped
     and remains so during that period.
   - When positive, it is the estimated number of milliseconds of
     wall-clock time between when the download should complete
     and when the natural content play-out duration will be
     reached, assuming playback is currently progressing and that
     no pause will occur.
   HXPlayer implements the above calculations and passes them on
   to its observers, which is usually the TLC (like splay).

(3) For simple file format types, like MP3 and AAC, the FF does
    not do the reporting of download stats but rather passes QI's
    for IHXPDStatusMgr through to the file system which then does
    the reporting.  More-complex FF's that may have multiple
    file objects or for other reasons do implement IHXPDStatusMgr
    and do the reporting themselves when they feel that new
    information from the fsys about the bytes downloaded should
    be passed to their registered observers.

(4) Those more-complex FF's implement IHXPDStatusObserver and
    register with the filesys in order to pass along
    SrcClaimsSeekSupport().

(5) IHXMediaBytesToMediaDur::SrcClaimsSeekSupport has been
    removed from the interface

Also changed are:
  + Only call OnDownloadComplete() if OnDownloadProgress() has
    ever been called
  + Don't call OnDownloadProgress() if it's not a progressive-
    download file (smplfsys only)
  + With local fsys, wait to see if file is growing and/or if
    filesize is known and if (filesize > stat size), then call
    OnDownloadProgress() right away after that to signify this
    is a progr.-downloading file.  Call OnDownloadPaused() if
    filesize parameter > local file size even if file is not
    growing.


Index: smplfsys.h
===================================================================
RCS file: /cvsroot/filesystem/local/full/smplfsys.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- smplfsys.h	5 Oct 2004 17:15:06 -0000	1.6
+++ smplfsys.h	16 Nov 2004 07:18:06 -0000	1.7
@@ -95,8 +95,6 @@
 #endif /* #if defined(HELIX_FEATURE_PROGDOWN) */
 #if defined(HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS)
 class CHXSimpleList;
-
-#define PRDN_STATUSREPORT_INTERVAL    5000 /* in milliseconds. */
 #endif // /HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS.
 
 
@@ -329,11 +327,18 @@
 #if defined(HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS)
     UINT32                   m_ulPrgDnTotalFileSize;
     UINT32                   m_ulPrgDnTotalFileDur;
+    UINT32                   m_ulPriorReportedTotalFileDur;
     UINT32                   m_ulCurrentDurOfBytesSoFar;
     UINT32                   m_ulTimeOfLastBytesToDur;
     IHXMediaBytesToMediaDur* m_pBytesToDur;
+    UINT32                   m_ulStatusUpdateGranularityInMsec;
     CHXSimpleList*           m_pPDSObserverList;
+    BOOL                     m_bDownloadProgressReported;
+    BOOL                     m_bDownloadCompleteReported;
+    BOOL                     m_bDidNotifyOfDownloadPause;
     HX_RESULT                EstablishPDSObserverList();
+    void MaybeDoProgressiveDownloadStatusRept(UINT32 ulPrevFileSize,
+                                              UINT32 ulCurFileSize);
     void                     ReportCurrentDurChanged();
     void                     ReportTotalDurChanged();
     void                     ReportDownloadComplete();
@@ -597,6 +602,16 @@
      */
     STDMETHOD(RemoveObserver) (THIS_
                               IHXPDStatusObserver* /*IN*/ pObserver);
+
+    /************************************************************************
+     *  Method:
+     *      IHXPDStatusMgr::SetStatusUpdateGranularityMsec
+     *  Purpose:
+     *      Lets an observer set the interval that the reporter (fsys) takes
+     *      between status updates:
+     */
+    STDMETHOD(SetStatusUpdateGranularityMsec) (THIS_
+                             UINT32 /*IN*/ ulStatusUpdateGranularityInMsec);
 
 #endif // /HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS.
 

Index: smplfsys.cpp
===================================================================
RCS file: /cvsroot/filesystem/local/full/smplfsys.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- smplfsys.cpp	5 Oct 2004 17:15:06 -0000	1.14
+++ smplfsys.cpp	16 Nov 2004 07:18:06 -0000	1.15
@@ -649,10 +649,15 @@
 #if defined(HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS)
     , m_ulPrgDnTotalFileSize(HX_PROGDOWNLD_UNKNOWN_FILE_SIZE)
     , m_ulPrgDnTotalFileDur(HX_PROGDOWNLD_UNKNOWN_DURATION)
+    , m_ulPriorReportedTotalFileDur(HX_PROGDOWNLD_UNKNOWN_DURATION)
     , m_ulCurrentDurOfBytesSoFar(HX_PROGDOWNLD_UNKNOWN_DURATION)
     , m_ulTimeOfLastBytesToDur(0)
     , m_pBytesToDur(NULL)
+    , m_ulStatusUpdateGranularityInMsec(PRDN_DEFAULT_STATUSREPORT_INTERVAL_MSEC)
     , m_pPDSObserverList(NULL)
+    , m_bDownloadProgressReported(FALSE)
+    , m_bDownloadCompleteReported(FALSE)
+    , m_bDidNotifyOfDownloadPause(FALSE)
 #endif // /HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS.
 {
     MLOG_LEAK("CON CSimpleFileObject this=0x%08x\n", this);
@@ -1077,7 +1082,12 @@
 #if defined(HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS)
     m_ulPrgDnTotalFileSize = HX_PROGDOWNLD_UNKNOWN_FILE_SIZE;
     m_ulPrgDnTotalFileDur = HX_PROGDOWNLD_UNKNOWN_DURATION;
+    m_ulPriorReportedTotalFileDur = HX_PROGDOWNLD_UNKNOWN_DURATION;
     m_ulCurrentDurOfBytesSoFar = HX_PROGDOWNLD_UNKNOWN_DURATION;
+    m_ulTimeOfLastBytesToDur = 0;
+    m_bDownloadProgressReported = FALSE;
+    m_bDownloadCompleteReported = FALSE;
+    m_bDidNotifyOfDownloadPause = FALSE;
     HX_RELEASE(m_pBytesToDur);
     if (m_pPDSObserverList)
     {
@@ -1279,49 +1289,10 @@
     {
 #if defined(HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS)
         UINT32 ulPrevFileSize = m_pProgDownMon->GetLastFileSize();
-        m_pProgDownMon->MonitorFileSize(); // updates lasteFileSize.
+        m_pProgDownMon->MonitorFileSize(); // updates lastFileSize.
         UINT32 ulCurFileSize = m_pProgDownMon->GetLastFileSize();
 
-#if 1 // /XXXEH-TODO: MOVE TO EVERY-5-SECOND CALLBACK:
-        UINT32 ulCurTime = HX_GET_BETTERTICKCOUNT();
-        if (m_pBytesToDur  &&
-                ulCurTime - m_ulTimeOfLastBytesToDur > PRDN_STATUSREPORT_INTERVAL)
-        {
-            m_ulTimeOfLastBytesToDur = ulCurTime;
-            if (SUCCEEDED(m_pBytesToDur->GetFileDuration(
-                    // /OK if this is still HX_PROGDOWNLD_UNKNOWN_FILE_SIZE:
-                    m_ulPrgDnTotalFileSize,
-                    m_ulPrgDnTotalFileDur)))
-            {
-                ReportTotalDurChanged();
-            }
-
-            if (ulPrevFileSize < ulCurFileSize)
-            {
-                // /Report new size's associated duration to observers:
-                HX_ASSERT(m_pBytesToDur); // /Should be obtained in init.
-                if (m_pBytesToDur)
-                {
-                    // /Get The FF to convert the bytes to associated dur:
-                    if (SUCCEEDED(m_pBytesToDur->ConvertFileOffsetToDur(
-                            ulCurFileSize,
-                            // /It's OK if the following is ...UNKNOWN...:
-                            m_ulPrgDnTotalFileSize,
-                            /*REF*/ m_ulCurrentDurOfBytesSoFar)))
-                    {
-                        ReportCurrentDurChanged();
-                    }
-                }
-            
-            }
-            // /Now, report if we're finished downloading:
-            if (IsPrgDnCompleteFileSizeKnown()  &&
-                    ulCurFileSize >= m_ulPrgDnTotalFileSize)
-            {
-                ReportDownloadComplete(); // /XXXEH-TODO only do this once.
-            }
-        }
-#endif // /XXXEH-TODO: MOVE TO...
+        MaybeDoProgressiveDownloadStatusRept(ulPrevFileSize, ulCurFileSize);
 #endif // /HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS.
 
 
@@ -1358,6 +1329,29 @@
                     MLOG_PD(NULL, "\t\t\t\tFile currently IS progressive\n");
                     // The file is still currently downloading.
                     //
+
+#if defined(HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS)
+                    // /If we only know it's progressive because we have the
+                    // file size, let's watch for a while to see if the
+                    // external download manager is paused:
+                    // /We know the filesize so if it's greater than bytes so
+                    // far, then we know we're paused if retry count == 0
+                    if (!m_bDidNotifyOfDownloadPause  &&
+                            !m_pProgDownMon->IsProgressive()  &&
+                            IsPrgDnCompleteFileSizeKnown()  &&
+                            m_ulPrgDnTotalFileSize > ulCurFileSize)
+                    {
+                        // Decrement the retry count. If the file becomes
+                        // progressive again, then this count gets reset.
+                        m_pProgDownMon->DecrementFormerProgressiveRetryCount();
+                        if (m_pProgDownMon->GetFormerProgressiveRetryCount() == 0)
+                        {
+                            // /Send a pause notification:
+                            ReportChange(PRDNFLAG_REPORT_NOTIFY_DOWNLOAD_PAUSE);
+                        }
+                    }
+#endif // /HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS.
+
                     // Can we callback asynchronously?
                     if (m_bAsyncAccess)
                     {
@@ -1421,6 +1415,25 @@
                         // Decrement the retry count. If the file becomes
                         // progressive again, then this count gets reset.
                         m_pProgDownMon->DecrementFormerProgressiveRetryCount();
+
+#if defined(HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS)
+                        // /If we drop to 0 count, we have to assume the file
+                        // has completely downloaded and notify the observer
+                        // chain:
+                        if (!m_pProgDownMon->GetFormerProgressiveRetryCount())
+                        {
+                            if (SUCCEEDED(m_pBytesToDur->ConvertFileOffsetToDur(
+                                    ulCurFileSize,
+                                    // /It's OK if the following is ...UNKNOWN...:
+                                    m_ulPrgDnTotalFileSize,
+                                    /*REF*/ m_ulCurrentDurOfBytesSoFar)))
+                            {
+                                ReportCurrentDurChanged();
+                            }
+                            ReportDownloadComplete();
+                        }
+#endif // /HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS.
+
                         // Can we callback asynchronously?
                         if (m_bAsyncAccess)
                         {
@@ -1546,6 +1559,19 @@
             m_pProgDownMon->ResetNotProgressiveRetryCount();
             // Clear the progressive download failure flag
             rbProgFail = FALSE;
+
+#if defined(HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS)
+            // /Send resume notification if we sent a pause notification:
+            if (m_bDidNotifyOfDownloadPause)
+            {
+                ReportChange(PRDNFLAG_REPORT_NOTIFY_DOWNLOAD_RESUME);
+
+                // /Have to put this here in case TLC has paused the player
+                // which somehow seems to be killing our callbacks:
+                m_pProgDownMon->BeginSizeMonitoring();
+            }
+#endif // /HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS.
+            
             // Finish the DoRead
             return FinishDoRead(actual, pBuffer);
         }
@@ -1997,20 +2023,41 @@
 
     m_ulSize = StatBuffer.st_size;
 
+    // /If we're progressively downloading and there was no ?filesize URL
+    // parameter to tell us the size and we don't think we're done getting
+    // all the bytes yet, then return FAIL since we don't have the answer:
+    UINT32 ulTrueSize = m_ulSize;
+    HX_RESULT hxrsltForStatDone = HXR_OK;
+
+#if defined(HELIX_FEATURE_PROGDOWN)
+    if (m_pProgDownMon  &&  m_pProgDownMon->IsProgressive())
+    { 
 #if defined(HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS)
-    // /If this asserts, then the URL?filesize=n is probably wrong:
-    HX_ASSERT(m_ulPrgDnTotalFileSize >= m_ulSize);
-    // /If we have been told the content length in the URL via ?filesize=n,
-    // use that if it's not less than m_nContentSize:
-    if (m_ulPrgDnTotalFileSize != HX_PROGDOWNLD_UNKNOWN_FILE_SIZE  &&
-            m_ulPrgDnTotalFileSize > m_ulSize)
-    {
-        m_ulSize = m_ulPrgDnTotalFileSize;
-    }
-#endif // /HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS.
+        // /See if we know the complete file size from URL options:
+        if (IsPrgDnCompleteFileSizeKnown())
+        {
+            // /If this asserts, then the URL?filesize=n is probably wrong:
+            HX_ASSERT(m_ulPrgDnTotalFileSize >= m_ulSize);
+            m_ulSize = m_ulPrgDnTotalFileSize;
+            ulTrueSize = m_ulPrgDnTotalFileSize;
+        }
+        else
+        {
+            // /Since we don't know the file size, return HXR_FAIL:
+            hxrsltForStatDone = HXR_FAIL;
+            ulTrueSize = 0;
+        }
+#else  // /else of HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS
+        // /Since we don't know the file size, return HXR_FAIL:
+        hxrsltForStatDone = HXR_FAIL;
+        ulTrueSize = 0;
+#endif // /end else of HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS.
+    } 
+#endif // /HELIX_FEATURE_PROGDOWN.
 
-    pFileStatResponse->StatDone(HXR_OK,
-				StatBuffer.st_size,
+
+    pFileStatResponse->StatDone(hxrsltForStatDone,
+				ulTrueSize,
 				StatBuffer.st_ctime,
 				StatBuffer.st_atime,
 				StatBuffer.st_mtime,
@@ -3064,6 +3111,14 @@
 
 STDMETHODIMP CSimpleFileObject::ProgressiveCallback()
 {
+#if defined(HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS)
+    UINT32 ulPrevFileSize = m_pProgDownMon->GetLastFileSize();
+    m_pProgDownMon->MonitorFileSize(); // updates lastFileSize.
+    UINT32 ulCurFileSize = m_pProgDownMon->GetLastFileSize();
+    MaybeDoProgressiveDownloadStatusRept(ulPrevFileSize, ulCurFileSize);
+#endif // /HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS.
+
+
     if (m_ulCallbackState == CallbackStateSeek)
     {
         MLOG_PD(NULL, "CSimpleFileObject::ProgressiveCallback() this=0x%08x tick=%lu state=%s\n",
@@ -3155,6 +3210,74 @@
 
 
 #if defined(HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS)
+
+void
+CSimpleFileObject::MaybeDoProgressiveDownloadStatusRept(UINT32 ulPrevFileSize,
+                                                        UINT32 ulCurFileSize)
+{
+    UINT32 ulCurTime = HX_GET_BETTERTICKCOUNT();
+    BOOL bDurationReached = FALSE;
+    if (m_pBytesToDur  &&  (m_ulTimeOfLastBytesToDur==0  ||
+            ulCurTime - m_ulTimeOfLastBytesToDur > m_ulStatusUpdateGranularityInMsec))
+    {
+        if (SUCCEEDED(m_pBytesToDur->GetFileDuration(
+                // /OK if this is still HX_PROGDOWNLD_UNKNOWN_FILE_SIZE:
+                m_ulPrgDnTotalFileSize,
+                m_ulPrgDnTotalFileDur)))
+        {
+            if (m_ulPriorReportedTotalFileDur != m_ulPrgDnTotalFileDur)
+            {
+                ReportTotalDurChanged();
+            }
+        }
+
+        m_ulTimeOfLastBytesToDur = ulCurTime;
+        // /Report new size's associated duration to observers:
+        // /Get The FF to convert the bytes to associated dur:
+        if (SUCCEEDED(m_pBytesToDur->ConvertFileOffsetToDur(
+                ulCurFileSize,
+                // /It's OK if the following is ...UNKNOWN...:
+                m_ulPrgDnTotalFileSize,
+                /*REF*/ m_ulCurrentDurOfBytesSoFar)))
+        {
+            if (ulPrevFileSize < ulCurFileSize)
+            {
+                ReportCurrentDurChanged();
+            }
+            if (HX_PROGDOWNLD_UNKNOWN_DURATION !=
+                    m_ulCurrentDurOfBytesSoFar  &&
+                    HX_PROGDOWNLD_UNKNOWN_DURATION !=
+                    m_ulPrgDnTotalFileDur &&
+                    m_ulCurrentDurOfBytesSoFar >= m_ulPrgDnTotalFileDur)
+            {
+                // /We've exceeded our duration so claim that we're done:
+                bDurationReached = TRUE;
+            }
+        }
+        else // /Failed to convert bytes to dur; report that:
+        {
+            ReportChange(PRDNFLAG_REPORT_CUR_DUR_UNKNOWN);
+        }
+    }
+    // /Now, report if we're finished downloading:
+    if (!m_bDownloadCompleteReported  &&  m_pBytesToDur  &&
+            (bDurationReached  ||
+            (IsPrgDnCompleteFileSizeKnown()  &&
+            ulCurFileSize >= m_ulPrgDnTotalFileSize)) )
+    {
+       m_pBytesToDur->ConvertFileOffsetToDur(
+                ulCurFileSize,
+                m_ulPrgDnTotalFileSize,
+                /*REF*/ m_ulCurrentDurOfBytesSoFar);
+        ReportDownloadComplete();
+        // /Put an end to p.d.monitor callbacks now that we're at the end:
+        m_pProgDownMon->EndSizeMonitoring();
+    }
+}
+
+/*
+ *  Helper methods that are used by IHXPDStatusMgr methods, below
+ */        
 void
 CSimpleFileObject::ReportCurrentDurChanged()
 {
@@ -3176,44 +3299,84 @@
 void
 CSimpleFileObject::ReportChange(UINT32 ulFlags)
 {
-    HX_ASSERT(!(ulFlags & PRDNFLAG_REPORT_TOTAL_DUR)  ||
-            IsPrgDnCompleteFileDurKnown());
-
-    if (m_pPDSObserverList)
+    // /Don't report anything if it's not progressive or if we don't yet know
+    // if it's progressive:
+    BOOL bIsProgressive = m_pProgDownMon->HasBeenProgressive()  &&
+            m_pProgDownMon->IsProgressive();
+    // /If we know the complete file size from URL options and it
+    // differs from current file size stat'd so far, it's progressive:
+    if (IsPrgDnCompleteFileSizeKnown())
     {
-        LISTPOSITION lPos = m_pPDSObserverList->GetHeadPosition();
-        while (lPos)
+        UINT32 ulCurFileSize = m_pProgDownMon->GetLastFileSize();
+        bIsProgressive = (m_ulPrgDnTotalFileSize > ulCurFileSize);
+    }
+
+    // /Only report if it is (or has been) a progressive-download file:
+    if (bIsProgressive  ||  m_bDownloadProgressReported)
+    {    
+        HX_ASSERT(!(ulFlags & PRDNFLAG_REPORT_TOTAL_DUR)  ||
+                IsPrgDnCompleteFileDurKnown());
+
+        // /Set this whether we have observers or not:
+        if (ulFlags & PRDNFLAG_REPORT_DNLD_COMPLETE)
         {
-            HX_ASSERT(m_pPDSObserverList->GetCount() > 0);
-            IHXPDStatusObserver* pObserver = (IHXPDStatusObserver*)
-                    m_pPDSObserverList->GetNext(lPos);
-            if (pObserver)
+            m_bDownloadCompleteReported = TRUE;
+        }
+
+        if (m_pPDSObserverList)
+        {
+            LISTPOSITION lPos = m_pPDSObserverList->GetHeadPosition();
+            while (lPos)
             {
-                // /Pass what we observed along to our observers:
-                // (It's OK to pass a NULL IHXStreamSource since our observers
-                // are themselves IHXStreamSources) :
-                if (ulFlags & PRDNFLAG_REPORT_CUR_DUR)
-                {
-                    pObserver->OnDownloadProgress(NULL,
-                            m_ulCurrentDurOfBytesSoFar,
-                            m_pProgDownMon->GetLastFileSize());
-                }
-                if (ulFlags & PRDNFLAG_REPORT_TOTAL_DUR)
-                {
-                    pObserver->OnTotalDurChanged(NULL, m_ulPrgDnTotalFileDur);
-                }
-                if (ulFlags & PRDNFLAG_REPORT_DNLD_COMPLETE)
+                HX_ASSERT(m_pPDSObserverList->GetCount() > 0);
+                IHXPDStatusObserver* pObserver = (IHXPDStatusObserver*)
+                        m_pPDSObserverList->GetNext(lPos);
+                if (pObserver)
                 {
-                    pObserver->OnDownloadComplete(NULL);
+                    // /Pass what we observed along to our observers:
+                    // (It's OK to pass a NULL IHXStreamSource since our observers
+                    // are themselves IHXStreamSources) :
+                    if (ulFlags & PRDNFLAG_REPORT_CUR_DUR  ||
+                            ulFlags & PRDNFLAG_REPORT_CUR_DUR_UNKNOWN)
+                    {
+                        m_bDownloadProgressReported = TRUE;
+                        pObserver->OnDownloadProgress(NULL,
+                                m_ulCurrentDurOfBytesSoFar,
+                                m_pProgDownMon->GetLastFileSize(),
+                                // /lTimeSurplus is calculated farther along the
+                                // chain (HXPlayer) and is thus passed as an
+                                // invalid value from here:
+                                HX_PROGDOWNLD_UNKNOWN_TIME_SURPLUS);
+                    }
+                    
+                    if (ulFlags & PRDNFLAG_REPORT_TOTAL_DUR)
+                    {
+                        m_ulPriorReportedTotalFileDur = m_ulPrgDnTotalFileDur;
+                        pObserver->OnTotalDurChanged(NULL, m_ulPrgDnTotalFileDur);
+                    }
+                    if (ulFlags & PRDNFLAG_REPORT_DNLD_COMPLETE)
+                    {
+                        m_bDownloadCompleteReported = TRUE;
+                        pObserver->OnDownloadComplete(NULL);
+                    }
+
+                    if (ulFlags & PRDNFLAG_REPORT_NOTIFY_DOWNLOAD_PAUSE)
+                    {
+                        m_bDidNotifyOfDownloadPause = TRUE;
+                        pObserver->OnDownloadPause(NULL);
+                    }
+                    if (ulFlags & PRDNFLAG_REPORT_NOTIFY_DOWNLOAD_RESUME)
+                    {
+                        m_bDidNotifyOfDownloadPause = FALSE;
+                        pObserver->OnDownloadResume(NULL);
+                    }
                 }
             }
         }
     }
 }
 
-/*
- *  Helper methods that are used by IHXPDStatusMgr methods, below
- */        
+
 HX_RESULT
 CSimpleFileObject::EstablishPDSObserverList()
 {
@@ -3248,22 +3411,22 @@
 {
     HX_RESULT hxrslt = HXR_INVALID_PARAMETER;
     if (pObserver)
-    {
+    { 
         if (!m_pPDSObserverList)
-        {
+        { 
             hxrslt = EstablishPDSObserverList();
-        }
+        } 
         if (SUCCEEDED(hxrslt)  &&  m_pPDSObserverList)
-        {
+        { 
             if (!m_pPDSObserverList->Find(pObserver))
-            {
+            { 
                 pObserver->AddRef();
                 m_pPDSObserverList->AddTail(pObserver);
-            }
-        }
-    }
-
-    return hxrslt;
+            } 
+        } 
+    } 
+  
+    return hxrslt; 
 }
 
 /************************************************************************
@@ -3278,21 +3441,37 @@
 {
     HX_RESULT hxrslt = HXR_INVALID_PARAMETER;
     if (pObserver)
-    {
-        hxrslt = HXR_FAIL;
+    { 
+        hxrslt = HXR_FAIL; 
         if (m_pPDSObserverList)
-        {
+        { 
             LISTPOSITION lPosition = m_pPDSObserverList->Find(pObserver);
             if (lPosition)
-            {
+            { 
                 m_pPDSObserverList->RemoveAt(lPosition);
                 HX_RELEASE(pObserver);
-            }
+            } 
+  
+            hxrslt = HXR_OK; 
+        } 
+    } 
 
-            hxrslt = HXR_OK;
-        }
-    }
-    return hxrslt;
+    return hxrslt; 
+}
+
+/************************************************************************
+ *  Method:
+ *      IHXPDStatusMgr::SetStatusUpdateGranularityMsec
+ *  Purpose:
+ *      Lets an observer set the interval that the reporter (fsys) takes
+ *      between status updates.  Value is in milliseconds.
+ */
+STDMETHODIMP
+CSimpleFileObject::SetStatusUpdateGranularityMsec(
+        UINT32 /*IN*/ ulStatusUpdateGranularityInMsec)
+{
+    m_ulStatusUpdateGranularityInMsec = ulStatusUpdateGranularityInMsec;
+    return HXR_OK;
 }
 
 

Index: progdown.cpp
===================================================================
RCS file: /cvsroot/filesystem/local/full/progdown.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- progdown.cpp	13 Oct 2004 20:32:40 -0000	1.7
+++ progdown.cpp	16 Nov 2004 07:18:06 -0000	1.8
@@ -362,7 +362,7 @@
         // long has it been the same?
         UINT32 ulDiff = CALCULATE_ELAPSED_TICKS(m_ulTickAtLastFileSize, ulTick);
         // If the file size has been the
-        // same for at last m_ulFinishedTime
+        // same for at least m_ulFinishedTime
         // milliseconds, then we assume it has
         // finished downloading
         if (ulDiff > m_ulFinishedTime && m_bIsProgressive)



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

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