From 508c257b08172613b93ee5a062827630446f275f Mon Sep 17 00:00:00 2001
From: Lyubomir Marinov <lyubomir.marinov@jitsi.org>
Date: Fri, 18 Oct 2013 12:24:58 +0300
Subject: [PATCH] Allows MuteDataSource (and InbandDTMFDataSource) from
 RewritablePull/PushBufferDataSource to penetrate SourceCloneable.

---
 .../RewritablePullBufferDataSource.java       | 20 +++++++++++++------
 .../RewritablePushBufferDataSource.java       | 20 +++++++++++++------
 2 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/src/org/jitsi/impl/neomedia/protocol/RewritablePullBufferDataSource.java b/src/org/jitsi/impl/neomedia/protocol/RewritablePullBufferDataSource.java
index 563dbab1..4930b75e 100644
--- a/src/org/jitsi/impl/neomedia/protocol/RewritablePullBufferDataSource.java
+++ b/src/org/jitsi/impl/neomedia/protocol/RewritablePullBufferDataSource.java
@@ -118,12 +118,20 @@ public PullBufferDataSource getWrappedDataSource()
     @Override
     public Object getControl(String controlType)
     {
-        /*
-         * The super implements a delegate so we can be sure that it delegates
-         * the invocation of Controls#getControl(String) to the wrapped
-         * dataSource.
-         */
-        return AbstractControls.queryInterface(dataSource, controlType);
+        if (InbandDTMFDataSource.class.getName().equals(controlType)
+                || MuteDataSource.class.getName().equals(controlType))
+        {
+            return this;
+        }
+        else
+        {
+            /*
+             * The super implements a delegate so we can be sure that it
+             * delegates the invocation of Controls#getControl(String) to the
+             * wrapped dataSource.
+             */
+            return AbstractControls.queryInterface(dataSource, controlType);
+        }
     }
 
     /**
diff --git a/src/org/jitsi/impl/neomedia/protocol/RewritablePushBufferDataSource.java b/src/org/jitsi/impl/neomedia/protocol/RewritablePushBufferDataSource.java
index 66ee434f..cf0170c1 100644
--- a/src/org/jitsi/impl/neomedia/protocol/RewritablePushBufferDataSource.java
+++ b/src/org/jitsi/impl/neomedia/protocol/RewritablePushBufferDataSource.java
@@ -68,12 +68,20 @@ public RewritablePushBufferDataSource(PushBufferDataSource dataSource)
     @Override
     public Object getControl(String controlType)
     {
-        /*
-         * The super implements a delegate so we can be sure that it delegates
-         * the invocation of Controls#getControl(String) to the wrapped
-         * dataSource.
-         */
-        return AbstractControls.queryInterface(dataSource, controlType);
+        if (InbandDTMFDataSource.class.getName().equals(controlType)
+                || MuteDataSource.class.getName().equals(controlType))
+        {
+            return this;
+        }
+        else
+        {
+            /*
+             * The super implements a delegate so we can be sure that it
+             * delegates the invocation of Controls#getControl(String) to the
+             * wrapped dataSource.
+             */
+            return AbstractControls.queryInterface(dataSource, controlType);
+        }
     }
 
     /**
-- 
GitLab