diff --git a/modules/hw/mmal/codec.c b/modules/hw/mmal/codec.c
index 75184c6fc1be6cd5cda4fc3621a64b40b582c8b6..7d652f637a37777d42ecebe49f4fcc197657e54c 100644
--- a/modules/hw/mmal/codec.c
+++ b/modules/hw/mmal/codec.c
@@ -455,7 +455,6 @@ static int send_output_buffer(decoder_t *dec)
 
     if (sys->output_pool) {
         mmal_buffer_header_reset(buffer);
-        buffer->user_data = picture;
         buffer->alloc_size = sys->output->buffer_size;
         if (buffer_size < sys->output->buffer_size) {
             msg_Err(dec, "Retrieved picture with too small data block (%d < %d)",
@@ -475,6 +474,7 @@ static int send_output_buffer(decoder_t *dec)
         }
         buffer->data = p_sys->buffer->data;
     }
+    buffer->user_data = picture;
     buffer->cmd = 0;
 
     status = mmal_port_send_buffer(sys->output, buffer);
diff --git a/modules/hw/mmal/deinterlace.c b/modules/hw/mmal/deinterlace.c
index f7e2a2c709d70d550df113b135100fa4c912d4ef..341927a33544e45c57bb4a33f1a7264a575245c0 100644
--- a/modules/hw/mmal/deinterlace.c
+++ b/modules/hw/mmal/deinterlace.c
@@ -305,6 +305,7 @@ static int send_output_buffer(filter_t *filter)
     picture->format.i_frame_rate_base = filter->fmt_out.video.i_frame_rate_base;
 
     buffer = picture->p_sys->buffer;
+    buffer->user_data = picture;
     buffer->cmd = 0;
 
     mmal_picture_lock(picture);
diff --git a/modules/hw/mmal/mmal_picture.c b/modules/hw/mmal/mmal_picture.c
index d127c2770690fd463b2ef96bf355e52358b53e91..7ddd5b566c205479abb7db3a9f364fb07c3d11ac 100644
--- a/modules/hw/mmal/mmal_picture.c
+++ b/modules/hw/mmal/mmal_picture.c
@@ -32,8 +32,6 @@ int mmal_picture_lock(picture_t *picture)
     picture_sys_t *pic_sys = picture->p_sys;
     MMAL_BUFFER_HEADER_T *buffer = pic_sys->buffer;
 
-    buffer->user_data = picture;
-
     int offset = 0;
     picture->p[0].p_pixels = buffer->data;
     for (int i = 1; i < picture->i_planes; i++) {
diff --git a/modules/hw/mmal/vout.c b/modules/hw/mmal/vout.c
index dc1a2738faaf8704bf8eaf83c27b175489574d43..8c7bc1f4af2610ae69207d53569f3006aba6f6cf 100644
--- a/modules/hw/mmal/vout.c
+++ b/modules/hw/mmal/vout.c
@@ -572,6 +572,7 @@ static void vd_display(vout_display_t *vd, picture_t *picture,
     if (!pic_sys->displayed || !sys->opaque) {
         buffer->cmd = 0;
         buffer->length = sys->input->buffer_size;
+        buffer->user_data = picture;
 
         status = mmal_port_send_buffer(sys->input, buffer);
         if (status == MMAL_SUCCESS)