From 319e1b68020b72d826d0fd3a1cbac605edaf9165 Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Tue, 21 Apr 2015 02:45:59 +1000 Subject: [PATCH] rpicamsrc: Clear intra-refresh MMAL param struct. Use memset on the stack allocated MMAL_PARAMETER_VIDEO_INTRA_REFRESH_T struct. Apparently mmal_port_parameter_get() doesn't retrieve all parameters, causing random failures when we set the intra-refresh param on the encoder. Fixes https://github.com/thaytan/gst-rpicamsrc/issues/22 for me. --- sys/rpicamsrc/RaspiCapture.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/rpicamsrc/RaspiCapture.c b/sys/rpicamsrc/RaspiCapture.c index b08b91fbf7..34194fbae2 100644 --- a/sys/rpicamsrc/RaspiCapture.c +++ b/sys/rpicamsrc/RaspiCapture.c @@ -1441,6 +1441,13 @@ static MMAL_STATUS_T create_encoder_component(RASPIVID_STATE *state) if (config->intra_refresh_type != -1) { MMAL_PARAMETER_VIDEO_INTRA_REFRESH_T param; + + /* Need to memset, apparently mmal_port_parameter_get() + * doesn't retrieve all parameters, causing random failures + * when we set it + */ + memset (¶m, 0, sizeof (MMAL_PARAMETER_VIDEO_INTRA_REFRESH_T)); + param.hdr.id = MMAL_PARAMETER_VIDEO_INTRA_REFRESH; param.hdr.size = sizeof(param);