vlc | branch: master | Julian Scheel <[email protected]> | Wed Jun 3 09:50:36 2015 +0200| [c92f24312c5674c9a32185da417ae5bdbf426276] | committer: 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: Julian Scheel <[email protected]> Signed-off-by: Jean-Baptiste Kempf <[email protected]> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c92f24312c5674c9a32185da417ae5bdbf426276 --- modules/hw/mmal/deinterlace.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/modules/hw/mmal/deinterlace.c b/modules/hw/mmal/deinterlace.c index d158b71..0a56a94 100644 --- a/modules/hw/mmal/deinterlace.c +++ b/modules/hw/mmal/deinterlace.c @@ -337,16 +337,22 @@ static picture_t *deinterlace(filter_t *filter, picture_t *picture) buffer->pts = picture->date; buffer->cmd = 0; - 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)); + 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 { - atomic_fetch_add(&sys->input_in_transit, 1); - vlc_cond_signal(&sys->buffer_cond); + picture_Release(picture); } - vlc_mutex_unlock(&sys->buffer_cond_mutex); /* * Send output buffers _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
