Commit c92f2431 authored by Julian Scheel's avatar Julian Scheel Committed by Jean-Baptiste Kempf

mmal/deinterlace: Do not filter the same picture twice

If the same picture, containing the same buffer header without being
re-acquired in the meantime, is sent to image_fx twice it will portentially
cause a double free within the mmal core as it destroys the internal
refcounting. Use the same guarding mechanism which is already in place in
mmal/vout to ensure this is not happening at any point.
Signed-off-by: default avatarJulian Scheel <julian@jusst.de>
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 974e13d7
......@@ -337,16 +337,22 @@ static picture_t *deinterlace(filter_t *filter, picture_t *picture)
buffer->pts = picture->date;
buffer->cmd = 0;
if (!picture->p_sys->displayed) {
vlc_mutex_lock(&sys->buffer_cond_mutex);
status = mmal_port_send_buffer(sys->input, buffer);
if (status != MMAL_SUCCESS) {
msg_Err(filter, "Failed to send buffer to input port (status=%"PRIx32" %s)",
status, mmal_status_to_string(status));
picture_Release(picture);
} else {
picture->p_sys->displayed = true;
atomic_fetch_add(&sys->input_in_transit, 1);
vlc_cond_signal(&sys->buffer_cond);
}
vlc_mutex_unlock(&sys->buffer_cond_mutex);
} else {
picture_Release(picture);
}
/*
* Send output buffers
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment