[sip-comm-dev] FW: [JMF Bugs] When removing video from an audio/video session, audio stops but the opposite works !


#1

FYI

Yes, this is a known bug. The reason that this happens is that the video

is trying to synchronize to any audio stream with the same cname. This
typically happens with streams coming from the same machine.
Unfortunately, after it finds an audio stream to synchronize to, which
happens to stop receiving, the video stream blocks waiting for updates
to the audio stream.

There is a workaround for this, although not trivial to implement. You
will have to insert a filter into the video decoding chain that removes
the header from the Buffer object (since the header contains the cname).

I've attached such a filter. One caveat is that this filter will reduce
video rendering performance if you have a slower machine.

Also see the following link for how to insert filters into the chain...

http://java.sun.com/products/java-media/jmf/2.1.1/solutions/FrameAccess.
html

Hope that helps.

Amith

Laurent ADROIT wrote:

Synopsis: When removing video from an audio/video session, audio

stops but the opposite works !

Name: Laurent ADROIT
E-mail Address:

Comment:

Hello,

I might have found a bug ...

Let's see the scenarios :

#1)
Session audio + video. The 2 streams are handled by 2 separated

RTPManager and added with addTarget methods.

UnSync.java (4.06 KB)

···

-----Original Message-----

Now, the video is removed (removeTarget). The audio remains. Perfect.
Now, the video is added again (addTarget). It works perfectly as well.

#2)
Session audio + video. The 2 streams are handled by 2 separated
RTPManager.

Now, the audio is removed (removeTarget). BUT the video stops as well.
And the video shouldn't stop but continue.

Please give some feedback whether it's a real bug or not. Indeed, I am
struggling at removing the audio stream without stopping the audio.

Thank-you very much in advance,
Laurent ADROIT

Configuration:

Windows XP Pro
SIP Communicator with JMF 2.x (I don't know exactly the version)


#2

Nice catch Laurent,

I'll try to keep that in mind.
Unfortunately I don't see myself getting down to it in the near future. so if you decide to contribute it'd be gladly accepted :slight_smile:

Emil

zze-ADROIT Laurent FTRD/DMR/LON wrote:

···

FYI

-----Original Message-----

Yes, this is a known bug. The reason that this happens is that the video

is trying to synchronize to any audio stream with the same cname. This typically happens with streams coming from the same machine. Unfortunately, after it finds an audio stream to synchronize to, which happens to stop receiving, the video stream blocks waiting for updates to the audio stream.

There is a workaround for this, although not trivial to implement. You will have to insert a filter into the video decoding chain that removes the header from the Buffer object (since the header contains the cname).

I've attached such a filter. One caveat is that this filter will reduce video rendering performance if you have a slower machine.

Also see the following link for how to insert filters into the chain...

http://java.sun.com/products/java-media/jmf/2.1.1/solutions/FrameAccess.
html

Hope that helps.

Amith

Laurent ADROIT wrote:

Synopsis: When removing video from an audio/video session, audio

stops but the opposite works !

Name: Laurent ADROIT
E-mail Address:

Comment:

Hello,

I might have found a bug ...

Let's see the scenarios :

#1)
Session audio + video. The 2 streams are handled by 2 separated

RTPManager and added with addTarget methods.

Now, the video is removed (removeTarget). The audio remains. Perfect. Now, the video is added again (addTarget). It works perfectly as well.

#2)
Session audio + video. The 2 streams are handled by 2 separated RTPManager.

Now, the audio is removed (removeTarget). BUT the video stops as well. And the video shouldn't stop but continue.

Please give some feedback whether it's a real bug or not. Indeed, I am struggling at removing the audio stream without stopping the audio.

Thank-you very much in advance,
Laurent ADROIT

Configuration:

Windows XP Pro
SIP Communicator with JMF 2.x (I don't know exactly the version)

------------------------------------------------------------------------

/*
* @(#)UnSync.java 1.1 03/09/19
*
* Copyright (c) 1999-2004 Sun Microsystems, Inc. All Rights Reserved.
*
* Sun grants you ("Licensee") a non-exclusive, royalty free, license to use,
* modify and redistribute this software in source and binary code form,
* provided that i) this copyright notice and license appear on all copies of
* the software; and ii) Licensee does not utilize the software in a manner
* which is disparaging to Sun.
*
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
* IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE
* LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
* OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS
* LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
* INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
* CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
* OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*
* This software is not designed or intended for use in on-line control of
* aircraft, air traffic, aircraft navigation or aircraft communications; or in
* the design, construction, operation or maintenance of any nuclear
* facility. Licensee represents and warrants that it will not use or
* redistribute the Software for such purposes.
*/

package allhands;

import java.awt.*;
import javax.media.*;
import javax.media.control.TrackControl;
import javax.media.Format;
import javax.media.format.*;

/**
* Sample program to access individual video frames by using a * "pass-thru" codec. The codec is inserted into the data flow
* path. As data pass through this codec, it removes RTP header information.
*/
public class UnSync implements Codec {

    /**
     * The code for a pass through codec.
     */
        // We'll advertize as supporting all video formats.
    protected Format supportedIns[] = new Format [] {
  new RGBFormat()
    };
        // We'll advertize as supporting all video formats.
    protected Format supportedOuts[] = new Format [] {
  new RGBFormat()
    };
        Format input = null, output = null;
        public String getName() {
  return "UnSync Codec";
    }
        // No op.
    public void open() {
    }
        // No op.
    public void close() {
    }
        // No op.
    public void reset() {
    }
        public Format [] getSupportedInputFormats() {
  return supportedIns;
    }
        public Format [] getSupportedOutputFormats(Format in) {
  if (in == null)
      return supportedOuts;
  else {
      // If an input format is given, we use that input format
      // as the output since we are not modifying the bit stream
      // at all.
      Format outs[] = new Format[1];
      outs[0] = in;
      return outs;
  }
    }
        public Format setInputFormat(Format format) {
  input = format;
  return input;
    }
        public Format setOutputFormat(Format format) {
  output = format;
  return output;
    }
        public int process(Buffer in, Buffer out) {
  
  // Swap the data between the input & output.
  // This undoes native byte array transfer optimization
  Object data = in.getData();
  in.setData(out.getData());
  out.setData(data);
  
  // Copy the input attributes to the output
  out.setFormat(in.getFormat());
  out.setLength(in.getLength());
  out.setOffset(in.getOffset());
  out.setTimeStamp(0);
  // Render all video as soon as it is decoded. Do not sync to audio.
  out.setFlags(Buffer.FLAG_NO_SYNC | Buffer.FLAG_NO_WAIT);
  out.setSequenceNumber(in.getSequenceNumber());
  // Remove any RTP header
  out.setHeader(null);
  return BUFFER_PROCESSED_OK;
    }
        public Object[] getControls() {
  return new Object[0];
    }
        public Object getControl(String type) {
  return null;
    }
}

------------------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net