Add HandleStreamStopInfo helper

master
palana 2014-09-16 17:08:53 +02:00
parent 8919fcb31d
commit 3caa30ce3b
2 changed files with 29 additions and 0 deletions

View File

@ -637,6 +637,16 @@ class OBS
//---------------------------------------------------
struct StopInfo
{
DWORD time = (DWORD)-1;
bool timeSeen = false;
std::function<void()> func;
};
bool HandleStreamStopInfo(StopInfo &, PacketType, const VideoSegment&);
//---------------------------------------------------
std::unique_ptr<NetworkStream> network;
//---------------------------------------------------

View File

@ -222,6 +222,25 @@ void OBS::SendFrame(VideoSegment &curSegment, QWORD firstFrameTime)
}
}
bool OBS::HandleStreamStopInfo(OBS::StopInfo &info, PacketType type, const VideoSegment& segment)
{
if (type == PacketType_Audio || !info.func)
return false;
if (segment.pts < info.time)
return false;
if (!info.timeSeen)
{
info.timeSeen = true;
return false;
}
info.func();
info = {};
return true;
}
bool OBS::ProcessFrame(FrameProcessInfo &frameInfo)
{
List<DataPacket> videoPackets;