[Bug 765600] gst_memory_map: delegate logging traces to subclass on failure
GStreamer (GNOME Bugzilla)
bugzilla at gnome.org
Fri Nov 11 18:30:47 UTC 2016
https://bugzilla.gnome.org/show_bug.cgi?id=765600
Tim-Philipp Müller <t.i.m at zen.co.uk> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #337176|none |needs-work
status| |
--- Comment #18 from Tim-Philipp Müller <t.i.m at zen.co.uk> ---
Comment on attachment 337176
--> https://bugzilla.gnome.org/attachment.cgi?id=337176
gstfdmemory: log with GST_INFO instead of GST_ERROR on permission denied
>--- a/gst-libs/gst/allocators/gstfdmemory.c
>+++ b/gst-libs/gst/allocators/gstfdmemory.c
>@@ -110,9 +110,20 @@ gst_fd_mem_map (GstMemory * gmem, gsize maxsize, GstMapFlags flags)
>
> mem->data = mmap (0, gmem->maxsize, prot, flags, mem->fd, 0);
> if (mem->data == MAP_FAILED) {
>+ GString *msg = g_string_new (NULL);
> mem->data = NULL;
>- GST_ERROR ("%p: fd %d: mmap failed: %s", mem, mem->fd,
>+
>+ g_string_printf (msg, "%p: fd %d: mmap failed: %s", mem, mem->fd,
> g_strerror (errno));
>+ switch (errno) {
>+ case EACCES:
>+ GST_INFO ("%s", msg->str);
>+ break;
>+ default:
>+ GST_ERROR ("%s", msg->str);
>+ }
>+
>+ g_string_free (msg, TRUE);
We're now allocating, printf-ing and freeing a GString (and various helper
allocs used inside g_string_printf) even if debug logging is completely
disabled or not active, this seems suboptimal to me :)
Is there any reason not to just duplicate the statement for GST_INFO and
GST_ERROR ?
If you *really* want to avoid this you can also use GST_CAT_LEVEL_LOG() and
specify the level there.
--
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
More information about the gstreamer-bugs
mailing list