[jitsi-dev] Re: [jitsi~svn:9674] Enables to move the desktop sharing region.


#1

Hey Vincent,

I'm afraid I'll need to bother you again with a plea for a very short description with respect to the modifications given bellow. Could we please keep the cloning support in VideoMediaDeviceSession#createCaptureDevice() only? Why are you explicitly implementing the mute support?

Best regards,
Lyubomir

На 26.06.12 13:36, vincent_lucas@java.net написа:

···

Project: jitsi
Repository: svn
Revision: 9674
Author: vincent_lucas
Date: 2012-06-26 10:36:10 UTC
Link:

Log Message:
------------
Enables to move the desktop sharing region.

Modified Paths:
---------------
trunk/src/net/java/sip/communicator/impl/neomedia/jmfext/media/protocol/imgstreaming/DataSource.java

Index: trunk/src/net/java/sip/communicator/impl/neomedia/jmfext/media/protocol/imgstreaming/DataSource.java

--- trunk/src/net/java/sip/communicator/impl/neomedia/jmfext/media/protocol/imgstreaming/DataSource.java (revision 9673)
+++ trunk/src/net/java/sip/communicator/impl/neomedia/jmfext/media/protocol/imgstreaming/DataSource.java (revision 9674)
@@ -8,9 +8,13 @@
    import javax.media.*;
  import javax.media.control.*;
+import javax.media.protocol.*;
    import net.java.sip.communicator.impl.neomedia.jmfext.media.protocol.*;
+import net.java.sip.communicator.impl.neomedia.protocol.*;
  +import net.sf.fmj.media.protocol.*;
+
  /**
   * Implements <tt>CaptureDevice</tt> and <tt>DataSource</tt> for the purposes of
   * image and desktop streaming.
@@ -21,6 +25,8 @@
   */
  public class DataSource
      extends AbstractVideoPullBufferCaptureDevice
+ implements MuteDataSource,
+ SourceCloneable
  {
      /**
       * Stream created.
@@ -28,6 +34,12 @@
      private ImageStream stream = null;
        /**
+ * The cloneable representation of this DataSource.
+ */
+ private CloneableCaptureDevicePullBufferDataSource cloneableDataSource
+ = null;
+
+ /**
       * Initializes a new <tt>DataSource</tt> instance.
       */
      public DataSource()
@@ -111,4 +123,46 @@
          this.stream = stream;
          return stream;
      }
+
+ /**
+ * Determines whether this <tt>DataSource</tt> is mute.
+ *
+ * An image / desktop sharing does not send any
+ * sounds. Thus it is always mute (returns always true).
+ *
+ * @return <tt>true</tt> since this <tt>DataSource</tt> is always mute.
+ */
+ public boolean isMute()
+ {
+ return true;
+ }
+
+ /**
+ * Sets the mute state of this <tt>DataSource</tt>.
+ *
+ * Does not change anything, since image /
+ * desktop sharing does not send any sounds. Thus it is always mute.
+ *
+ * @param mute <tt>true</tt> to mute this <tt>DataSource</tt>; otherwise,
+ * <tt>false</tt>
+ */
+ public void setMute(boolean mute)
+ {
+ }
+
+ /**
+ * Based on JMF testing, the clone is in the same state as the original
+ * (opened and connected if the original is), but at the beginning of the
+ * media, not whatever position the original is.
+ */
+ public javax.media.protocol.DataSource createClone()
+ {
+ if(this.cloneableDataSource == null)
+ {
+ this.cloneableDataSource
+ = new CloneableCaptureDevicePullBufferDataSource(this);
+ }
+
+ return this.cloneableDataSource.createClone();
+ }
  }


#2

Hey Lyubomir,

Hey Vincent,

I'm afraid I'll need to bother you again with a plea for a very short
description with respect to the modifications given bellow.

No problem, you are welcome.

Could we

please keep the cloning support in
VideoMediaDeviceSession#createCaptureDevice() only?

For this point, I may need your help:

- My goal was to permit VideoMediaStreamImpl#movePartialDesktopStreaming to detect the DataSource (ds) as a net.java.sip.communicator.impl.neomedia.jmfext.media.protocol.imgstreaming.DataSource.

- Although, if the DataSource (from imgstreaming) is encapsulated into a cloneable device with Manager.createCloneableDataSource(captureDevice), then I do not know any way (and this is the point you can help me) to still detect it as a imgstreaming.DataSource.

