[PATCH 4/8] v4l2-tracer: remove compress_frame_count

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The trace context attempts to keep track of the number of compressed
frames received to avoid tracing the same decoded frame more than once.
However, this shared context only works if both the OUTPUT and CAPTURE
queues are run in the same process. If they are run in different
processes, then they will each have their own separate context and no
decoded frames will be traced.

Remove the compressed_frame_count since it is not functioning as expected.

Signed-off-by: Deborah Brouwer <deborah.brouwer@xxxxxxxxxxxxx>
---
 utils/v4l2-tracer/trace-helper.cpp | 23 ++++++++++-------------
 utils/v4l2-tracer/trace.cpp        |  1 -
 utils/v4l2-tracer/trace.h          |  1 -
 3 files changed, 10 insertions(+), 15 deletions(-)

diff --git a/utils/v4l2-tracer/trace-helper.cpp b/utils/v4l2-tracer/trace-helper.cpp
index b6336313..f58671df 100644
--- a/utils/v4l2-tracer/trace-helper.cpp
+++ b/utils/v4l2-tracer/trace-helper.cpp
@@ -288,10 +288,8 @@ void s_ext_ctrls_setup(struct v4l2_ext_controls *ext_controls)
 			 * received to avoid losing frames although this will still sometimes result
 			 * in frames out of order.
 			 */
-			if ((ctrl.p_h264_decode_params->flags & V4L2_H264_DECODE_PARAM_FLAG_IDR_PIC) != 0U) {
-				if (ctx_trace.compressed_frame_count != 0)
-					trace_mem_decoded();
-			}
+			if ((ctrl.p_h264_decode_params->flags & V4L2_H264_DECODE_PARAM_FLAG_IDR_PIC) != 0U)
+				trace_mem_decoded();
 
 			/*
 			 * When pic_order_cnt_lsb wraps around to zero, adjust the total count using
@@ -337,15 +335,16 @@ void qbuf_setup(struct v4l2_buffer *buf)
 	if (buf->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE ||
 	    buf->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) {
 		trace_mem_encoded(buf_fd, buf_offset);
-		ctx_trace.compressed_frame_count = ctx_trace.compressed_frame_count + 1;
 	}
 
 	if (buf->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE ||
 	    buf->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
-
-		/* If the capture buffer is queued for reuse, trace it before it is reused. */
-		if (ctx_trace.compressed_frame_count != 0)
-			trace_mem_decoded();
+		/*
+		 * If the capture buffer is queued for reuse, trace it before it is reused.
+		 * Capture buffers can't be traced using dqbuf because the buffer is mmapped
+		 * after the call to dqbuf.
+		 */
+		trace_mem_decoded();
 
 		/* H264 sets display order in controls, otherwise display just in the order queued. */
 		if (ctx_trace.compression_format != V4L2_PIX_FMT_H264_SLICE)
@@ -373,10 +372,8 @@ void streamoff_cleanup(v4l2_buf_type buf_type)
 	 * because they were not queued for reuse.
 	 */
 	if (buf_type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE ||
-	    buf_type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
-		if (ctx_trace.compressed_frame_count != 0)
-			trace_mem_decoded();
-	}
+	    buf_type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
+		trace_mem_decoded();
 }
 
 void g_fmt_setup_trace(struct v4l2_format *format)
diff --git a/utils/v4l2-tracer/trace.cpp b/utils/v4l2-tracer/trace.cpp
index f81f68d1..31447f24 100644
--- a/utils/v4l2-tracer/trace.cpp
+++ b/utils/v4l2-tracer/trace.cpp
@@ -204,7 +204,6 @@ void trace_mem_decoded(void)
 		if (!it->address || it == ctx_trace.buffers.end() || it->bytesused < expected_length)
 			break;
 	}
-	ctx_trace.compressed_frame_count = ctx_trace.compressed_frame_count - displayed_count;
 }
 
 json_object *trace_v4l2_plane(struct v4l2_plane *ptr, __u32 memory)
diff --git a/utils/v4l2-tracer/trace.h b/utils/v4l2-tracer/trace.h
index 1e8b17e7..272f6c3c 100644
--- a/utils/v4l2-tracer/trace.h
+++ b/utils/v4l2-tracer/trace.h
@@ -36,7 +36,6 @@ struct trace_context {
 		struct h264_info h264;
 	} fmt;
 	std::string trace_filename;
-	int compressed_frame_count;
 	std::list<long> decode_order;
 	std::list<struct buffer_trace> buffers;
 	std::unordered_map<int, std::string> devices; /* key:fd, value: path of the device */
-- 
2.41.0





[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux