Thank you for the quick action upon my note!
I'm afraid I have a few minor notes regarding the implementation of
ImageStream in r6577. Now we don't have RingBuffer and captureThread
just overwrites #buf with one and the same instance.
- There's no synchronization on our side when reading and writing
#buf. Presuming JMF will read it when we call #transferData() is fine
and it's likely the way it will always happen. But I don't think it'll
hurt if we make it explicit because by looking at the code we
currently have one thread reading from the Buffer instance while the
other writes to it.
- There's no check in #read whether buf is null. Again, JMF will
likely not call #read before we call #transferData. I'd personally
stick to "better safe than sorry" in the case though.
- #read just keeps on reading from #buf regardless of whether it's
reading a new screen capture or an old one. Yet again, JMF will likely
not call #read without us first calling #transferData so #read will
likely always read a new screen capture. But it's not like this
behavior is explicitly stated in the JMF docs. I'd rather have #read
clear #buf once its read in order to make it obvious that we're not
providing one and the same frame multiple times.
Anyway, there are not really serious because we don't currently have a
user of ImageStream other than JMF. I wanted to note though that the
PushBufferStream interface doesn't require than one calls #read in
On Thu, Jan 7, 2010 at 1:39 PM, <firstname.lastname@example.org> wrote:
Date: 2010-01-07 11:39:09+0000
New Revision: 6577
Remove use of RingBuffer for desktop streaming.
--- trunk/src/net/java/sip/communicator/impl/neomedia/jmfext/media/protocol/imgstreaming/ImageStream.java (original)
+++ trunk/src/net/java/sip/communicator/impl/neomedia/jmfext/media/protocol/imgstreaming/ImageStream.java 2010-01-07 11:39:09+0000
@@ -15,8 +15,6 @@
@@ -74,9 +72,9 @@
private boolean started = false;
- * Buffer container.
+ * Buffer for the last image.
- private RingBuffer ringBuffer = null;
+ private Buffer buf = null;
/\*\* \* Destkop interaction \(screen capture, key press, \.\.\.\)\.
@@ -129,9 +127,6 @@
- /* get the next data */
- Buffer buf = (Buffer)ringBuffer.get();
@@ -257,7 +252,6 @@
captureThread = new Thread(this);
- ringBuffer = new RingBuffer(5);
started = true;
@@ -315,9 +309,7 @@
/* get raw bytes */
data = ImageStreamingUtils.getImageByte(scaledScreen);
- /* add it to a RingBuffer and notify JMF that new data
- * is available
+ /* notify JMF that new data is available */
@@ -328,7 +320,7 @@
buffer.setFlags(Buffer.FLAG_LIVE_DATA | Buffer.FLAG_SYSTEM_TIME);
+ buf = buffer;
/\* pass to JMF handler \*/ if\(transferHandler \!= null\)
To unsubscribe, e-mail: email@example.com
For additional commands, e-mail: firstname.lastname@example.org
To unsubscribe, e-mail: email@example.com
For additional commands, e-mail: firstname.lastname@example.org