diff --git a/linphone/mediastreamer2/plugins/msx264/NEWS b/linphone/mediastreamer2/plugins/msx264/NEWS index fdee56237..a354cdff8 100644 --- a/linphone/mediastreamer2/plugins/msx264/NEWS +++ b/linphone/mediastreamer2/plugins/msx264/NEWS @@ -1,3 +1,6 @@ +Wednesday December 2, 2009: msx264-1.3.0 + - use new official x264 support of multislicing (forked version no more required) + Friday July 4, 2009 : msx264-1.2.0 - modified to compile against new multisliced version of x264 to allow packetization-mode=0 diff --git a/linphone/mediastreamer2/plugins/msx264/README b/linphone/mediastreamer2/plugins/msx264/README index 360f099e5..291cab2cb 100644 --- a/linphone/mediastreamer2/plugins/msx264/README +++ b/linphone/mediastreamer2/plugins/msx264/README @@ -1,16 +1,10 @@ msx264 - a GPL plugin to bring video H264 encoding/decoding capabilities to mediastreamer2 applications. It is based on ffmpeg for decoding and x264 for encoding. -It works with any version of x264. However if you want better performance and interroperability, it is -highly recommended to use the modified multiscling-enabled x264 available from linphone.org. -This patch enables multi-slicing, ie smaller video packets that fit into the network mtu. -It enables RFC3984 packetization-mode=0 to work. -You can download this special x264 here: -http://download.savannah.gnu.org/releases/linphone/plugins/sources/x264-snapshot-20090704-linphone-org.tar.gz - +It works with x264 version later to september 2009. So: -* compile x264-snapshot-20090704-linphone-org.tar.gz with ./configure && make && make install -* compile msx264 with ./configure --enable-hacked-x264 && make && make install + +* compile msx264 with ./configure && make && make install A bit of history @@ -19,3 +13,6 @@ A bit of history The multislicing feature of x264 is something that has been contributed several time, but never merged (why ?). The linphone.org version of x264 was inspired by a patch submitted on x264-devel mailing list: http://mailman.videolan.org/pipermail/x264-devel/2008-April/004427.html +http://download.savannah.gnu.org/releases/linphone/plugins/sources/x264-snapshot-20090704-linphone-org.tar.gz +This version is no more required since in august 2009, x264 team introduces new parameters +controlling slicing. diff --git a/linphone/mediastreamer2/plugins/msx264/configure.ac b/linphone/mediastreamer2/plugins/msx264/configure.ac index 2c35be84a..191383a13 100644 --- a/linphone/mediastreamer2/plugins/msx264/configure.ac +++ b/linphone/mediastreamer2/plugins/msx264/configure.ac @@ -1,5 +1,5 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT([msx264],[1.2.0]) +AC_INIT([msx264],[1.3.0]) AM_INIT_AUTOMAKE([tar-ustar]) @@ -60,13 +60,8 @@ fi PKG_CHECK_MODULES(MEDIASTREAMER, mediastreamer >= 2.1.0) -PKG_CHECK_MODULES(X264, x264 >= 0.58.0) +PKG_CHECK_MODULES(X264, x264 >= 0.67.0) -AC_ARG_ENABLE(hacked-x264, -[ --enable-hacked-x264 Turn on compilation over a patched x264 that allows multislicing [default=no]], -[hacked_x264=$enableval], -[hacked_x264=no] -) dnl test for ffmpeg presence PKG_CHECK_MODULES(LIBAVCODEC, [libavcodec >= 50.0.0 ],ffmpeg_found=yes , ffmpeg_found=no) diff --git a/linphone/mediastreamer2/plugins/msx264/src/msx264.c b/linphone/mediastreamer2/plugins/msx264/src/msx264.c index ff2ad2d30..3ad35f217 100644 --- a/linphone/mediastreamer2/plugins/msx264/src/msx264.c +++ b/linphone/mediastreamer2/plugins/msx264/src/msx264.c @@ -70,25 +70,28 @@ static void enc_uninit(MSFilter *f){ static void enc_preprocess(MSFilter *f){ EncData *d=(EncData*)f->data; x264_param_t params; + rfc3984_init(&d->packer); rfc3984_set_mode(&d->packer,d->mode); rfc3984_enable_stap_a(&d->packer,FALSE); + x264_param_default(¶ms); + params.i_threads=1; + params.i_sync_lookahead=0; params.i_width=d->vsize.width; params.i_height=d->vsize.height; params.i_fps_num=(int)d->fps; params.i_fps_den=1; -#ifdef HACKED_X264 - ms_message("Lucky guy, you have a hacked x264 lib that allows multislicing !"); - params.i_max_nalu_size=ms_get_payload_max_size()-100; /*-100 security margin*/ -#endif + params.i_slice_max_size=ms_get_payload_max_size()-100; /*-100 security margin*/ /*params.i_level_idc=30;*/ + params.rc.i_rc_method = X264_RC_ABR; params.rc.i_bitrate=(int)( ( ((float)d->bitrate)*0.8)/1000.0); params.rc.f_rate_tolerance=0.1; params.rc.i_vbv_max_bitrate=(int) (((float)d->bitrate)*0.9/1000.0); params.rc.i_vbv_buffer_size=params.rc.i_vbv_max_bitrate; params.rc.f_vbv_buffer_init=0.5; + params.rc.i_lookahead=0; /*enable this by config ?*/ /* params.i_keyint_max = (int)d->fps*d->keyframe_int; @@ -108,14 +111,9 @@ static void x264_nals_to_msgb(x264_nal_t *xnals, int num_nals, MSQueue * nalus){ /*int bytes;*/ for (i=0;ib_wptr, &bytes, 0, &xnals[i] ); - m->b_wptr+=bytes; - */ - *m->b_wptr=( 0x00 << 7 ) | ( xnals[i].i_ref_idc << 5 ) | xnals[i].i_type; - m->b_wptr++; - memcpy(m->b_wptr,xnals[i].p_payload,xnals[i].i_payload); - m->b_wptr+=xnals[i].i_payload; + + memcpy(m->b_wptr,xnals[i].p_payload+4,xnals[i].i_payload-4); + m->b_wptr+=xnals[i].i_payload-4; if (xnals[i].i_type==7) { ms_message("A SPS is being sent."); }else if (xnals[i].i_type==8) { @@ -149,6 +147,7 @@ static void enc_process(MSFilter *f){ }else xpic.i_type=X264_TYPE_AUTO; xpic.i_qpplus1=0; xpic.i_pts=d->framenum; + xpic.param=NULL; xpic.img.i_csp=X264_CSP_I420; xpic.img.i_plane=3; xpic.img.i_stride[0]=pic.strides[0]; @@ -159,7 +158,7 @@ static void enc_process(MSFilter *f){ xpic.img.plane[1]=pic.planes[1]; xpic.img.plane[2]=pic.planes[2]; xpic.img.plane[3]=0; - if (x264_encoder_encode(d->enc,&xnals,&num_nals,&xpic,&oxpic)==0){ + if (x264_encoder_encode(d->enc,&xnals,&num_nals,&xpic,&oxpic)>=0){ x264_nals_to_msgb(xnals,num_nals,&nalus); rfc3984_pack(&d->packer,&nalus,f->outputs[0],ts); d->framenum++; @@ -269,11 +268,7 @@ static MSFilterMethod enc_methods[]={ static MSFilterDesc x264_enc_desc={ .id=MS_FILTER_PLUGIN_ID, .name="MSX264Enc", -#ifdef HACKED_X264 .text="A H264 encoder based on x264 project (with multislicing enabled)", -#else - .text="A H264 encoder based on x264 project.", -#endif .category=MS_FILTER_ENCODER, .enc_fmt="H264", .ninputs=1,