[Helix-client-dev] CR: EHYN-7W7GQM: WMDRM: Music player can not exit when play a WMDRM protected song which's license is expired

<[email protected]> Fri, 30 Oct 2009 05:43:50 +0100
Newsgroups gmane.comp.multimedia.helix.devel
Message-ID <20D73E2631F7914F868646E119DEC1CE20FCC1A12F@NOK-EUMSG-02.mgdnok.nokia.com>
"Nokia submits this code under the terms of a commercial contribution agreement with RealNetworks, and I am authorized to contribute this code under said agreement."
 
Modified by:  [email protected]
 
Reviewed by:  [email protected]
 
TSW Id: EHYN-7W7GQM 
 
Date: 10/29/2009
	 
Project: SymbianMmf_wm
 
Synopsis: WMDRM: Music player can not exit when play a WMDRM protected song which's license is expired
 
Overview:
After AddDatasourceL( ) we have a timer implemented which waits for a certain interval before calling IntializeRenderers( ). But the problem here is the GetTickCount() uses gettimeofday() to get the tick count on Symbian platform, which is a future date (after changing the system date/time) and hence we never reach time out.
We are using a nano kernel tick counter (i.e. User::NTickCount() and HAL::Get(HAL::ENanoTickPeriod, tickPeriod)) on branches other than 221Cays (indirectly  was handled as a part of a separate CR: ECZU-7AJDAB). Therefore we didn't face this problem in the platforms other than S60 3.2 and S60 3.2.3

Fix:
Using the nano kernel tick count here too under a flag HELIX_CONFIG_USE_NTICKCOUNT. In addition also checking for a condition if hardware returns a time resolution other than 1000 (may be in future) then converting tickPeriod to equivalent ms.

Files modified & changes:
/client/common/system/hxsched.cpp
/common/system/platform/symbian/gettickcount.c

Image Size and Heap Use impact: No major impact
 
Module Release testing (STIF) : Passed
 
Test case(s) Added  : No

Memory leak check performed : Passed, No additional leaks introduced.
 
Platforms and Profiles Build Verified: helix-client-s60-50-mmf-mdf-dsp
 
Platforms and Profiles Functionality verified: armv5
 
Branch: 221Cays

CVS Diff on 221Cays: Attached

_______________________________________________
Helix-client-dev mailing list
[email protected]
http://lists.helixcommunity.org/mailman/listinfo/helix-client-dev
hxsched.cpp.diff (application/octet-stream, 1.1 KB)
Index: hxsched.cpp
===================================================================
RCS file: /cvsroot/client/common/system/hxsched.cpp,v
retrieving revision 1.13.10.1
diff -u -w -r1.13.10.1 hxsched.cpp
--- hxsched.cpp 4 Aug 2009 14:58:53 -0000       1.13.10.1
+++ hxsched.cpp 29 Oct 2009 05:09:36 -0000
@@ -654,7 +654,7 @@
 {
     HXBOOL    bResult = TRUE;

-#if defined(_WINDOWS) || defined(_WIN32) || defined (_MACINTOSH) || defined(THR
EADS_SUPPORTED)
+#if defined(_WINDOWS) || defined(_WIN32) || defined (_MACINTOSH) || 
+defined(THR
EADS_SUPPORTED) || defined(_SYMBIAN)

     UINT32 ulCurrentTime = HX_GET_TICKCOUNT();
     UINT32 ulElapsedTime = CALCULATE_ELAPSED_TICKS(m_ulLastUpdateTime, ulCurren tTime); @@ -723,7 +723,7 @@

 void HXScheduler::GetTime(Timeval* pCurrentTimeVal)  { -#if defined(_WINDOWS) || defined(_WIN32) || defined (_MACINTOSH) || defined(THR
EADS_SUPPORTED)
+#if defined(_WINDOWS) || defined(_WIN32) || defined (_MACINTOSH) || 
+defined(THR
EADS_SUPPORTED) || defined(_SYMBIAN)

     UINT32 ulCurrentTime = HX_GET_TICKCOUNT();
     UINT32 ulElapsedTime = CALCULATE_ELAPSED_TICKS(m_ulLastUpdateTime, ulCurren tTime);
gettickcount.c.diff (application/octet-stream, 1.5 KB)
Index: gettickcount.c
===================================================================
RCS file: /cvsroot/common/system/platform/symbian/gettickcount.c,v
retrieving revision 1.7
diff -u -w -r1.7 gettickcount.c
--- gettickcount.c      15 Jul 2004 21:43:41 -0000      1.7
+++ gettickcount.c      29 Oct 2009 05:18:45 -0000
@@ -49,15 +49,34 @@

 #include <sys/time.h>
 #include <unistd.h>
+#ifdef HELIX_CONFIG_USE_NTICKCOUNT
+#include <hal.h>
+#endif
 #include "hxtypes.h"
 #include "hxtick.h"
 #include "globals/hxglobals.h"

 ULONG32 GetTickCount()
 {
+#ifdef HELIX_CONFIG_USE_NTICKCOUNT
+    TInt nanokernel_tick_period;
+    TUint32 tickcount = User::NTickCount();
+    //call HAL::Get gets the number of USecs in one tick, it's hardware 
+related

+    HAL::Get(HAL::ENanoTickPeriod, nanokernel_tick_period);
+    //Currently only the period=1000(which is true on most of the hardwares)is
+    //taken. For other cases the NTickCount can overflow faster/slower than
+    //2^32 ms. So we need to multiply the resolution to the tickcount.
+    if (nanokernel_tick_period!=1000)
+    {
+       tickcount = (UINT32)(((UINT64)tickcount * 
+ nanokernel_tick_period)/1000);

+    }
+    //This is the current value of the machine's millisecond tick counter.
+    return tickcount;
+#else
     struct timeval tv;
     gettimeofday( &tv, NULL );
     return (ULONG32)((tv.tv_sec) * 1000 + tv.tv_usec / 1000);
+#endif
 }

 // return microseconds