avdtpsrc: Fix transport-volume write
authorJochen Henneberg <jh@henneberg-systemdesign.com>
Fri, 9 Nov 2018 15:16:46 +0000 (15:16 +0000)
committerSebastian Dröge <slomo@coaxion.net>
Mon, 12 Nov 2018 08:00:26 +0000 (08:00 +0000)
If properties are proxied through GBinding this can work only if the
proxied property keeps it's own value. The previous implementation will
read the original value if the proxied property signals a change and
thus nothing will happen.

sys/bluez/gstavdtpsrc.c
sys/bluez/gstavdtpsrc.h

index cf427ec..5013230 100644 (file)
@@ -36,6 +36,8 @@
 GST_DEBUG_CATEGORY_STATIC (avdtpsrc_debug);
 #define GST_CAT_DEFAULT (avdtpsrc_debug)
 
+#define DEFAULT_VOLUME 127
+
 enum
 {
   PROP_0,
@@ -106,7 +108,7 @@ gst_avdtp_src_class_init (GstAvdtpSrcClass * klass)
       g_param_spec_uint ("transport-volume",
           "Transport volume",
           "Volume of the transport (only valid if transport is acquired)",
-          0, 127, 127, G_PARAM_READWRITE));
+          0, 127, DEFAULT_VOLUME, G_PARAM_READWRITE));
 
   gst_element_class_set_static_metadata (element_class,
       "Bluetooth AVDTP Source",
@@ -127,6 +129,7 @@ gst_avdtp_src_init (GstAvdtpSrc * avdtpsrc)
   avdtpsrc->poll = gst_poll_new (TRUE);
 
   avdtpsrc->duration = GST_CLOCK_TIME_NONE;
+  avdtpsrc->transport_volume = DEFAULT_VOLUME;
 
   gst_base_src_set_format (GST_BASE_SRC (avdtpsrc), GST_FORMAT_TIME);
   gst_base_src_set_live (GST_BASE_SRC (avdtpsrc), TRUE);
@@ -157,8 +160,7 @@ gst_avdtp_src_get_property (GObject * object, guint prop_id,
       break;
 
     case PROP_TRANSPORT_VOLUME:
-      g_value_set_uint (value,
-          gst_avdtp_connection_get_volume (&avdtpsrc->conn));
+      g_value_set_uint (value, avdtpsrc->transport_volume);
       break;
 
     default:
@@ -180,7 +182,7 @@ gst_avdtp_src_set_property (GObject * object, guint prop_id,
       break;
 
     case PROP_TRANSPORT_VOLUME:
-      /* This is no-op because setting is handled via a GBinding */
+      avdtpsrc->transport_volume = g_value_get_uint (value);
       break;
 
     default:
index 334ff15..34a2697 100644 (file)
@@ -62,6 +62,8 @@ struct _GstAvdtpSrc
   volatile gint unlocked;
 
   GstClockTime duration;
+
+  guint transport_volume;
 };
 
 GType gst_avdtp_src_get_type (void);