From 711718c2be6c3afbfadab314de90ba582bed7710 Mon Sep 17 00:00:00 2001 From: Tom Briden Date: Tue, 24 Jul 2018 11:38:40 +0100 Subject: [PATCH] python-sipsimple: Add patches to fix PJSIP compilation --- ...n-sipsimple-3.1.1-pjmedia-ffmpeg-fix.patch | 30 +++ ...sipsimple-3.1.1-pjmedia-openh264-1.6.patch | 173 ++++++++++++++++++ .../python-sipsimple-3.1.1.exheres-0 | 2 + 3 files changed, 205 insertions(+) create mode 100644 packages/dev-python/python-sipsimple/files/python-sipsimple-3.1.1-pjmedia-ffmpeg-fix.patch create mode 100644 packages/dev-python/python-sipsimple/files/python-sipsimple-3.1.1-pjmedia-openh264-1.6.patch diff --git a/packages/dev-python/python-sipsimple/files/python-sipsimple-3.1.1-pjmedia-ffmpeg-fix.patch b/packages/dev-python/python-sipsimple/files/python-sipsimple-3.1.1-pjmedia-ffmpeg-fix.patch new file mode 100644 index 00000000..e4fe2170 --- /dev/null +++ b/packages/dev-python/python-sipsimple/files/python-sipsimple-3.1.1-pjmedia-ffmpeg-fix.patch @@ -0,0 +1,30 @@ +Upstream: https://github.com/AGProjects/python-sipsimple/pull/3 + +From f96d1e8637f817dc76188742d2e0e1b7b2776581 Mon Sep 17 00:00:00 2001 +From: Benjamin Lamowski +Date: Tue, 22 May 2018 10:11:06 -0400 +Subject: [PATCH] pjsip: fix compilation error with FFmpeg 2.8.14 + +--- + deps/pjsip/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/deps/pjsip/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c b/deps/pjsip/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c +index cf859408..097479f6 100644 +--- a/deps/pjsip/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c ++++ b/deps/pjsip/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c +@@ -1684,12 +1684,12 @@ static pj_status_t ffmpeg_codec_decode_whole(pjmedia_vid_codec *codec, + avpacket.size = (int)input->size; + + /* ffmpeg warns: +- * - input buffer padding, at least FF_INPUT_BUFFER_PADDING_SIZE ++ * - input buffer padding, at least AV_INPUT_BUFFER_PADDING_SIZE + * - null terminated + * Normally, encoded buffer is allocated more than needed, so lets just + * bzero the input buffer end/pad, hope it will be just fine. + */ +- pj_bzero(avpacket.data+avpacket.size, FF_INPUT_BUFFER_PADDING_SIZE); ++ pj_bzero(avpacket.data+avpacket.size, AV_INPUT_BUFFER_PADDING_SIZE); + + output->bit_info = 0; + output->timestamp = input->timestamp; diff --git a/packages/dev-python/python-sipsimple/files/python-sipsimple-3.1.1-pjmedia-openh264-1.6.patch b/packages/dev-python/python-sipsimple/files/python-sipsimple-3.1.1-pjmedia-openh264-1.6.patch new file mode 100644 index 00000000..fd476ae4 --- /dev/null +++ b/packages/dev-python/python-sipsimple/files/python-sipsimple-3.1.1-pjmedia-openh264-1.6.patch @@ -0,0 +1,173 @@ +Upstream: https://trac.pjsip.org/repos/changeset/5405/pjproject/trunk/pjmedia/src/pjmedia-codec/openh264.cpp +Reason: Support for OpenH264 v1.6.0 codec + +Index: deps/pjsip/pjmedia/src/pjmedia-codec/openh264.cpp +=================================================================== +--- deps/pjsip/pjmedia/src/pjmedia-codec/openh264.cpp (revision 5045) ++++ deps/pjsip/pjmedia/src/pjmedia-codec/openh264.cpp (revision 5405) +@@ -164,6 +164,6 @@ + struct SLayerPEncCtx + { +- pj_int32_t iDLayerQp; +- SSliceConfig sSliceCfg; ++ pj_int32_t iDLayerQp; ++ SSliceArgument sSliceArgument; + }; + +@@ -471,16 +471,17 @@ + + /* Init encoder parameters */ +- pj_bzero(&eprm, sizeof(eprm)); +- eprm.iInputCsp = videoFormatI420; ++ oh264_data->enc->GetDefaultParams (&eprm); ++ eprm.iComplexityMode = MEDIUM_COMPLEXITY; + eprm.sSpatialLayers[0].uiProfileIdc = PRO_BASELINE; + eprm.iPicWidth = param->enc_fmt.det.vid.size.w; ++ eprm.iUsageType = CAMERA_VIDEO_REAL_TIME; + eprm.iPicHeight = param->enc_fmt.det.vid.size.h; + eprm.fMaxFrameRate = (param->enc_fmt.det.vid.fps.num * + 1.0f / + param->enc_fmt.det.vid.fps.denum); +- eprm.uiFrameToBeCoded = (unsigned int) -1; + eprm.iTemporalLayerNum = 1; + eprm.uiIntraPeriod = 0; /* I-Frame interval in frames */ +- eprm.bEnableSpsPpsIdAddition = (oh264_data->whole? false : true); ++ eprm.eSpsPpsIdStrategy = (oh264_data->whole ? CONSTANT_ID : ++ INCREASING_ID); + eprm.bEnableFrameCroppingFlag = true; + eprm.iLoopFilterDisableIdc = 0; +@@ -505,16 +506,17 @@ + pj_bzero(&elayer_ctx, sizeof (SLayerPEncCtx)); + elayer_ctx.iDLayerQp = 24; +- elayer_ctx.sSliceCfg.uiSliceMode = (oh264_data->whole ? +- SM_SINGLE_SLICE : SM_DYN_SLICE); +- elayer_ctx.sSliceCfg.sSliceArgument.uiSliceSizeConstraint = param->enc_mtu; +- elayer_ctx.sSliceCfg.sSliceArgument.uiSliceNum = 1; +- elayer_ctx.sSliceCfg.sSliceArgument.uiSliceMbNum[0] = 960; +- elayer_ctx.sSliceCfg.sSliceArgument.uiSliceMbNum[1] = 0; +- elayer_ctx.sSliceCfg.sSliceArgument.uiSliceMbNum[2] = 0; +- elayer_ctx.sSliceCfg.sSliceArgument.uiSliceMbNum[3] = 0; +- elayer_ctx.sSliceCfg.sSliceArgument.uiSliceMbNum[4] = 0; +- elayer_ctx.sSliceCfg.sSliceArgument.uiSliceMbNum[5] = 0; +- elayer_ctx.sSliceCfg.sSliceArgument.uiSliceMbNum[6] = 0; +- elayer_ctx.sSliceCfg.sSliceArgument.uiSliceMbNum[7] = 0; ++ elayer_ctx.sSliceArgument.uiSliceMode = (oh264_data->whole ? ++ SM_SINGLE_SLICE : ++ SM_SIZELIMITED_SLICE); ++ elayer_ctx.sSliceArgument.uiSliceSizeConstraint = param->enc_mtu; ++ elayer_ctx.sSliceArgument.uiSliceNum = 1; ++ elayer_ctx.sSliceArgument.uiSliceMbNum[0] = 960; ++ elayer_ctx.sSliceArgument.uiSliceMbNum[1] = 0; ++ elayer_ctx.sSliceArgument.uiSliceMbNum[2] = 0; ++ elayer_ctx.sSliceArgument.uiSliceMbNum[3] = 0; ++ elayer_ctx.sSliceArgument.uiSliceMbNum[4] = 0; ++ elayer_ctx.sSliceArgument.uiSliceMbNum[5] = 0; ++ elayer_ctx.sSliceArgument.uiSliceMbNum[6] = 0; ++ elayer_ctx.sSliceArgument.uiSliceMbNum[7] = 0; + + elayer->iVideoWidth = eprm.iPicWidth; +@@ -524,12 +526,12 @@ + elayer->iSpatialBitrate = eprm.iTargetBitrate; + elayer->iDLayerQp = elayer_ctx.iDLayerQp; +- elayer->sSliceCfg.uiSliceMode = elayer_ctx.sSliceCfg.uiSliceMode; +- +- memcpy( &elayer->sSliceCfg, +- &elayer_ctx.sSliceCfg, +- sizeof (SSliceConfig)); +- memcpy( &elayer->sSliceCfg.sSliceArgument.uiSliceMbNum[0], +- &elayer_ctx.sSliceCfg.sSliceArgument.uiSliceMbNum[0], +- sizeof (elayer_ctx.sSliceCfg.sSliceArgument.uiSliceMbNum)); ++ elayer->sSliceArgument.uiSliceMode = elayer_ctx.sSliceArgument.uiSliceMode; ++ ++ memcpy ( &elayer->sSliceArgument, ++ &elayer_ctx.sSliceArgument, ++ sizeof (SSliceArgument)); ++ memcpy ( &elayer->sSliceArgument.uiSliceMbNum[0], ++ &elayer_ctx.sSliceArgument.uiSliceMbNum[0], ++ sizeof (elayer_ctx.sSliceArgument.uiSliceMbNum)); + + /* Init input picture */ +@@ -553,11 +555,18 @@ + } + ++ int videoFormat = videoFormatI420; ++ rc = oh264_data->enc->SetOption (ENCODER_OPTION_DATAFORMAT, &videoFormat); ++ if (rc != cmResultSuccess) { ++ PJ_LOG(4,(THIS_FILE, "SVC encoder SetOption videoFormatI420 failed, " ++ "rc=%d", rc)); ++ return PJMEDIA_CODEC_EFAILED; ++ } ++ + /* + * Decoder + */ + sDecParam.sVideoProperty.size = sizeof (sDecParam.sVideoProperty); +- sDecParam.iOutputColorFormat = videoFormatI420; + sDecParam.uiTargetDqLayer = (pj_uint8_t) - 1; +- sDecParam.uiEcActiveFlag = 1; ++ sDecParam.eEcActiveIdc = ERROR_CON_SLICE_COPY; + sDecParam.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT; + +@@ -575,12 +584,4 @@ + PJ_LOG(4,(THIS_FILE, "Decoder initialization failed, rc=%d", rc)); + return PJMEDIA_CODEC_EFAILED; +- } +- +- pj_int32_t color_fmt = videoFormatI420; +- rc = oh264_data->dec->SetOption (DECODER_OPTION_DATAFORMAT, &color_fmt); +- if (rc) { +- PJ_LOG(4,(THIS_FILE, +- "Warning: SetOption(DECODER_OPTION_DATAFORMAT) failed, rc=%d", +- rc)); + } + +@@ -662,5 +663,5 @@ + } + +- if (oh264_data->bsi.eOutputFrameType == videoFrameTypeSkip) { ++ if (oh264_data->bsi.eFrameType == videoFrameTypeSkip) { + output->size = 0; + output->type = PJMEDIA_FRAME_TYPE_NONE; +@@ -682,11 +683,11 @@ + /* Find which layer with biggest payload */ + oh264_data->ilayer = 0; +- payload_size = oh264_data->bsi.sLayerInfo[0].iNalLengthInByte[0]; ++ payload_size = oh264_data->bsi.sLayerInfo[0].pNalLengthInByte[0]; + for (i=0; i < (unsigned)oh264_data->bsi.iLayerNum; ++i) { + unsigned j; + pLayerBsInfo = &oh264_data->bsi.sLayerInfo[i]; + for (j=0; j < (unsigned)pLayerBsInfo->iNalCount; ++j) { +- if (pLayerBsInfo->iNalLengthInByte[j] > (int)payload_size) { +- payload_size = pLayerBsInfo->iNalLengthInByte[j]; ++ if (pLayerBsInfo->pNalLengthInByte[j] > (int)payload_size) { ++ payload_size = pLayerBsInfo->pNalLengthInByte[j]; + oh264_data->ilayer = i; + } +@@ -704,5 +705,5 @@ + payload_size = 0; + for (int inal = pLayerBsInfo->iNalCount - 1; inal >= 0; --inal) { +- payload_size += pLayerBsInfo->iNalLengthInByte[inal]; ++ payload_size += pLayerBsInfo->pNalLengthInByte[inal]; + } + +@@ -761,5 +762,5 @@ + output->size = payload_len; + +- if (oh264_data->bsi.eOutputFrameType == videoFrameTypeIDR) { ++ if (oh264_data->bsi.eFrameType == videoFrameTypeIDR) { + output->bit_info |= PJMEDIA_VID_FRM_KEYFRAME; + } +@@ -783,5 +784,5 @@ + oh264_data->enc_frame_size = 0; + for (int inal = pLayerBsInfo->iNalCount - 1; inal >= 0; --inal) { +- oh264_data->enc_frame_size += pLayerBsInfo->iNalLengthInByte[inal]; ++ oh264_data->enc_frame_size += pLayerBsInfo->pNalLengthInByte[inal]; + } + +@@ -810,5 +811,5 @@ + output->size = payload_len; + +- if (oh264_data->bsi.eOutputFrameType == videoFrameTypeIDR) { ++ if (oh264_data->bsi.eFrameType == videoFrameTypeIDR) { + output->bit_info |= PJMEDIA_VID_FRM_KEYFRAME; + } diff --git a/packages/dev-python/python-sipsimple/python-sipsimple-3.1.1.exheres-0 b/packages/dev-python/python-sipsimple/python-sipsimple-3.1.1.exheres-0 index fefaf542..6655ea40 100644 --- a/packages/dev-python/python-sipsimple/python-sipsimple-3.1.1.exheres-0 +++ b/packages/dev-python/python-sipsimple/python-sipsimple-3.1.1.exheres-0 @@ -48,6 +48,8 @@ DEPENDENCIES=" DEFAULT_SRC_PREPARE_PATCHES=( "${FILES}"/${PNV}-fix-build.patch + "${FILES}"/${PNV}-pjmedia-ffmpeg-fix.patch + -p0 "${FILES}"/${PNV}-pjmedia-openh264-1.6.patch ) src_compile() {