From 4f0dc8cf5841e68e29fd71fadbbeb61cc62a76f0 Mon Sep 17 00:00:00 2001 From: Andre Guedes Date: Fri, 4 Oct 2019 11:17:22 -0700 Subject: [PATCH] avtpsink: Prepare code to new synchronization mechanism This patch refactors gst_avtp_sink_start() by moving all socket initialization code to its own function. This change prepares the code to the next patch which will introduce avtpsink's own rendering synchronization mechanism. --- ext/avtp/gstavtpsink.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/ext/avtp/gstavtpsink.c b/ext/avtp/gstavtpsink.c index 6a4591b..017d659 100644 --- a/ext/avtp/gstavtpsink.c +++ b/ext/avtp/gstavtpsink.c @@ -205,13 +205,12 @@ gst_avtp_sink_get_property (GObject * object, guint prop_id, } static gboolean -gst_avtp_sink_start (GstBaseSink * basesink) +gst_avtp_sink_init_socket (GstAvtpSink * avtpsink) { int fd, res; unsigned int index; guint8 addr[ETH_ALEN]; struct sockaddr_ll sk_addr; - GstAvtpSink *avtpsink = GST_AVTP_SINK (basesink); index = if_nametoindex (avtpsink->ifname); if (!index) { @@ -251,7 +250,6 @@ gst_avtp_sink_start (GstBaseSink * basesink) avtpsink->sk_fd = fd; avtpsink->sk_addr = sk_addr; - GST_DEBUG_OBJECT (avtpsink, "AVTP sink started"); return TRUE; err: @@ -260,6 +258,19 @@ err: } static gboolean +gst_avtp_sink_start (GstBaseSink * basesink) +{ + GstAvtpSink *avtpsink = GST_AVTP_SINK (basesink); + + if (!gst_avtp_sink_init_socket (avtpsink)) + return FALSE; + + GST_DEBUG_OBJECT (avtpsink, "AVTP sink started"); + + return TRUE; +} + +static gboolean gst_avtp_sink_stop (GstBaseSink * basesink) { GstAvtpSink *avtpsink = GST_AVTP_SINK (basesink); -- 2.7.4