From f6509a1b4d27f6ed09ae978a64da0b185b92a783 Mon Sep 17 00:00:00 2001 From: "Joshua M. Doe" Date: Fri, 15 Nov 2019 10:30:50 -0500 Subject: [PATCH] pleorasink: fix debug level, add more interface debug output --- sys/pleora/gstpleorasink.cpp | 18 ++++++++++++++++-- sys/pleora/streamingchannelsource.cpp | 8 ++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/sys/pleora/gstpleorasink.cpp b/sys/pleora/gstpleorasink.cpp index 3c0658d..805161c 100644 --- a/sys/pleora/gstpleorasink.cpp +++ b/sys/pleora/gstpleorasink.cpp @@ -100,7 +100,7 @@ GST_STATIC_PAD_TEMPLATE ("sink", /* class initialization */ /* setup debug */ -GST_DEBUG_CATEGORY_STATIC (pleorasink_debug); +GST_DEBUG_CATEGORY (pleorasink_debug); #define GST_CAT_DEFAULT pleorasink_debug G_DEFINE_TYPE (GstPleoraSink, gst_pleorasink, GST_TYPE_BASE_SINK); @@ -330,18 +330,32 @@ gst_pleorasink_select_interface (GstPleoraSink * sink) { PvSystem lSystem; const PvNetworkAdapter *selected_nic = NULL; + guint iface_count; gchar *desired_mac = NULL; gchar *found_mac = NULL; /* we'll compare uppercase version of MAC */ desired_mac = g_ascii_strup (sink->mac, -1); - for (guint32 i = 0; i < lSystem.GetInterfaceCount (); i++) { + iface_count = lSystem.GetInterfaceCount (); + + GST_DEBUG_OBJECT (sink, "Found %d interface(s)", iface_count); + + for (guint32 i = 0; i < iface_count; i++) { const PvNetworkAdapter *lNIC = NULL; lNIC = dynamic_cast < const PvNetworkAdapter *>(lSystem.GetInterface (i)); + + GST_DEBUG_OBJECT (sink, + "Found network interface '%s', MAC: %s, IP: %s, Subnet: %s", + lNIC->GetDescription ().GetAscii (), + lNIC->GetMACAddress ().GetAscii (), + lNIC->GetIPAddress (0).GetAscii (), + lNIC->GetSubnetMask (0).GetAscii ()); + if ((lNIC == NULL) || (lNIC->GetIPAddressCount () == 0) || (lNIC->GetIPAddress (0) == "0.0.0.0")) { + GST_DEBUG_OBJECT (sink, "Interface %d has no valid IP address", i); continue; } diff --git a/sys/pleora/streamingchannelsource.cpp b/sys/pleora/streamingchannelsource.cpp index 97160f2..d142ad1 100644 --- a/sys/pleora/streamingchannelsource.cpp +++ b/sys/pleora/streamingchannelsource.cpp @@ -19,6 +19,10 @@ #include "streamingchannelsource.h" +/* setup debug */ +GST_DEBUG_CATEGORY_EXTERN (pleorasink_debug); +#define GST_CAT_DEFAULT pleorasink_debug + GstStreamingChannelSource::GstStreamingChannelSource () : mAcquisitionBuffer (NULL), mBufferCount (0), mBufferValid (FALSE) { @@ -163,7 +167,7 @@ GstStreamingChannelSource::ResizeBufferIfNeeded (PvBuffer * aBuffer) void GstStreamingChannelSource::SetBuffer (GstBuffer * buf) { - GST_ERROR ("Set buffer"); + GST_LOG ("SetBuffer"); g_mutex_lock (&mSink->mutex); @@ -202,4 +206,4 @@ GstStreamingChannelSource::SetBuffer (GstBuffer * buf) g_cond_signal (&mSink->cond); g_mutex_unlock (&mSink->mutex); -} \ No newline at end of file +}