KmsParseTreeBin: Fix wrong bitwise operation
To check for an active flag, the operation should be: variable & FLAG
but the code was doing: variable | flag, which is incorrect and will
always evaluate to TRUE.
@@ -88,12 +88,11 @@ difference_over_threshold (guint a, guint b, float th)
}
static GstPadProbeReturn
-bitrate_calculation_probe (GstPad * pad, GstPadProbeInfo * info, gpointer data)
+bitrate_calculation_probe (GstPad * pad, GstPadProbeInfo * info,
+ KmsParseTreeBin * self)
{
- KmsParseTreeBin *self = data;
-
- if (GST_PAD_PROBE_INFO_TYPE (info) | GST_PAD_PROBE_TYPE_BUFFER) {
- GstBuffer *buffer = gst_pad_probe_info_get_buffer (info);
+ if (GST_PAD_PROBE_INFO_TYPE (info) & GST_PAD_PROBE_TYPE_BUFFER) {
+ GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER (info);
GstClockTime timediff = GST_CLOCK_TIME_NONE;
guint bitrate;
@@ -146,7 +145,8 @@ bitrate_calculation_probe (GstPad * pad, GstPadProbeInfo * info, gpointer data)
self->priv->last_buffer_pts = buffer->pts;
self->priv->last_buffer_dts = buffer->dts;
- } else if (GST_PAD_PROBE_INFO_TYPE (info) | GST_PAD_PROBE_TYPE_BUFFER_LIST) {
+ }
+ else if (GST_PAD_PROBE_INFO_TYPE (info) & GST_PAD_PROBE_TYPE_BUFFER_LIST) {
GST_WARNING_OBJECT (self,
"Bufferlist is not supported yet for bitrate calculation");
}
@@ -172,7 +172,7 @@ kms_parse_tree_bin_configure (KmsParseTreeBin * self, const GstCaps * caps)
gst_pad_add_probe (sink,
GST_PAD_PROBE_TYPE_BUFFER | GST_PAD_PROBE_TYPE_BUFFER_LIST,
- bitrate_calculation_probe, self, NULL);
+ (GstPadProbeCallback) bitrate_calculation_probe, self, NULL);
g_object_unref (sink);
}
