Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add event type & source to "multiple listeners" warning #80

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions gst/interpipe/gstinterpipeinode.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,15 @@ gst_inter_pipe_inode_remove_listener (GstInterPipeINode * self,
}

gboolean
gst_inter_pipe_inode_receive_event (GstInterPipeINode * self, GstEvent * event)
gst_inter_pipe_inode_receive_event (GstInterPipeINode * self, GstInterPipeIListener * listener, GstEvent * event)
{
GstInterPipeINodeInterface *iface;

g_return_val_if_fail (GST_INTER_PIPE_IS_INODE (self), FALSE);
g_return_val_if_fail (listener != NULL, FALSE);

iface = GST_INTER_PIPE_INODE_GET_IFACE (self);
g_return_val_if_fail (iface->receive_event != NULL, FALSE);

return iface->receive_event (self, event);
return iface->receive_event (self, listener, event);
}
4 changes: 2 additions & 2 deletions gst/interpipe/gstinterpipeinode.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ struct _GstInterPipeINodeInterface

gboolean (* add_listener) (GstInterPipeINode *iface, GstInterPipeIListener * listener);
gboolean (* remove_listener) (GstInterPipeINode *iface, GstInterPipeIListener * listener);
gboolean (* receive_event) (GstInterPipeINode *iface, GstEvent *event);
gboolean (* receive_event) (GstInterPipeINode *iface, GstInterPipeIListener * listener, GstEvent *event);
};

/**
Expand Down Expand Up @@ -102,7 +102,7 @@ gboolean gst_inter_pipe_inode_remove_listener (GstInterPipeINode *iface, GstInte
*
* Returns: True if the node is able to receive the event, False otherwise.
*/
gboolean gst_inter_pipe_inode_receive_event (GstInterPipeINode *iface, GstEvent *event);
gboolean gst_inter_pipe_inode_receive_event (GstInterPipeINode *iface, GstInterPipeIListener * listener, GstEvent *event);

GType gst_inter_pipe_inode_get_type (void);

Expand Down
11 changes: 7 additions & 4 deletions gst/interpipe/gstinterpipesink.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ static gboolean gst_inter_pipe_sink_add_listener (GstInterPipeINode * iface,
static gboolean gst_inter_pipe_sink_remove_listener (GstInterPipeINode * iface,
GstInterPipeIListener * listener);
static gboolean gst_inter_pipe_sink_receive_event (GstInterPipeINode * iface,
GstEvent * event);
GstInterPipeIListener * listener, GstEvent * event);
static GstCaps *gst_inter_pipe_sink_get_caps (GstBaseSink * base,
GstCaps * filter);
static gboolean gst_inter_pipe_sink_set_caps (GstBaseSink * base,
Expand Down Expand Up @@ -870,7 +870,7 @@ gst_inter_pipe_sink_remove_listener (GstInterPipeINode * iface,
}

static gboolean
gst_inter_pipe_sink_receive_event (GstInterPipeINode * iface, GstEvent * event)
gst_inter_pipe_sink_receive_event (GstInterPipeINode * iface, GstInterPipeIListener * listener, GstEvent * event)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a pointer guard for listener. And, incidentally, could you add one for event as well?

{
GstInterPipeSink *self;
GHashTable *listeners;
Expand All @@ -889,8 +889,11 @@ gst_inter_pipe_sink_receive_event (GstInterPipeINode * iface, GstEvent * event)

multiple_listeners:
{
GST_WARNING_OBJECT (self, "Could not send event upstream, "
"more than one listener is connected");
gchar* evtype = g_ascii_strup(GST_EVENT_TYPE_NAME(event), -1);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest just using GST_EVENT_TYPE_NAME(event) directly instead of dropping the case and needing to free later.

GST_WARNING_OBJECT (self,
"Could not send %s event from %s upstream, more than one listener is connected",
evtype, gst_inter_pipe_ilistener_get_name(listener));
g_free(evtype);
return FALSE;
}
}
2 changes: 1 addition & 1 deletion gst/interpipe/gstinterpipesrc.c
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ gst_inter_pipe_src_event (GstBaseSrc * base, GstEvent * event)
GST_EVENT_TYPE_NAME (event));

if (node) {
gst_inter_pipe_inode_receive_event (node, gst_event_ref (event));
gst_inter_pipe_inode_receive_event (node, GST_INTER_PIPE_ILISTENER (src), gst_event_ref (event));
} else
GST_WARNING_OBJECT (src, "Node doesn't exist, event won't be forwarded");
}
Expand Down