obs-ffmpeg: Don't purge packets when there are none

This commit is contained in:
Exeldro 2021-05-17 21:35:18 +02:00 committed by Jim
parent 6942bb814d
commit 62d0661f98

View File

@ -724,6 +724,9 @@ static bool purge_front(struct ffmpeg_muxer *stream)
struct encoder_packet pkt;
bool keyframe;
if (!stream->packets.size)
return false;
circlebuf_pop_front(&stream->packets, &pkt, sizeof(pkt));
keyframe = pkt.type == OBS_ENCODER_VIDEO && pkt.keyframe;
@ -751,6 +754,8 @@ static inline void purge(struct ffmpeg_muxer *stream)
struct encoder_packet pkt;
for (;;) {
if (!stream->packets.size)
return;
circlebuf_peek_front(&stream->packets, &pkt,
sizeof(pkt));
if (pkt.type == OBS_ENCODER_VIDEO && pkt.keyframe)