void CRTSecMgrSession::DispatchMessageL(const RMessage2& aMessage) { // First check for session-relative requests switch (aMessage.Function ()) { case ESetPolicy: SetPolicy (aMessage); return; case EUpdatePolicy: UpdatePolicy (aMessage); return; case EUnsetPolicy: UnsetPolicy (aMessage); return; case ERegisterScript: RegisterScript (aMessage); return; case ERegisterScriptWithHash: RegisterScript (aMessage, ETrue); return; case EUnRegisterScript: UnregisterScript (aMessage); return; case EGetScriptSession: GetScriptSessionL (aMessage); return; case EGetTrustedUnRegScriptSession: GetTrustedUnRegScriptSessionL (aMessage); return; case ESecServCloseSession: CloseSession (); return; } // All other function codes must be subsession relative. // We need to find the appropriate server side subsession // i.e. the CRTSecMgrSubSession object. // The handle value is passed as the 4th aregument. CRTSecMgrSubSession* subSession = SubSessionFromHandle (aMessage, aMessage.Int3 ()); switch (aMessage.Function ()) { case ECloseScriptSession: DeleteSubSession (aMessage.Int3 ()); return; case EUpdatePermanentGrant: subSession->UpdatePermGrantL (aMessage); return; case EGetScriptFile: subSession->GetScriptFile (aMessage); return; case EUpdatePermanentGrantProvider: subSession->UpdatePermGrantProviderL (aMessage); return; default: PanicClient (aMessage, EBadRequest); return; } }
TPolicyID RSecMgrSession::SetPolicy(const TDesC8& aPolicyBuffer) { TInt ret(ErrInvalidParameters); if(0==aPolicyBuffer.CompareC(KNullDesC8)) { return ret; } TFileName tempDirPath; TFileName tempPath; { RFs fileSession; if ( KErrNone==fileSession.Connect ()) { fileSession.PrivatePath (tempDirPath); BaflUtils::EnsurePathExistsL (fileSession, tempDirPath); RFile secPolicyFile; secPolicyFile.Temp (fileSession, tempDirPath, tempPath, EFileWrite); secPolicyFile.Write(aPolicyBuffer); secPolicyFile.Close(); } fileSession.Close(); } RFs fileSession; if ( KErrNone==fileSession.Connect ()) { CleanupClosePushL (fileSession); if ( KErrNone==fileSession.ShareProtected ()) { RFile secPolicyFile; if(KErrNone == secPolicyFile.Open(fileSession,tempPath,EFileRead)) { ret = SetPolicy (secPolicyFile); secPolicyFile.Close(); } fileSession.Delete (tempPath); } CleanupStack::PopAndDestroy (&fileSession);//fileSession } fileSession.Close(); return ret; }
int main(int argc, char **argv) { if(SetAffinity() != 0) error("set cpu affinity error\n"); if(argc > 1) if(SetPolicy() != 0) error("set policy error\n"); printf("Sched policy = %d\n" , sched_getscheduler(0)); pthread_t pthreads[threadnum]; for(int thr_id = 0 ; thr_id < threadnum ; thr_id++) { if(pthread_create(&pthreads[thr_id], NULL, RunSleep, (void *)thr_id) != 0) error("create thread error\n"); else printf("Thread %d was created.\n", thr_id); } for(int i = 0 ; i < threadnum ; i++) pthread_join(pthreads[i], NULL); }
Player_Generic_c::Player_Generic_c( void ) { unsigned int i; // InitializationStatus = BufferError; // OS_InitializeMutex( &Lock ); ShutdownPlayer = false; BufferManager = NULL; PlayerControlStructurePool = NULL; InputBufferPool = NULL; DemultiplexorCount = 0; ListOfPlaybacks = NULL; AudioCodedFrameCount = PLAYER_AUDIO_DEFAULT_CODED_FRAME_COUNT; AudioCodedMemorySize = PLAYER_AUDIO_DEFAULT_CODED_MEMORY_SIZE; AudioCodedFrameMaximumSize = PLAYER_AUDIO_DEFAULT_CODED_FRAME_MAXIMUM_SIZE; VideoCodedFrameCount = PLAYER_VIDEO_DEFAULT_CODED_FRAME_COUNT; VideoCodedMemorySize = PLAYER_VIDEO_DEFAULT_CODED_MEMORY_SIZE; VideoCodedFrameMaximumSize = PLAYER_VIDEO_DEFAULT_CODED_FRAME_MAXIMUM_SIZE; OtherCodedFrameCount = PLAYER_OTHER_DEFAULT_CODED_FRAME_COUNT; OtherCodedMemorySize = PLAYER_OTHER_DEFAULT_CODED_MEMORY_SIZE; OtherCodedFrameMaximumSize = PLAYER_OTHER_DEFAULT_CODED_FRAME_MAXIMUM_SIZE; strcpy( AudioCodedMemoryPartitionName, PLAYER_AUDIO_DEFAULT_CODED_FRAME_PARTITION_NAME ); strcpy( VideoCodedMemoryPartitionName, PLAYER_VIDEO_DEFAULT_CODED_FRAME_PARTITION_NAME ); strcpy( OtherCodedMemoryPartitionName, PLAYER_OTHER_DEFAULT_CODED_FRAME_PARTITION_NAME ); memset( &PolicyRecord, 0x00, sizeof(PlayerPolicyState_t) ); EventListHead = INVALID_INDEX; EventListTail = INVALID_INDEX; for( i=0; i<PLAYER_MAX_OUTSTANDING_EVENTS; i++ ) EventList[i].Record.Code = EventIllegalIdentifier; for( i=0; i<PLAYER_MAX_EVENT_SIGNALS; i++ ) ExternalEventSignals[i].Signal = NULL; OS_InitializeEvent( &InternalEventSignal ); // SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, (PlayerPolicy_t)PolicyPlayoutAlwaysPlayout, PolicyValuePlayout ); SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, (PlayerPolicy_t)PolicyPlayoutAlwaysDiscard, PolicyValueDiscard ); SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyMasterClock, PolicyValueVideoClockMaster ); SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyManifestFirstFrameEarly, PolicyValueApply ); SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyExternalTimeMapping, PolicyValueDisapply ); SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyExternalTimeMappingVsyncLocked, PolicyValueDisapply ); SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyAVDSynchronization, PolicyValueApply ); SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyClampPlaybackIntervalOnPlaybackDirectionChange, PolicyValueApply ); SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyTrickModeDomain, PolicyValueTrickModeAuto ); SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, (PlayerPolicy_t)PolicyStatisticsOnAudio, PolicyValueDisapply ); SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, (PlayerPolicy_t)PolicyStatisticsOnVideo, PolicyValueDisapply ); SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyDiscardLateFrames, PolicyValueDiscardLateFramesAfterSynchronize ); SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyVideoStartImmediate, PolicyValueApply ); SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicySyncStartImmediate, PolicyValueDisapply ); SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyRebaseOnFailureToDeliverDataInTime, PolicyValueApply ); SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyRebaseOnFailureToDecodeInTime, PolicyValueApply ); SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyH264AllowNonIDRResynchronization, PolicyValueApply ); SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyH264AllowBadPreProcessedFrames, PolicyValueApply ); SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyH264TreatDuplicateDpbValuesAsNonReferenceFrameFirst, PolicyValueApply ); SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyH264ForcePicOrderCntIgnoreDpbDisplayFrameOrdering, PolicyValueDisapply ); SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyH264TreatTopBottomPictureStructAsInterlaced, PolicyValueApply ); SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyMPEG2ApplicationType, PolicyValueMPEG2ApplicationDvb ); SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyMPEG2DoNotHonourProgressiveFrameFlag, PolicyValueDisapply ); SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyClockPullingLimit2ToTheNPartsPerMillion, 8 ); SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyLimitInputInjectAhead, PolicyValueDisapply ); SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyDecimateDecoderOutput, PolicyValueDecimateDecoderOutputDisabled); SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicySymmetricJumpDetection, PolicyValueDisapply ); SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyPtsForwardJumpDetectionThreshold, 4 ); SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyPixelAspectRatioCorrection, PolicyValuePixelAspectRatioCorrectionDisabled); SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyAllowFrameDiscardAtNormalSpeed, PolicyValueDisapply ); SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyOperateCollator2InReversibleMode, PolicyValueDisapply ); SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyVideoOutputWindowResizeSteps, 1 ); SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyIgnoreStreamUnPlayableCalls, PolicyValueDisapply ); SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyUsePTSDeducedDefaultFrameRates, PolicyValueApply ); // // Here sits Nicks debug setting for player policies, do not add normal initialization after this point // #if 0 SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyAVDSynchronization, PolicyValueDisapply ); SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyDiscardLateFrames, PolicyValueDiscardLateFramesNever ); // SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyMasterClock, PolicyValueSystemClockMaster ); SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyAllowFrameDiscardAtNormalSpeed, PolicyValueApply ); SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyRebaseOnFailureToDecodeInTime, PolicyValueDisapply ); #endif // #ifdef __TDT__ // Overwrite default settings (see class_definitions/player_types.h for definitions // and descriptions). // Discarding late frames significantly improves the H.264 deadlock behavior. // Obviously late frames cause the player to run out of buffers if not discarded // immediately. It even does not matter how many decode buffers are available - // all of them will be used (up to 32 if enough memory is availble in LMI_VID). if(discardlateframe == 0) SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyDiscardLateFrames, PolicyValueDiscardLateFramesNever ); else if(discardlateframe == 1) SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyDiscardLateFrames, PolicyValueDiscardLateFramesAlways ); else SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyDiscardLateFrames, PolicyValueDiscardLateFramesAfterSynchronize ); // Usage of the immediate start depends on the LateFrame policy. Though, it is not // quite clear what is meant by "agressive policy". SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyVideoStartImmediate, PolicyValueApply ); // This will fix N24 an hopefully every other interlaced-progressive miss interpretertation SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyMPEG2DoNotHonourProgressiveFrameFlag, PolicyValueApply ); //SetPolicy( PlayerAllPlaybacks, PlayerAllStreams, PolicyLimitInputInjectAhead, PolicyValueApply ); #endif InitializationStatus = BufferNoError; }