X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=nageru%2Fmixer.cpp;h=8793eda47cfa646e9c1c22a4435daa9364bcc060;hb=0c95058b25adce6f634279bc7feb04158242e63e;hp=953fd8133db59410ab2973d7592a05e5d133bc09;hpb=eeda8995329601f9f4e35047358400833eeae68e;p=nageru diff --git a/nageru/mixer.cpp b/nageru/mixer.cpp index 953fd81..8793eda 100644 --- a/nageru/mixer.cpp +++ b/nageru/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); + } } }