Add HandleStreamStopInfo helper
parent
8919fcb31d
commit
3caa30ce3b
10
Source/OBS.h
10
Source/OBS.h
|
@ -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;
|
||||
|
||||
//---------------------------------------------------
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue