mirror of https://github.com/sipwise/jitsi.git
- rtcp-fb nack pli support in SDP; - Add updated ffmpeg libraries; - Add missing javadoc.cusax-fix
parent
fd6b9abba9
commit
6166430740
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,13 @@
|
||||
Index: libavcodec/libx264.c
|
||||
===================================================================
|
||||
--- libavcodec/libx264.c (révision 20783)
|
||||
+++ libavcodec/libx264.c (copie de travail)
|
||||
@@ -99,7 +99,7 @@
|
||||
}
|
||||
|
||||
x4->pic.i_pts = frame->pts;
|
||||
- x4->pic.i_type = X264_TYPE_AUTO;
|
||||
+ x4->pic.i_type = frame->key_frame ? X264_TYPE_IDR : X264_TYPE_AUTO;
|
||||
}
|
||||
|
||||
if (x264_encoder_encode(x4->enc, &nal, &nnal, frame? &x4->pic: NULL, &pic_out) < 0)
|
||||
@ -0,0 +1,122 @@
|
||||
/*
|
||||
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
*/
|
||||
package net.java.sip.communicator.impl.neomedia;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.util.*;
|
||||
|
||||
import net.java.sip.communicator.service.neomedia.event.*;
|
||||
|
||||
/**
|
||||
* @author Bing SU (nova.su@gmail.com)
|
||||
* @author Lubomir Marinov
|
||||
* @author Sebastien Vincent
|
||||
*/
|
||||
public class RTCPConnectorInputStream extends RTPConnectorInputStream
|
||||
{
|
||||
/**
|
||||
* List of feedback listeners;
|
||||
*/
|
||||
private List<RTCPFeedbackListener> listeners =
|
||||
new ArrayList<RTCPFeedbackListener>();
|
||||
|
||||
/**
|
||||
* Initializes a new <tt>RTCPConnectorInputStream</tt> which is to receive
|
||||
* packet data from a specific UDP socket.
|
||||
*
|
||||
* @param socket the UDP socket the new instance is to receive data from
|
||||
*/
|
||||
public RTCPConnectorInputStream(DatagramSocket socket)
|
||||
{
|
||||
super(socket);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an <tt>RTCPFeedbackListener</tt>.
|
||||
*/
|
||||
public void addRTCPFeedbackListener(RTCPFeedbackListener listener)
|
||||
{
|
||||
if(!listeners.contains(listener))
|
||||
{
|
||||
listeners.add(listener);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removve an <tt>RTCPFeedbackListener</tt>.
|
||||
*/
|
||||
public void removeRTCPFeedbackListener(RTCPFeedbackListener listener)
|
||||
{
|
||||
if(listeners.contains(listener))
|
||||
{
|
||||
listeners.remove(listener);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies the content of the most recently received packet into
|
||||
* <tt>inBuffer</tt>.
|
||||
*
|
||||
* @param inBuffer the <tt>byte[]</tt> that we'd like to copy the content
|
||||
* of the packet to.
|
||||
* @param offset the position where we are supposed to start writing in
|
||||
* <tt>inBuffer</tt>.
|
||||
* @param length the number of <tt>byte</tt>s available for writing in
|
||||
* <tt>inBuffer</tt>.
|
||||
*
|
||||
* @return the number of bytes read
|
||||
*
|
||||
* @throws IOException if <tt>length</tt> is less than the size of the
|
||||
* packet.
|
||||
*/
|
||||
public int read(byte[] inBuffer, int offset, int length)
|
||||
throws IOException
|
||||
{
|
||||
if (ioError)
|
||||
return -1;
|
||||
|
||||
int pktLength = pkt.getLength();
|
||||
|
||||
if (length < pktLength)
|
||||
throw
|
||||
new IOException("Input buffer not big enough for " + pktLength);
|
||||
|
||||
/* check if RTCP feedback message */
|
||||
|
||||
/* Feedback message size is minimum 12 bytes:
|
||||
* Version/Padding/Feedback message type: 1 byte
|
||||
* Payload type: 1 byte
|
||||
* Length: 2 bytes
|
||||
* SSRC of packet sender: 4 bytes
|
||||
* SSRC of media source: 4 bytes
|
||||
*/
|
||||
if(pktLength >= 12)
|
||||
{
|
||||
byte data[] = pkt.getBuffer();
|
||||
int fmt = 0;
|
||||
int pt = 0;
|
||||
|
||||
/* get FMT field (last 5 bits of first byte) */
|
||||
fmt = (data[0] & 0x1F);
|
||||
pt |= (data[1] & 0xFF);
|
||||
|
||||
RTCPFeedbackEvent evt = new RTCPFeedbackEvent(this, fmt, pt);
|
||||
|
||||
/* notify feedback listeners */
|
||||
for(RTCPFeedbackListener l : listeners)
|
||||
{
|
||||
l.feedbackReceived(evt);
|
||||
}
|
||||
}
|
||||
|
||||
System.arraycopy(
|
||||
pkt.getBuffer(), pkt.getOffset(), inBuffer, offset, pktLength);
|
||||
|
||||
return pktLength;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,84 @@
|
||||
/*
|
||||
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
*/
|
||||
package net.java.sip.communicator.impl.neomedia;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import javax.media.rtp.*;
|
||||
|
||||
public class RTCPFeedbackPacket
|
||||
{
|
||||
/**
|
||||
* Feedback message type.
|
||||
*/
|
||||
private int fmt = 0;
|
||||
|
||||
/**
|
||||
* Payload type.
|
||||
*/
|
||||
private int payloadType = 0;
|
||||
|
||||
/**
|
||||
* SSRC of packet sender.
|
||||
*/
|
||||
private long senderSSRC = 0;
|
||||
|
||||
/**
|
||||
* SSRC of media source.
|
||||
*/
|
||||
private long sourceSSRC = 0;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param type feedback message type
|
||||
* @param payloadType payload type
|
||||
* @param sender sender SSRC
|
||||
* @param src source SSRC
|
||||
*/
|
||||
public RTCPFeedbackPacket(int type, int payloadType, long sender, long src)
|
||||
{
|
||||
this.fmt = type;
|
||||
this.payloadType = payloadType;
|
||||
this.senderSSRC = sender;
|
||||
this.sourceSSRC = src;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write packet to output stream.
|
||||
*
|
||||
* @param out <tt>OutputDataStream</tt>
|
||||
*/
|
||||
public void writeTo(OutputDataStream out)
|
||||
{
|
||||
byte data[] = new byte[12];
|
||||
byte vpfmt = (byte)((2 << 7) | (0 << 6) | (byte)fmt);
|
||||
|
||||
data[0] = vpfmt;
|
||||
data[1] = (byte)payloadType;
|
||||
|
||||
/* length (in 32-bit words minus one) */
|
||||
data[2] = 0;
|
||||
data[3] = 2; /* common packet is 12 bytes so (12/4) - 1 */
|
||||
|
||||
/* sender SSRC */
|
||||
data[4] = (byte)(senderSSRC >> 24);
|
||||
data[5] = (byte)((senderSSRC >> 16) & 0xFF);
|
||||
data[6] = (byte)((senderSSRC >> 8) & 0xFF);
|
||||
data[7] = (byte)(senderSSRC & 0xFF);
|
||||
|
||||
/* source SSRC */
|
||||
data[8] = (byte)(sourceSSRC >> 24);
|
||||
data[9] = (byte)((sourceSSRC >> 16) & 0xFF);
|
||||
data[10] = (byte)((sourceSSRC >> 8) & 0xFF);
|
||||
data[11] = (byte)(sourceSSRC & 0xFF);
|
||||
|
||||
/* effective write */
|
||||
out.write(data, 0, 12);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,129 @@
|
||||
/*
|
||||
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
*/
|
||||
package net.java.sip.communicator.impl.neomedia.transform;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.util.*;
|
||||
|
||||
import net.java.sip.communicator.service.neomedia.event.*;
|
||||
|
||||
/**
|
||||
* Implement control channel (RTCP) for <tt>TransformInputStream</tt>
|
||||
* which notify listeners when RTCP feedback messages are received.
|
||||
*
|
||||
* @author Bing SU (nova.su@gmail.com)
|
||||
* @author Lubomir Marinov
|
||||
* @author Sebastien Vincent
|
||||
*/
|
||||
public class ControlTransformInputStream extends TransformInputStream
|
||||
{
|
||||
/**
|
||||
* List of feedback listeners;
|
||||
*/
|
||||
private List<RTCPFeedbackListener> listeners =
|
||||
new ArrayList<RTCPFeedbackListener>();
|
||||
|
||||
/**
|
||||
* Initializes a new <tt>ControlTransformInputStream</tt> which is to
|
||||
* receive packet data from a specific UDP socket.
|
||||
*
|
||||
* @param socket the UDP socket the new instance is to receive data from
|
||||
*/
|
||||
public ControlTransformInputStream(DatagramSocket socket)
|
||||
{
|
||||
super(socket);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an <tt>RTCPFeedbackListener</tt>.
|
||||
*
|
||||
* @param listener listener to add
|
||||
*/
|
||||
public void addRTCPFeedbackListener(RTCPFeedbackListener listener)
|
||||
{
|
||||
if(!listeners.contains(listener))
|
||||
{
|
||||
listeners.add(listener);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove an <tt>RTCPFeedbackListener</tt>.
|
||||
*
|
||||
* @param listener listener to remove
|
||||
*/
|
||||
public void removeRTCPFeedbackListener(RTCPFeedbackListener listener)
|
||||
{
|
||||
if(listeners.contains(listener))
|
||||
{
|
||||
listeners.remove(listener);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies the content of the most recently received packet into
|
||||
* <tt>inBuffer</tt>.
|
||||
*
|
||||
* @param inBuffer the <tt>byte[]</tt> that we'd like to copy the content
|
||||
* of the packet to.
|
||||
* @param offset the position where we are supposed to start writing in
|
||||
* <tt>inBuffer</tt>.
|
||||
* @param length the number of <tt>byte</tt>s available for writing in
|
||||
* <tt>inBuffer</tt>.
|
||||
*
|
||||
* @return the number of bytes read
|
||||
*
|
||||
* @throws IOException if <tt>length</tt> is less than the size of the
|
||||
* packet.
|
||||
*/
|
||||
public int read(byte[] inBuffer, int offset, int length)
|
||||
throws IOException
|
||||
{
|
||||
if (ioError)
|
||||
return -1;
|
||||
|
||||
int pktLength = pkt.getLength();
|
||||
|
||||
if (length < pktLength)
|
||||
throw
|
||||
new IOException("Input buffer not big enough for " + pktLength);
|
||||
|
||||
/* check if RTCP feedback message */
|
||||
|
||||
/* Feedback message size is minimum 12 bytes:
|
||||
* Version/Padding/Feedback message type: 1 byte
|
||||
* Payload type: 1 byte
|
||||
* Length: 2 bytes
|
||||
* SSRC of packet sender: 4 bytes
|
||||
* SSRC of media source: 4 bytes
|
||||
*/
|
||||
if(pktLength >= 12)
|
||||
{
|
||||
byte data[] = pkt.getBuffer();
|
||||
int fmt = 0;
|
||||
int pt = 0;
|
||||
|
||||
/* get FMT field (last 5 bits of first byte) */
|
||||
fmt = (data[0] & 0x1F);
|
||||
pt |= (data[1] & 0xFF);
|
||||
|
||||
RTCPFeedbackEvent evt = new RTCPFeedbackEvent(this, fmt, pt);
|
||||
|
||||
/* notify feedback listeners */
|
||||
for(RTCPFeedbackListener l : listeners)
|
||||
{
|
||||
l.feedbackReceived(evt);
|
||||
}
|
||||
}
|
||||
|
||||
System.arraycopy(
|
||||
pkt.getBuffer(), pkt.getOffset(), inBuffer, offset, pktLength);
|
||||
|
||||
return pktLength;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,85 @@
|
||||
/*
|
||||
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
*/
|
||||
package net.java.sip.communicator.service.neomedia.event;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Represents an event coming from RTCP that meant to tell codec
|
||||
* to do something (i.e send a keyframe, ...).
|
||||
*
|
||||
* @author Sebastien Vincent
|
||||
*/
|
||||
public class RTCPFeedbackEvent extends EventObject
|
||||
{
|
||||
/**
|
||||
* Transport layer type (payload type).
|
||||
*/
|
||||
public static final int PT_TL = 205;
|
||||
|
||||
/**
|
||||
* Payload-specific type (payload type).
|
||||
*/
|
||||
public static final int PT_PS = 206;
|
||||
|
||||
/**
|
||||
* Picture Loss Indication message type.
|
||||
*/
|
||||
public static final int FMT_PLI = 1;
|
||||
|
||||
/**
|
||||
* Full Intra-frame Request message type.
|
||||
*/
|
||||
public static final int FMT_FIR = 4;
|
||||
|
||||
/**
|
||||
* Feedback message type.
|
||||
*/
|
||||
private int feedbackMessageType = 0;
|
||||
|
||||
/**
|
||||
* Payload type.
|
||||
*/
|
||||
private int payloadType = 0;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param src source
|
||||
* @param feedbackMessageType FMT
|
||||
* @param payloadType PT
|
||||
*/
|
||||
public RTCPFeedbackEvent(Object src, int feedbackMessageType,
|
||||
int payloadType)
|
||||
{
|
||||
super(src);
|
||||
|
||||
this.feedbackMessageType = feedbackMessageType;
|
||||
this.payloadType = payloadType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get feedback message type.
|
||||
*
|
||||
* @return message type
|
||||
*/
|
||||
public int getFeedbackMessageType()
|
||||
{
|
||||
return feedbackMessageType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get payload type of RTCP packet.
|
||||
*
|
||||
* @return payload type
|
||||
*/
|
||||
public int getPayloadType()
|
||||
{
|
||||
return payloadType;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
*/
|
||||
package net.java.sip.communicator.service.neomedia.event;
|
||||
|
||||
/**
|
||||
* <tt>RTCPFeedbackListener</tt> is used by codec to be notified
|
||||
* by RTCP feedback event such as PLI (Picture Loss Indication) or
|
||||
* FIR (Full Intra-frame Request).
|
||||
*
|
||||
* @author Sebastien Vincent
|
||||
*/
|
||||
public interface RTCPFeedbackListener
|
||||
{
|
||||
/**
|
||||
* Event fired when RTCP feedback message is received.
|
||||
*
|
||||
* @param event <tt>RTCPFeedbackEvent</tt>
|
||||
*/
|
||||
public void feedbackReceived(RTCPFeedbackEvent event);
|
||||
}
|
||||
|
||||
Loading…
Reference in new issue