From dcd62c35f0cd1347afa829b57600c26566910b16 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Tue, 21 Dec 2021 10:59:37 -0500 Subject: [PATCH] v4l2codecs: Trace request by it FD This helps when crossing the debug logs with the kernel logs. Part-of: --- .../sys/v4l2codecs/gstv4l2codech264dec.c | 3 ++- .../sys/v4l2codecs/gstv4l2decoder.c | 21 +++++++++++++------ .../sys/v4l2codecs/gstv4l2decoder.h | 2 ++ 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codech264dec.c b/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codech264dec.c index 4ae13e05c1..4da59cdc0b 100644 --- a/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codech264dec.c +++ b/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codech264dec.c @@ -1316,7 +1316,8 @@ gst_v4l2_codec_h264_dec_new_field_picture (GstH264Decoder * decoder, return GST_FLOW_OK; } - GST_DEBUG_OBJECT (self, "Assigned request %p to second field.", request); + GST_DEBUG_OBJECT (self, "Assigned request %i to second field.", + gst_v4l2_request_get_fd (request)); /* Associate the previous request with the new picture so that * submit_bitstream can create sub-request */ diff --git a/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2decoder.c b/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2decoder.c index cbf0f4ace9..a024c9682f 100644 --- a/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2decoder.c +++ b/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2decoder.c @@ -1053,7 +1053,7 @@ gst_v4l2_request_unref (GstV4l2Request * request) if (request->pending) { gint idx; - GST_DEBUG_OBJECT (decoder, "Freeing pending request %p.", request); + GST_DEBUG_OBJECT (decoder, "Freeing pending request %i.", request->fd); idx = gst_queue_array_find (decoder->pending_requests, NULL, request); if (idx >= 0) @@ -1063,7 +1063,7 @@ gst_v4l2_request_unref (GstV4l2Request * request) return; } - GST_TRACE_OBJECT (decoder, "Recycling request %p.", request); + GST_TRACE_OBJECT (decoder, "Recycling request %i.", request->fd); ret = ioctl (request->fd, MEDIA_REQUEST_IOC_REINIT, NULL); if (ret < 0) { @@ -1084,7 +1084,7 @@ gst_v4l2_request_queue (GstV4l2Request * request, guint flags) gint ret; guint max_pending; - GST_TRACE_OBJECT (decoder, "Queuing request %p.", request); + GST_TRACE_OBJECT (decoder, "Queuing request %i.", request->fd); if (!gst_v4l2_decoder_queue_sink_mem (decoder, request, request->bitstream, request->frame_num, flags)) { @@ -1134,15 +1134,18 @@ gst_v4l2_request_set_done (GstV4l2Request * request) if (!request->pending) return 1; + GST_DEBUG_OBJECT (decoder, "Waiting for request %i to complete.", + request->fd); + ret = gst_poll_wait (request->poll, GST_SECOND); if (ret == 0) { - GST_WARNING_OBJECT (decoder, "Request %p took too long.", request); + GST_WARNING_OBJECT (decoder, "Request %i took too long.", request->fd); return 0; } if (ret < 0) { - GST_WARNING_OBJECT (decoder, "Request %p error: %s (%i)", - request, g_strerror (errno), errno); + GST_WARNING_OBJECT (decoder, "Request %i error: %s (%i)", + request->fd, g_strerror (errno), errno); return ret; } @@ -1187,3 +1190,9 @@ gst_v4l2_request_dup_pic_buf (GstV4l2Request * request) { return gst_buffer_ref (request->pic_buf); } + +gint +gst_v4l2_request_get_fd (GstV4l2Request * request) +{ + return request->fd; +} diff --git a/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2decoder.h b/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2decoder.h index 342017e811..320ea44b79 100644 --- a/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2decoder.h +++ b/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2decoder.h @@ -138,6 +138,8 @@ gboolean gst_v4l2_request_failed (GstV4l2Request * request); GstBuffer * gst_v4l2_request_dup_pic_buf (GstV4l2Request * request); +gint gst_v4l2_request_get_fd (GstV4l2Request * request); + G_END_DECLS #endif /* __GST_V4L2_DECODER_H__ */