当前位置: 首页>>代码示例>>C++>>正文


C++ OSRef::GetRefCount方法代码示例

本文整理汇总了C++中OSRef::GetRefCount方法的典型用法代码示例。如果您正苦于以下问题:C++ OSRef::GetRefCount方法的具体用法?C++ OSRef::GetRefCount怎么用?C++ OSRef::GetRefCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OSRef的用法示例。


在下文中一共展示了OSRef::GetRefCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: RemoveOutput

void RemoveOutput(ReflectorOutput* inOutput, ReflectorSession* inSession, Bool16 killClients)
{
    //This function removes the output from the ReflectorSession, then
    Assert(inSession);
    if (inSession != NULL)
	{
        if (inOutput != NULL)
        {
			inSession->RemoveOutput(inOutput,true);
            //qtss_printf("QTSSReflectorModule.cpp:RemoveOutput it is a client session\n");
        }
        else
        {   // it is a Broadcaster session
            //qtss_printf("QTSSReflectorModule.cpp:RemoveOutput it is a broadcaster session\n");
            //SourceInfo* theInfo = inSession->GetSourceInfo();         
            //Assert(theInfo);
            //
            //if (theInfo->IsRTSPControlled())
            //{   
            //    FileDeleter(inSession->GetSourcePath());
            //}
            //    
 
            //if (killClients || 1)
            //{    inSession->TearDownAllOutputs();
            //}
        }
    
        //qtss_printf("QTSSReflectorModule.cpp:RemoveOutput refcount =%lu\n", inSession->GetRef()->GetRefCount());

        //check if the ReflectorSession should be deleted
        //(it should if its ref count has dropped to 0)
        OSMutexLocker locker (sSessionMap->GetMutex());
        
        OSRef* theSessionRef = inSession->GetRef();
        if (theSessionRef != NULL) 
        {               
            if (theSessionRef->GetRefCount() == 0)
            { 
				RTSPRelaySession* proxySession = (RTSPRelaySession*)inSession->GetRTSPRelaySession();
				if(proxySession != NULL)
				{
					proxySession->SetReflectorSession(NULL);
					sClientSessionMap->UnRegister(proxySession->GetRef());
					proxySession->Signal(Task::kKillEvent);
				}

				inSession->SetRTSPRelaySession(NULL);
				sSessionMap->UnRegister(theSessionRef);
				delete inSession;
            }
			//else if (theSessionRef->GetRefCount() == 1)
			//{  
			//	//qtss_printf("QTSSReflector.cpp:RemoveOutput Delete SESSION=%lu\n",(UInt32)inSession);
			//	RTSPRelaySession* proxySession = (RTSPRelaySession*)inSession->GetRelaySession();
			//	if(proxySession != NULL)
			//	{
			//		proxySession->SetReflectorSession(NULL);
			//		sClientSessionMap->UnRegister(proxySession->GetRef());
			//		proxySession->Signal(Task::kKillEvent);
			//	}

			//	inSession->SetRelaySession(NULL);
			//	sSessionMap->UnRegister(theSessionRef);
			//	delete inSession;
			//}
            else
            {
				qtss_printf("QTSSReflector.cpp:RemoveOutput Release SESSION=%lu RefCount=%d\n",(UInt64)inSession,theSessionRef->GetRefCount());
                sSessionMap->Release(theSessionRef); //  one of the sessions on the ref is ending just decrement the count
            }
        }
    }
    delete inOutput;
}
开发者ID:appotry,项目名称:EasyDarwin-1,代码行数:75,代码来源:QTSSOnDemandRelayModule.cpp


注:本文中的OSRef::GetRefCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。