问题: 一个项目要本地录制和远程录制。现在问题是两种有可能同时都录,然而写包的时候只能这么写。大家谁能帮忙改进下嘛?
代码部分:
// 远程录制
if (NULL != pPluginU7MMSvrRec && pPluginU7MMSvrRec->IsConfRecording())
{
KDataOutPacket outPacket;
outPacket << strMemberID.c_str();
outPacket << (unsigned int)nCardIndex;
outPacket << (unsigned long)pAVDataRec->GetScreenIndex();
outPacket << (unsigned long)pAVDataRec->GetWndIndex();
outPacket << ulFullScreen;
pPluginU7MMSvrRec->SaveConfStream(RECORD_FRAME_TYPE_AVTM_DATA, bKeyFrame, outPacket.GetData(), outPacket.GetLength());
}
//本地录制
if (NULL != m_pTMWndStream)
{
KDataOutPacket outPacket;
outPacket << “Local”;
outPacket << (unsigned int)nCardIndex;
outPacket << (unsigned long)pAVDataRec->GetScreenIndex();
outPacket << (unsigned long)pAVDataRec->GetWndIndex();
outPacket << ulFullScreen;
m_pTMWndStream->WriteData((char *)outPacket.GetData(),outPacket.GetLength(), bKeyFrame ? true : false);
}
代码部分:
// 远程录制
if (NULL != pPluginU7MMSvrRec && pPluginU7MMSvrRec->IsConfRecording())
{
KDataOutPacket outPacket;
outPacket << strMemberID.c_str();
outPacket << (unsigned int)nCardIndex;
outPacket << (unsigned long)pAVDataRec->GetScreenIndex();
outPacket << (unsigned long)pAVDataRec->GetWndIndex();
outPacket << ulFullScreen;
pPluginU7MMSvrRec->SaveConfStream(RECORD_FRAME_TYPE_AVTM_DATA, bKeyFrame, outPacket.GetData(), outPacket.GetLength());
}
//本地录制
if (NULL != m_pTMWndStream)
{
KDataOutPacket outPacket;
outPacket << “Local”;
outPacket << (unsigned int)nCardIndex;
outPacket << (unsigned long)pAVDataRec->GetScreenIndex();
outPacket << (unsigned long)pAVDataRec->GetWndIndex();
outPacket << ulFullScreen;
m_pTMWndStream->WriteData((char *)outPacket.GetData(),outPacket.GetLength(), bKeyFrame ? true : false);
}
解决方案
40
冗余就让它冗余吧。
过早的优化是万恶之源!
听人劝,吃饱饭。
过早的优化是万恶之源!
听人劝,吃饱饭。