Why are you

explicitly implementing the mute support?

The mute support is because the imgstreaming.DataSource is first encapsulated into a RewritablePullBufferDataSource and only thereafter into a SourceCloneable:

- The encapsulation into a RewritablePullBufferDataSource is not a problem for the VideoMediaStreamImpl#movePartialDesktopStreaming since we can access to the imgstreaming.DataSource with the
getWrappedDataSource() method.

- But (if you consider that the imgstreaming.DataSource is SourceCloneable) the pre-encapsulation hide the SourceCloneable capability to the VideoMediaDeviceSession#createCaptureDevice() and thus incudes this re-encapsulation.

To conclude, the mute support may be removed if we can manage the SourceCloneable encapsulation in a different manner (but I do not know how). Moreover, this encapsulation into a SourceCloneable is a little bit tricky situation, since it modifies other code detection (made by ugly instanceof) like the one for displaying the local video as a desktop icon and not the video stream.

Extra-point, I am sure the response is no, but: Does the imgstreaming.DataSource must be SourceCloneable?

Best regards,
Vincent

···

On 06/28/2012 02:55 PM, Lyubomir Marinov wrote:

Best regards,
Lyubomir

На 26.06.12 13:36, vincent_lucas@java.net написа:

Project: jitsi
Repository: svn
Revision: 9674
Author: vincent_lucas
Date: 2012-06-26 10:36:10 UTC
Link:

Log Message:
------------
Enables to move the desktop sharing region.

Modified Paths:
---------------
trunk/src/net/java/sip/communicator/impl/neomedia/jmfext/media/protocol/imgstreaming/DataSource.java

Index:
trunk/src/net/java/sip/communicator/impl/neomedia/jmfext/media/protocol/imgstreaming/DataSource.java

===================================================================
---
trunk/src/net/java/sip/communicator/impl/neomedia/jmfext/media/protocol/imgstreaming/DataSource.java
(revision 9673)
+++
trunk/src/net/java/sip/communicator/impl/neomedia/jmfext/media/protocol/imgstreaming/DataSource.java
(revision 9674)
@@ -8,9 +8,13 @@
import javax.media.*;
import javax.media.control.*;
+import javax.media.protocol.*;
import net.java.sip.communicator.impl.neomedia.jmfext.media.protocol.*;
+import net.java.sip.communicator.impl.neomedia.protocol.*;
+import net.sf.fmj.media.protocol.*;
+
/**
* Implements <tt>CaptureDevice</tt> and <tt>DataSource</tt> for the
purposes of
* image and desktop streaming.
@@ -21,6 +25,8 @@
*/
public class DataSource
extends AbstractVideoPullBufferCaptureDevice
+ implements MuteDataSource,
+ SourceCloneable
{
/**
* Stream created.
@@ -28,6 +34,12 @@
private ImageStream stream = null;
/**
+ * The cloneable representation of this DataSource.
+ */
+ private CloneableCaptureDevicePullBufferDataSource cloneableDataSource
+ = null;
+
+ /**
* Initializes a new <tt>DataSource</tt> instance.
*/
public DataSource()
@@ -111,4 +123,46 @@
this.stream = stream;
return stream;
}
+
+ /**
+ * Determines whether this <tt>DataSource</tt> is mute.
+ *
+ * An image / desktop sharing does not send any
+ * sounds. Thus it is always mute (returns always true).
+ *
+ * @return <tt>true</tt> since this <tt>DataSource</tt> is always mute.
+ */
+ public boolean isMute()
+ {
+ return true;
+ }
+
+ /**
+ * Sets the mute state of this <tt>DataSource</tt>.
+ *
+ * Does not change anything, since image /
+ * desktop sharing does not send any sounds. Thus it is always mute.
+ *
+ * @param mute <tt>true</tt> to mute this <tt>DataSource</tt>;
otherwise,
+ * <tt>false</tt>
+ */
+ public void setMute(boolean mute)
+ {
+ }
+
+ /**
+ * Based on JMF testing, the clone is in the same state as the original
+ * (opened and connected if the original is), but at the beginning of
the
+ * media, not whatever position the original is.
+ */
+ public javax.media.protocol.DataSource createClone()
+ {
+ if(this.cloneableDataSource == null)
+ {
+ this.cloneableDataSource
+ = new CloneableCaptureDevicePullBufferDataSource(this);
+ }
+
+ return this.cloneableDataSource.createClone();
+ }
}

