X-Git-Url: https://git.sesse.net/?p=nageru;a=blobdiff_plain;f=mixer.cpp;h=95cdda98ecd5a42e97cb12cfdb4fb796e771a0e0;hp=294040f1bfd6fc6dde71a793af91c536e2c9f12e;hb=7cd8d9079f89d091f3332de1cdfee46136d2d74f;hpb=16e6694c62f62250b1c5d6923ed93c674c4ccf88 diff --git a/mixer.cpp b/mixer.cpp index 294040f..95cdda9 100644 --- a/mixer.cpp +++ b/mixer.cpp @@ -1071,12 +1071,16 @@ void Mixer::thread_func() new_frame->upload_func = nullptr; } - // There are situations where we could possibly want to - // include FFmpeg inputs (CEF inputs are unlikely), - // but they're not necessarily in 4:2:2 Y'CbCr, so it would - // require more functionality the the JPEG encoder. - if (card_index < num_cards) { - mjpeg_encoder->upload_frame(pts_int, card_index, new_frame->frame, new_frame->video_format, new_frame->y_offset, new_frame->cbcr_offset); + // Only bother doing MJPEG encoding if there are any connected clients + // that want the stream. + if (httpd.get_num_connected_multicam_clients() > 0) { + // There are situations where we could possibly want to + // include FFmpeg inputs (CEF inputs are unlikely), + // but they're not necessarily in 4:2:2 Y'CbCr, so it would + // require more functionality the the JPEG encoder. + if (card_index < num_cards) { + mjpeg_encoder->upload_frame(pts_int, card_index, new_frame->frame, new_frame->video_format, new_frame->y_offset, new_frame->cbcr_offset); + } } }