obs-outputs: Fix race condition

It's possible that packets would still be coming in while the packets
were being freed.
master
jp9000 2015-11-01 14:52:49 -08:00
parent 6c193435cc
commit 3b48817a7b
1 changed files with 3 additions and 0 deletions

View File

@ -87,11 +87,14 @@ static void log_rtmp(int level, const char *format, va_list args)
static inline void free_packets(struct rtmp_stream *stream)
{
pthread_mutex_lock(&stream->packets_mutex);
while (stream->packets.size) {
struct encoder_packet packet;
circlebuf_pop_front(&stream->packets, &packet, sizeof(packet));
obs_free_encoder_packet(&packet);
}
pthread_mutex_unlock(&stream->packets_mutex);
}
static void rtmp_stream_stop(void *data);