From 4b85461e69160891ca1c6ebf959e0a9901f5e7d2 Mon Sep 17 00:00:00 2001 From: Damian Minkov Date: Wed, 19 Nov 2008 16:18:33 +0000 Subject: [PATCH] Decrease h264 iframe interval, decrease packet sizes, fix windows exe as it wasn't setting java.library.path. --- resources/install/build.xml | 2 ++ resources/install/windows/run.exe | Bin 615424 -> 615424 bytes resources/install/windows/run.exe.jsmooth | 2 ++ .../media/codec/video/h264/NativeDecoder.java | 14 +++++++------- .../media/codec/video/h264/NativeEncoder.java | 10 +++++----- 5 files changed, 16 insertions(+), 12 deletions(-) diff --git a/resources/install/build.xml b/resources/install/build.xml index dbe48bf83..3dfd3dee2 100644 --- a/resources/install/build.xml +++ b/resources/install/build.xml @@ -30,6 +30,8 @@ --> + + diff --git a/resources/install/windows/run.exe b/resources/install/windows/run.exe index e154233f05549e7eb9c642595abcf3dd0d62bceb..1eab8d79ffa1e9388cdbc010b6540e5e21b31c43 100644 GIT binary patch delta 219 zcmZoTq1pgMEsQNpEzB(}EvzkUE$mx3WbSaLm@zc)F)%PJnXY<=!?18c$!$#;M50qs_n|vwQm~HqI<=o)(}LOh7B9SVGNaonywpux5Lt5GOY?>l#Z2 zhCSOeMLF4-`Ht8yG@Jlp7F&h}9^2`45}Z=g??`Z}P2VTMDaWQ_%fMiAcKSRCPKD`A OlAOD@GfHv(_XGf;@jtTw delta 199 zcmZoTq1pgMEsQNpEzB(}EvzkUE$mx3WbSY(m@zc)F)%PBOjo_bVa&K;d*mIC+iHw? z+fA7{bC?*7r!QjVygU6c8>cd((e&qRoQiBGv=|s}?Ap%9&Y8u{=>XKu1k@fdy-|o$ zoHfFXfgxl2Tp> java.library.path ./native + + jna.library.path ./native diff --git a/src/net/java/sip/communicator/impl/media/codec/video/h264/NativeDecoder.java b/src/net/java/sip/communicator/impl/media/codec/video/h264/NativeDecoder.java index 93cb96039..d6fb25bc5 100644 --- a/src/net/java/sip/communicator/impl/media/codec/video/h264/NativeDecoder.java +++ b/src/net/java/sip/communicator/impl/media/codec/video/h264/NativeDecoder.java @@ -174,9 +174,6 @@ public void open() throws ResourceUnavailableException avcontext = AVCODEC.avcodec_alloc_context(); - if (AVCODEC.avcodec_open(avcontext, avcodec) < 0) - throw new RuntimeException("Could not open codec "); - avpicture = AVCODEC.avcodec_alloc_frame(); avcontext.lowres = 1; @@ -193,6 +190,9 @@ public void open() throws ResourceUnavailableException // } // }); + if (AVCODEC.avcodec_open(avcontext, avcodec) < 0) + throw new RuntimeException("Could not open codec "); + frameRGB = AVCODEC.avcodec_alloc_frame(); opened = true; @@ -204,9 +204,9 @@ public void close() { opened = false; super.close(); - + AVCODEC.avcodec_close(avcontext); - + AVUTIL.av_free(avpicture.getPointer()); AVUTIL.av_free(avcontext.getPointer()); } @@ -215,7 +215,7 @@ public void close() public int process(Buffer inputBuffer, Buffer outputBuffer) { if (!checkInputBuffer(inputBuffer)) - { + { return BUFFER_PROCESSED_FAILED; } @@ -254,7 +254,7 @@ public int process(Buffer inputBuffer, Buffer outputBuffer) { outputBuffer.setDiscard(true); AVUTIL.av_free(encBuf); - + return BUFFER_PROCESSED_OK; } diff --git a/src/net/java/sip/communicator/impl/media/codec/video/h264/NativeEncoder.java b/src/net/java/sip/communicator/impl/media/codec/video/h264/NativeEncoder.java index a591ce9b8..30f551da7 100644 --- a/src/net/java/sip/communicator/impl/media/codec/video/h264/NativeEncoder.java +++ b/src/net/java/sip/communicator/impl/media/codec/video/h264/NativeEncoder.java @@ -31,7 +31,7 @@ public class NativeEncoder // without the headers // private final static int MAX_PAYLOAD_SIZE = 1400; - private final static int MAX_PAYLOAD_SIZE = 984; + private final static int MAX_PAYLOAD_SIZE = 512; private final static int INPUT_BUFFER_PADDING_SIZE = 8; @@ -69,7 +69,8 @@ public class NativeEncoder // the current rtp sequence private int seq = 0; - private static int IFRAME_INTERVAL = 125; + // key frame every four seconds + private static int IFRAME_INTERVAL = TARGET_FRAME_RATE * 4; private int framesSinceLastIFrame = 0; @@ -417,13 +418,12 @@ public synchronized void open() throws ResourceUnavailableException avcontext.qmin = 10; avcontext.qmax = 22; avcontext.max_qdiff = 4; - + avcontext.partitions |= 0x111; //X264_PART_I4X4 0x001 //X264_PART_P8X8 0x010 //X264_PART_B8X8 0x100 - - avcontext.flags |= AVCodecLibrary.CODEC_FLAG_PASS1; + avcontext.mb_decision = AVCodecContext.FF_MB_DECISION_SIMPLE; avcontext.rc_eq = "blurCplx^(1-qComp)";