Skip to content

V4L2 H264 framing fixes #3614

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -1762,6 +1762,12 @@ static int mmal_init(struct bm2835_mmal_dev *dev)
MMAL_PARAMETER_MINIMISE_FRAGMENTATION,
&enable,
sizeof(enable));

/* Enable inserting headers into the first frame */
vchiq_mmal_port_parameter_set(dev->instance,
&dev->component[COMP_VIDEO_ENCODE]->control,
MMAL_PARAMETER_VIDEO_ENCODE_HEADERS_WITH_FRAME,
&enable, sizeof(enable));
}
ret = bm2835_mmal_set_all_camera_controls(dev);
if (ret < 0) {
Expand Down
13 changes: 13 additions & 0 deletions drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1967,6 +1967,19 @@ static int bcm2835_codec_create_component(struct bcm2835_codec_ctx *ctx)
MMAL_PARAMETER_VIDEO_ENCODE_SPS_TIMING,
&param, sizeof(param));

/* Enable inserting headers into the first frame */
vchiq_mmal_port_parameter_set(ctx->dev->instance,
&ctx->component->control,
MMAL_PARAMETER_VIDEO_ENCODE_HEADERS_WITH_FRAME,
&param, sizeof(param));
/*
* Avoid fragmenting the buffers over multiple frames (unless
* the frame is bigger than the whole buffer)
*/
vchiq_mmal_port_parameter_set(ctx->dev->instance,
&ctx->component->control,
MMAL_PARAMETER_MINIMISE_FRAGMENTATION,
&param, sizeof(param));
} else {
if (ctx->q_data[V4L2_M2M_DST].sizeimage <
ctx->component->output[0].minimum_buffer.size)
Expand Down
6 changes: 6 additions & 0 deletions drivers/staging/vc04_services/vchiq-mmal/mmal-parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,12 @@ enum mmal_parameter_video_type {

/**< Takes a @ref MMAL_PARAMETER_UINT32_T */
MMAL_PARAMETER_VIDEO_DROPPABLE_PFRAME_LENGTH,

/**< Take a @ref MMAL_PARAMETER_VIDEO_STALL_T */
MMAL_PARAMETER_VIDEO_STALL_THRESHOLD,

/**< Take a @ref MMAL_PARAMETER_BOOLEAN_T */
MMAL_PARAMETER_VIDEO_ENCODE_HEADERS_WITH_FRAME,
};

/** Valid mirror modes */
Expand Down