gstpad: Fix PROBE_NO_DATA macro
authorEdward Hervey <bilboed@bilboed.com>
Wed, 21 Jan 2015 10:45:41 +0000 (11:45 +0100)
committerEdward Hervey <bilboed@bilboed.com>
Wed, 21 Jan 2015 13:11:41 +0000 (14:11 +0100)
The problem was that the macro was always used with 'ret' as the defaultval
argument.

This would result in the macro eventually expanding to
    if (G_UNLIKELY (ret != ret && ret != GST_FLOW_OK))

... ret != ret will always fail, and therefore we'd never call the
following line.

Instead of that, store the previous value locally for comparision

gst/gstpad.c

index 4c063fe..7fd043d 100644 (file)
@@ -3215,10 +3215,11 @@ no_match:
 #define PROBE_NO_DATA(pad,mask,label,defaultval)                \
   G_STMT_START {                                               \
     if (G_UNLIKELY (pad->num_probes)) {                                \
+      GstFlowReturn pval = defaultval;                         \
       /* pass NULL as the data item */                          \
       GstPadProbeInfo info = { mask, 0, NULL, 0, 0 };           \
       ret = do_probe_callbacks (pad, &info, defaultval);       \
-      if (G_UNLIKELY (ret != defaultval && ret != GST_FLOW_OK))        \
+      if (G_UNLIKELY (ret != pval && ret != GST_FLOW_OK))      \
         goto label;                                            \
     }                                                          \
   } G_STMT_END