pleorasink: fix debug level, add more interface debug output

This commit is contained in:
Joshua M. Doe 2019-11-15 10:30:50 -05:00
parent 7292eaf353
commit f6509a1b4d
2 changed files with 22 additions and 4 deletions

View File

@ -100,7 +100,7 @@ GST_STATIC_PAD_TEMPLATE ("sink",
/* class initialization */ /* class initialization */
/* setup debug */ /* setup debug */
GST_DEBUG_CATEGORY_STATIC (pleorasink_debug); GST_DEBUG_CATEGORY (pleorasink_debug);
#define GST_CAT_DEFAULT pleorasink_debug #define GST_CAT_DEFAULT pleorasink_debug
G_DEFINE_TYPE (GstPleoraSink, gst_pleorasink, GST_TYPE_BASE_SINK); G_DEFINE_TYPE (GstPleoraSink, gst_pleorasink, GST_TYPE_BASE_SINK);
@ -330,18 +330,32 @@ gst_pleorasink_select_interface (GstPleoraSink * sink)
{ {
PvSystem lSystem; PvSystem lSystem;
const PvNetworkAdapter *selected_nic = NULL; const PvNetworkAdapter *selected_nic = NULL;
guint iface_count;
gchar *desired_mac = NULL; gchar *desired_mac = NULL;
gchar *found_mac = NULL; gchar *found_mac = NULL;
/* we'll compare uppercase version of MAC */ /* we'll compare uppercase version of MAC */
desired_mac = g_ascii_strup (sink->mac, -1); 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; const PvNetworkAdapter *lNIC = NULL;
lNIC = dynamic_cast < const PvNetworkAdapter *>(lSystem.GetInterface (i)); 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) || if ((lNIC == NULL) ||
(lNIC->GetIPAddressCount () == 0) || (lNIC->GetIPAddressCount () == 0) ||
(lNIC->GetIPAddress (0) == "0.0.0.0")) { (lNIC->GetIPAddress (0) == "0.0.0.0")) {
GST_DEBUG_OBJECT (sink, "Interface %d has no valid IP address", i);
continue; continue;
} }

View File

@ -19,6 +19,10 @@
#include "streamingchannelsource.h" #include "streamingchannelsource.h"
/* setup debug */
GST_DEBUG_CATEGORY_EXTERN (pleorasink_debug);
#define GST_CAT_DEFAULT pleorasink_debug
GstStreamingChannelSource::GstStreamingChannelSource () GstStreamingChannelSource::GstStreamingChannelSource ()
: mAcquisitionBuffer (NULL), mBufferCount (0), mBufferValid (FALSE) : mAcquisitionBuffer (NULL), mBufferCount (0), mBufferValid (FALSE)
{ {
@ -163,7 +167,7 @@ GstStreamingChannelSource::ResizeBufferIfNeeded (PvBuffer * aBuffer)
void void
GstStreamingChannelSource::SetBuffer (GstBuffer * buf) GstStreamingChannelSource::SetBuffer (GstBuffer * buf)
{ {
GST_ERROR ("Set buffer"); GST_LOG ("SetBuffer");
g_mutex_lock (&mSink->mutex); g_mutex_lock (&mSink->mutex);
@ -202,4 +206,4 @@ GstStreamingChannelSource::SetBuffer (GstBuffer * buf)
g_cond_signal (&mSink->cond); g_cond_signal (&mSink->cond);
g_mutex_unlock (&mSink->mutex); g_mutex_unlock (&mSink->mutex);
} }