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) ...@@ -337,16 +337,22 @@ static picture_t *deinterlace(filter_t *filter, picture_t *picture)
buffer->pts = picture->date; buffer->pts = picture->date;
buffer->cmd = 0; buffer->cmd = 0;
vlc_mutex_lock(&sys->buffer_cond_mutex); if (!picture->p_sys->displayed) {
status = mmal_port_send_buffer(sys->input, buffer); vlc_mutex_lock(&sys->buffer_cond_mutex);
if (status != MMAL_SUCCESS) { status = mmal_port_send_buffer(sys->input, buffer);
msg_Err(filter, "Failed to send buffer to input port (status=%"PRIx32" %s)", if (status != MMAL_SUCCESS) {
status, mmal_status_to_string(status)); 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 { } else {
atomic_fetch_add(&sys->input_in_transit, 1); picture_Release(picture);
vlc_cond_signal(&sys->buffer_cond);
} }
vlc_mutex_unlock(&sys->buffer_cond_mutex);
/* /*
* Send output buffers * 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