diff --git a/linphone/coreapi/exevents.c b/linphone/coreapi/exevents.c index a6fe9e876..16c84e3e9 100644 --- a/linphone/coreapi/exevents.c +++ b/linphone/coreapi/exevents.c @@ -593,7 +593,12 @@ SupportLevel linphone_payload_is_supported(LinphoneCore *lc, sdp_payload_t *payl payload->b_as_bandwidth, ubw); }else{ /*limit to upload bandwidth if exist, else no limit*/ - rtppayload->normal_bitrate=(ubw>0)? 1000*ubw : -1; + if (ubw>0) rtppayload->normal_bitrate=1000*ubw; + else { + if (rtppayload->type!=PAYLOAD_VIDEO){ + rtppayload->normal_bitrate=-1; /*allow speex to use maximum bitrate*/ + } + } } if (payload->a_fmtp!=NULL){ payload_type_set_send_fmtp(rtppayload,payload->a_fmtp); diff --git a/linphone/coreapi/linphonecore.c b/linphone/coreapi/linphonecore.c index 9a4f42a9b..93a7b5e91 100644 --- a/linphone/coreapi/linphonecore.c +++ b/linphone/coreapi/linphonecore.c @@ -1403,6 +1403,7 @@ void linphone_core_start_media_streams(LinphoneCore *lc, LinphoneCall *call){ if (video_params->remoteport>0){ if (video_params->relay_session_id!=NULL) video_stream_set_relay_session_id(lc->videostream,video_params->relay_session_id); + video_stream_set_sent_video_size(lc->videostream,linphone_core_get_preferred_video_size(lc)); if (lc->video_conf.display && lc->video_conf.capture) video_stream_start(lc->videostream, call->profile, video_params->remoteaddr, video_params->remoteport, diff --git a/linphone/mediastreamer2/plugins/msx264/msx264.iss b/linphone/mediastreamer2/plugins/msx264/msx264.iss index 584f67197..9918f00b4 100755 --- a/linphone/mediastreamer2/plugins/msx264/msx264.iss +++ b/linphone/mediastreamer2/plugins/msx264/msx264.iss @@ -3,7 +3,7 @@ [Setup] AppName=msx264 -AppVerName=msx264 version 1.1.6., an H.264 plugin for linphone. +AppVerName=msx264 version 1.1.7., an H.264 plugin for linphone. AppPublisher=linphone.org AppPublisherURL=http://www.linphone.org AppSupportURL=http://www.linphone.org diff --git a/linphone/mediastreamer2/plugins/msx264/src/msx264.c b/linphone/mediastreamer2/plugins/msx264/src/msx264.c index 327960fa3..e5ff967aa 100644 --- a/linphone/mediastreamer2/plugins/msx264/src/msx264.c +++ b/linphone/mediastreamer2/plugins/msx264/src/msx264.c @@ -287,7 +287,8 @@ typedef struct _DecData{ struct SwsContext *sws_ctx; AVCodecContext av_context; unsigned int packet_num; - uint8_t bitstream[65000]; + uint8_t *bitstream; + int bitstream_size; }DecData; static void ffmpeg_init(){ @@ -323,6 +324,8 @@ static void dec_init(MSFilter *f){ dec_open(d); d->outbuf.w=0; d->outbuf.h=0; + d->bitstream_size=65536; + d->bitstream=ms_malloc0(d->bitstream_size); f->data=d; } @@ -338,6 +341,7 @@ static void dec_uninit(MSFilter *f){ if (d->yuv_msg) freemsg(d->yuv_msg); if (d->sps) freemsg(d->sps); if (d->pps) freemsg(d->pps); + ms_free(d->bitstream); ms_free(d); } @@ -409,14 +413,28 @@ static bool_t check_sps_pps_change(DecData *d, mblk_t *sps, mblk_t *pps){ return ret1 || ret2; } -static int nalusToFrame(DecData *d, MSQueue *naluq, uint8_t *bitstream, int size, bool_t *new_sps_pps){ +static void enlarge_bitstream(DecData *d){ + d->bitstream_size*=2; + d->bitstream=ms_realloc(d->bitstream,d->bitstream_size); +} + +static int nalusToFrame(DecData *d, MSQueue *naluq, bool_t *new_sps_pps){ mblk_t *im; - uint8_t *dst=bitstream,*src; + uint8_t *dst=d->bitstream,*src,*end; + int nal_len; bool_t start_picture=TRUE; uint8_t nalu_type; *new_sps_pps=FALSE; + end=d->bitstream+d->bitstream_size; while((im=ms_queue_get(naluq))!=NULL){ src=im->b_rptr; + nal_len=im->b_wptr-src; + if (dst+nal_len+100>end){ + int pos=dst-d->bitstream; + enlarge_bitstream(d); + dst=d->bitstream+pos; + end=d->bitstream+d->bitstream_size; + } nalu_type=(*src) & ((1<<5)-1); if (nalu_type==7) *new_sps_pps=check_sps_pps_change(d,im,NULL) || *new_sps_pps; @@ -432,14 +450,12 @@ static int nalusToFrame(DecData *d, MSQueue *naluq, uint8_t *bitstream, int size *dst++=1; *dst++=*src++; while(src<(im->b_wptr-3)){ -#ifdef REMOVE_PREVENTING_BYTES if (src[0]==0 && src[1]==0 && src[2]<=3){ *dst++=0; *dst++=0; *dst++=3; src+=2; } -#endif *dst++=*src++; } *dst++=*src++; @@ -447,7 +463,7 @@ static int nalusToFrame(DecData *d, MSQueue *naluq, uint8_t *bitstream, int size *dst++=*src++; freemsg(im); } - return dst-bitstream; + return dst-d->bitstream; } static void dec_process(MSFilter *f){ @@ -472,7 +488,7 @@ static void dec_process(MSFilter *f){ uint8_t *p,*end; bool_t need_reinit=FALSE; - size=nalusToFrame(d,&nalus,d->bitstream,sizeof(d->bitstream),&need_reinit); + size=nalusToFrame(d,&nalus,&need_reinit); if (need_reinit) dec_reinit(d); p=d->bitstream; diff --git a/linphone/mediastreamer2/src/videoenc.c b/linphone/mediastreamer2/src/videoenc.c index acf04faf4..ab24f7aa9 100644 --- a/linphone/mediastreamer2/src/videoenc.c +++ b/linphone/mediastreamer2/src/videoenc.c @@ -515,8 +515,8 @@ static int enc_set_br(MSFilter *f, void *arg){ bool_t snow=s->codec==CODEC_ID_SNOW; s->maxbr=*(int*)arg; if (s->maxbr>=1024000 && s->codec!=CODEC_ID_H263P){ - s->vsize.width = MS_VIDEO_SIZE_4CIF_W; - s->vsize.height = MS_VIDEO_SIZE_4CIF_H; + s->vsize.width = MS_VIDEO_SIZE_SVGA_W; + s->vsize.height = MS_VIDEO_SIZE_SVGA_H; s->fps=17; }else if (s->maxbr>=800000 && s->codec!=CODEC_ID_H263P){ s->vsize.width = MS_VIDEO_SIZE_VGA_W; diff --git a/linphone/mediastreamer2/src/videoout.c b/linphone/mediastreamer2/src/videoout.c index 69b6f4e8e..5902718d1 100644 --- a/linphone/mediastreamer2/src/videoout.c +++ b/linphone/mediastreamer2/src/videoout.c @@ -335,6 +335,11 @@ static bool_t win_display_init(MSDisplay *obj, MSPicture *fbuf){ if (wd->window!=NULL) SetWindowLongPtr(wd->window,GWLP_USERDATA,(LONG_PTR)obj); else return FALSE; } + }else{ + /* the window might need to be resized*/ + RECT cur; + GetWindowRect(wd->window,&cur); + MoveWindow(wd->window,cur.left, cur.top, wd->fb.w, wd->fb.h,FALSE); } if (wd->ddh==NULL) wd->ddh=DrawDibOpen();