--
Vincent Lucas, Ph.D. Jitsi developer
chenzo@jitsi.org http://jitsi.org


#3

Vincent, thank you very much for your prompt response!

На 28.06.12 16:45, Vincent Lucas написа:

Could we

please keep the cloning support in
VideoMediaDeviceSession#createCaptureDevice() only?

For this point, I may need your help:

- My goal was to permit VideoMediaStreamImpl#movePartialDesktopStreaming to detect the DataSource (ds) as a net.java.sip.communicator.impl.neomedia.jmfext.media.protocol.imgstreaming.DataSource.

- Although, if the DataSource (from imgstreaming) is encapsulated into a cloneable device with Manager.createCloneableDataSource(captureDevice), then I do not know any way (and this is the point you can help me) to still detect it as a imgstreaming.DataSource.

I understand. In that case, I'd suggest exposing the method needed by VideoMediaStreamImpl#movePartialDesktopStreaming as an FMJ/JMF control on the DataSource. The javax.media.protocol.DataSource class implements the javax.media.protocol.Controls interface which allows one to request a control of a specific type from a DataSource instance and this functionality is usually delegated from the wrapping DataSource to the wrapped DataSource. Besides, casting to net.java.sip.communicator.impl.neomedia.jmfext.media.protocol.imgstreaming.DataSource inside VideoMediaStreamImpl bothers me a bit because there is no such class on Android (and we'd like to merge the Java and Android code bases at least with respect to neomedia).

Why are you

explicitly implementing the mute support?

The mute support is because the imgstreaming.DataSource is first encapsulated into a RewritablePullBufferDataSource and only thereafter into a SourceCloneable:

- The encapsulation into a RewritablePullBufferDataSource is not a problem for the VideoMediaStreamImpl#movePartialDesktopStreaming since we can access to the imgstreaming.DataSource with the
getWrappedDataSource() method.

- But (if you consider that the imgstreaming.DataSource is SourceCloneable) the pre-encapsulation hide the SourceCloneable capability to the VideoMediaDeviceSession#createCaptureDevice() and thus incudes this re-encapsulation.

To conclude, the mute support may be removed if we can manage the SourceCloneable encapsulation in a different manner (but I do not know how). Moreover, this encapsulation into a SourceCloneable is a little bit tricky situation, since it modifies other code detection (made by ugly instanceof) like the one for displaying the local video as a desktop icon and not the video stream.

If we expose the method needed by VideoMediaStreamImpl#movePartialDesktopStreaming as an FMJ/JMF control on the DataSource, neither the mute nor the cloning functionality will need to be explicitly implemented for the imgstreaming DataSource.

Extra-point, I am sure the response is no, but: Does the imgstreaming.DataSource must be SourceCloneable?

As far as I know, there shouldn't be such a requirement. Besides, that's why I started this discussion in the first place.


#4

Hi Lyubomir,

Thank you very much for your help (comments inline).

[...]

I understand. In that case, I'd suggest exposing the method needed by
VideoMediaStreamImpl#movePartialDesktopStreaming as an FMJ/JMF control
on the DataSource. The javax.media.protocol.DataSource class implements
the javax.media.protocol.Controls interface which allows one to request
a control of a specific type from a DataSource instance and this
functionality is usually delegated from the wrapping DataSource to the
wrapped DataSource.

Your advice is taken into account by svn revision #9682. The "imgstreaming.DataSource" does no more implement neither the "MuteDataSource", not the "SourceCloneable" interface, but the "Controls" one. Just tell me if this is way of using "Controls" is correct.

Besides, casting to

net.java.sip.communicator.impl.neomedia.jmfext.media.protocol.imgstreaming.DataSource
inside VideoMediaStreamImpl bothers me a bit because there is no such
class on Android (and we'd like to merge the Java and Android code bases
at least with respect to neomedia).

This cast was historically there and unfortunately it is still used with the "Controls" implementation. But, I do not know if it can be useful, the use of
net.java.sip.communicator.impl.neomedia.jmfext.media.protocol.imgstreaming.DataSource.java
can be easily replaced with a
net.java.sip.communicator.impl.neomedia.jmfext.media.protocol.imgstreaming.ImageStream.java.

Regards,
Vincent

···

On 06/28/2012 04:26 PM, Lyubomir Marinov wrote:

--
Vincent Lucas, Ph.D. Jitsi developer
chenzo@jitsi.org http://jitsi.org