mirror of
https://github.com/pikvm/ustreamer.git
synced 2026-03-02 22:01:42 +00:00
bunch of fixes for m2m
This commit is contained in:
@@ -23,7 +23,6 @@ _USTR_SRCS = $(shell ls \
|
||||
ustreamer/data/*.c \
|
||||
ustreamer/encoders/cpu/*.c \
|
||||
ustreamer/encoders/hw/*.c \
|
||||
ustreamer/encoders/v4l2/*.c \
|
||||
ustreamer/h264/*.c \
|
||||
)
|
||||
|
||||
|
||||
@@ -122,7 +122,10 @@ workers_pool_s *encoder_workers_pool_init(encoder_s *enc, device_s *dev) {
|
||||
for (; ER(n_m2ms) < n_workers; ++ER(n_m2ms)) {
|
||||
char name[32];
|
||||
snprintf(name, 32, "JPEG-%u", ER(n_m2ms));
|
||||
m2m_option_s options[] = {{NULL, false, 0, 0}};
|
||||
m2m_option_s options[] = {
|
||||
{"COMPRESSION_QUALITY", false, V4L2_CID_JPEG_COMPRESSION_QUALITY, quality},
|
||||
{NULL, false, 0, 0},
|
||||
};
|
||||
ER(m2ms[ER(n_m2ms)]) = m2m_encoder_init(name, "/dev/video11", V4L2_PIX_FMT_MJPEG, 0, options);
|
||||
}
|
||||
|
||||
@@ -219,10 +222,11 @@ static bool _worker_run_job(worker_s *wr) {
|
||||
|
||||
} else if (ER(type) == ENCODER_TYPE_V4L2) {
|
||||
LOG_VERBOSE("Compressing buffer using V4L2");
|
||||
if (!m2m_encoder_ensure_ready(ER(m2ms[wr->number]), src)) {
|
||||
if (m2m_encoder_compress(ER(m2ms[wr->number]), src, dest, false) < 0) {
|
||||
goto error;
|
||||
}
|
||||
if (m2m_encoder_ensure_ready(ER(m2ms[wr->number]), src) < 0) {
|
||||
goto error;
|
||||
}
|
||||
if (m2m_encoder_compress(ER(m2ms[wr->number]), src, dest, false) < 0) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
} else if (ER(type) == ENCODER_TYPE_NOOP) {
|
||||
|
||||
@@ -35,6 +35,7 @@ h264_stream_s *h264_stream_init(memsink_s *sink, const char *path, unsigned bitr
|
||||
|
||||
m2m_option_s options[] = {
|
||||
OPTION(true, BITRATE, bitrate * 1000),
|
||||
OPTION(false, BITRATE_PEAK, bitrate * 1000),
|
||||
OPTION(true, H264_I_PERIOD, gop),
|
||||
OPTION(true, H264_PROFILE, V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE),
|
||||
OPTION(true, H264_LEVEL, V4L2_MPEG_VIDEO_H264_LEVEL_4_0),
|
||||
|
||||
@@ -157,6 +157,13 @@ static int _m2m_encoder_prepare(m2m_encoder_s *enc, const frame_s *frame) {
|
||||
fmt.fmt.pix_mp.plane_fmt[0].sizeimage = 512 << 10;
|
||||
E_LOG_DEBUG("Configuring OUTPUT format ...");
|
||||
E_XIOCTL(VIDIOC_S_FMT, &fmt, "Can't set OUTPUT format");
|
||||
if (fmt.fmt.pix_mp.pixelformat != enc->output_format) {
|
||||
char fourcc_str[8];
|
||||
E_LOG_ERROR("The OUTPUT format can't be configured as %s",
|
||||
fourcc_to_string(enc->output_format, fourcc_str, 8));
|
||||
E_LOG_ERROR("In case of Raspberry Pi, try to append 'start_x=1' to /boot/config.txt");
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
if (enc->fps > 0) { // TODO: Check this for MJPEG
|
||||
|
||||
Reference in New Issue
Block a user