aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java
diff options
context:
space:
mode:
authorLyubomir Marinov <lyubomir.marinov@jitsi.org>2010-05-18 20:34:09 +0000
committerLyubomir Marinov <lyubomir.marinov@jitsi.org>2010-05-18 20:34:09 +0000
commite5dca5d66b0641a1a1bde355f86f53d41e3b7ae5 (patch)
tree4a2a2d30e8d64c20aab0102059409dba266b2122 /src/net/java
parent537a176b286163a6536cd7dd6c8344c28e3c040e (diff)
downloadjitsi-e5dca5d66b0641a1a1bde355f86f53d41e3b7ae5.zip
jitsi-e5dca5d66b0641a1a1bde355f86f53d41e3b7ae5.tar.gz
jitsi-e5dca5d66b0641a1a1bde355f86f53d41e3b7ae5.tar.bz2
Commits an initial version of a native VideoRenderer i.e. JAWTRenderer on Linux using the XVideo extension of the X Window System.
Diffstat (limited to 'src/net/java')
-rw-r--r--src/net/java/sip/communicator/impl/neomedia/codec/video/SwScaler.java54
-rw-r--r--src/net/java/sip/communicator/impl/neomedia/device/VideoMediaDeviceSession.java8
-rw-r--r--src/net/java/sip/communicator/impl/neomedia/jmfext/media/renderer/video/JAWTRenderer.java27
3 files changed, 77 insertions, 12 deletions
diff --git a/src/net/java/sip/communicator/impl/neomedia/codec/video/SwScaler.java b/src/net/java/sip/communicator/impl/neomedia/codec/video/SwScaler.java
index 2d48190..c4e1602 100644
--- a/src/net/java/sip/communicator/impl/neomedia/codec/video/SwScaler.java
+++ b/src/net/java/sip/communicator/impl/neomedia/codec/video/SwScaler.java
@@ -33,6 +33,12 @@ public class SwScaler
private static final Logger logger = Logger.getLogger(SwScaler.class);
/**
+ * The indicator which determines whether this scaler will attempt to keep
+ * the width and height of YUV 420 output even.
+ */
+ private final boolean fixOddYuv420Size;
+
+ /**
* The <tt>FrameProcessingControl</tt> of this <tt>Codec</tt> which allows
* JMF to instruct it to drop frames because it's behind schedule.
*/
@@ -70,6 +76,20 @@ public class SwScaler
*/
public SwScaler()
{
+ this(false);
+ }
+
+ /**
+ * Initializes a new <tt>SwScaler</tt> instance which can optionally attempt
+ * to keep the width and height of YUV 420 output even.
+ *
+ * @param fixOddYuv420Size <tt>true</tt> to keep the width and height of YUV
+ * 420 output even; otherwise, <tt>false</tt>
+ */
+ protected SwScaler(boolean fixOddYuv420Size)
+ {
+ this.fixOddYuv420Size = fixOddYuv420Size;
+
inputFormats = new Format[]
{
new AVFrameFormat(),
@@ -365,8 +385,6 @@ public class SwScaler
}
else
{
-//System.err.println(
-// "SwScaler.process: srcPicture= 0x" + Long.toHexString(srcPicture));
FFmpeg.sws_scale(
swsContext,
srcPicture, 0, inputHeight,
@@ -437,6 +455,38 @@ public class SwScaler
@Override
public Format setOutputFormat(Format format)
{
+ if (fixOddYuv420Size && (format instanceof YUVFormat))
+ {
+ YUVFormat yuvFormat = (YUVFormat) format;
+
+ if (YUVFormat.YUV_420 == yuvFormat.getYuvType())
+ {
+ Dimension size = yuvFormat.getSize();
+
+ if ((size != null) && (size.width > 2) && (size.height > 2))
+ {
+ int width = (size.width >> 1) << 1;
+ int height = (size.height >> 1) << 1;
+
+ if ((width != size.width) || (height != size.height))
+ {
+ format
+ = new YUVFormat(
+ new Dimension(width, height),
+ Format.NOT_SPECIFIED,
+ yuvFormat.getDataType(),
+ yuvFormat.getFrameRate(),
+ yuvFormat.getYuvType(),
+ Format.NOT_SPECIFIED,
+ Format.NOT_SPECIFIED,
+ 0,
+ Format.NOT_SPECIFIED,
+ Format.NOT_SPECIFIED);
+ }
+ }
+ }
+ }
+
Format outputFormat = super.setOutputFormat(format);
if (logger.isDebugEnabled() && (outputFormat != null))
diff --git a/src/net/java/sip/communicator/impl/neomedia/device/VideoMediaDeviceSession.java b/src/net/java/sip/communicator/impl/neomedia/device/VideoMediaDeviceSession.java
index 2b76534..fc38745 100644
--- a/src/net/java/sip/communicator/impl/neomedia/device/VideoMediaDeviceSession.java
+++ b/src/net/java/sip/communicator/impl/neomedia/device/VideoMediaDeviceSession.java
@@ -706,9 +706,9 @@ public class VideoMediaDeviceSession
*/
playerScaler = new PlayerScaler(player);
- /* for H264 codec, we will use RTCP feedback
- * for example to advertise sender that we miss
- * a frame
+ /*
+ * For H.264, we will use RTCP feedback. For example, to
+ * tell the sender that we've missed a frame.
*/
if(format.getEncoding().equals("h264/rtp") && usePLI)
{
@@ -1269,6 +1269,8 @@ public class VideoMediaDeviceSession
*/
public PlayerScaler(Player player)
{
+ super(true);
+
this.player = player;
}
diff --git a/src/net/java/sip/communicator/impl/neomedia/jmfext/media/renderer/video/JAWTRenderer.java b/src/net/java/sip/communicator/impl/neomedia/jmfext/media/renderer/video/JAWTRenderer.java
index 4552209..47cd769 100644
--- a/src/net/java/sip/communicator/impl/neomedia/jmfext/media/renderer/video/JAWTRenderer.java
+++ b/src/net/java/sip/communicator/impl/neomedia/jmfext/media/renderer/video/JAWTRenderer.java
@@ -13,6 +13,7 @@ import javax.media.format.*;
import javax.media.renderer.*;
import net.java.sip.communicator.impl.neomedia.control.*;
+import net.java.sip.communicator.util.*;
/**
* Implements a <tt>VideoRenderer</tt> which uses JAWT to perform native
@@ -34,13 +35,25 @@ public class JAWTRenderer
private static final Format[] SUPPORTED_INPUT_FORMATS
= new Format[]
{
- new RGBFormat(
- null,
- Format.NOT_SPECIFIED,
- Format.intArray,
- Format.NOT_SPECIFIED,
- 32,
- 0x00FF0000, 0x0000FF00, 0x000000FF)
+ OSUtils.IS_LINUX
+ ? new YUVFormat(
+ null /* size */,
+ Format.NOT_SPECIFIED /* maxDataLength */,
+ Format.intArray,
+ Format.NOT_SPECIFIED /* frameRate */,
+ YUVFormat.YUV_420,
+ Format.NOT_SPECIFIED /* strideY */,
+ Format.NOT_SPECIFIED /* strideUV */,
+ Format.NOT_SPECIFIED /* offsetY */,
+ Format.NOT_SPECIFIED /* offsetU */,
+ Format.NOT_SPECIFIED /* offsetV */)
+ : new RGBFormat(
+ null,
+ Format.NOT_SPECIFIED,
+ Format.intArray,
+ Format.NOT_SPECIFIED,
+ 32,
+ 0x00FF0000, 0x0000FF00, 0x000000FF)
};
static