Skip to content

Commit

Permalink
Merge pull request nesterenkodm#72 from welljsjs/master
Browse files Browse the repository at this point in the history
Pod for iOS & macOS with latest dependencies
  • Loading branch information
chebur authored Jun 25, 2019
2 parents 3ab06e6 + 6107b50 commit 39d283c
Show file tree
Hide file tree
Showing 104 changed files with 3,935 additions and 863 deletions.
60 changes: 60 additions & 0 deletions .github/ISSUE_TEMPLATE/issue_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
name: Issue/Bug report
about: Create a report to help us improve
title: '[Possible Bug]'
labels: ''
assignees: ''

---

```
Please notice that issues where this template is not filled out correctly won't receive an answer and get discarded and closed.
Please delete the parts of the template that are not needed.
Please remove these lines of text (beginning and ending with three backticks) before submitting the issue.
```

# Prerequisites

Please answer the following questions for yourself before submitting an issue.

- [ ] I am running the latest version
- [ ] I checked the README and found no answer
- [ ] I checked to make sure that this issue has not already been filed
- [ ] I'm reporting the issue to the correct repository as it is related to this repository and not to the [official pjsip repository](https://www.pjsip.org)

# Expected Behavior

Please describe the behavior you are expecting

# Current Behavior

What is the current behavior?

# Failure Information (for bugs)

Please help provide information about the failure if this is a bug. If it is not a bug, please remove the rest of this template.

## Steps to Reproduce

Please provide detailed steps for reproducing the issue.

1. step 1
2. step 2
3. you get it...

## Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

* Xcode Version:
* Platform and architecture building for:
* Operating System:
* SDK version:
(if you're using any other SDK than the one shipped with the specified Xcode version)


## Failure Logs

Be sure to include any relevant log snippets or files here (if you've rebuilt the project, you'll find the relevant logs under `path_to_project/build/pjproject/src/`; there's a log for each architecture you're building for, e.g.`ios-armv7s.log`).
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ build/opus/dependencies/*
!build/opus/dependencies/lib
!build/opus/dependencies/lib/*

# openssl
!build/openssl
build/openssl/*

!build/openssl/lib/
!build/openssl/lib/*
build/openssl/lib/.DS_Store

# pjsip
!build/pjproject
build/pjproject/*
Expand Down
33 changes: 33 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# How to contribute

We're really glad you're reading this, because we need developers to help to maintain this project.

Before filing a bug report or pull request, please ensure that you're reporting to the correct repository!
This repository is pjsip _built for iOS/macOS_ and published on CocoaPods. If you've found a bug within pjsip itself, this is the wrong place and you'd rather go visit [pjsip.org](https://trac.pjsip.org/repos/wiki/FAQ#bug-reports).

Here are some important resources:

* [README](https://github.com/chebur/pjsip/blob/master/README.md) tells you what this project is about,
* [Our roadmap](https://github.com/chebur/pjsip/commits/master) is the last commits to this project
* Bugs? [Issues](https://github.com/chebur/pjsip/issues) is where to report them

## Submitting changes

Please send a [GitHub Pull Request to pjsip](https://github.com/chebur/pjsip/compare) with a clear list of what you've done (read more about [pull requests](http://help.github.com/pull-requests/)). When you send a pull request, we will love you forever if you include detailed documentation. Please follow our coding conventions (below) and make sure all of your commits are atomic (one feature per commit).

Always write a clear log message for your commits. One-line messages are fine for small changes, but bigger changes should look like this:

$ git commit -m "A brief summary of the commit
>
> A paragraph describing what changed and its impact."

## Coding conventions

Start reading our code and you'll get the hang of it. We optimize for readability:

* We indent using four spaces (soft tabs)
* This is open source software. Consider the people who will read your code, and make it look nice for them. It's sort of like driving a car: Perhaps you love doing donuts when you're alone, but with passengers the goal is to make the ride as smooth as possible.

Thanks,

`pjsip` maintainers
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
# PJSIP

PJSIP is a free and open source multimedia communication library written in C language implementing standard based protocols such as SIP, SDP, RTP, STUN, TURN, and ICE.
PJSIP is a free and open source multimedia communication library written in C language implementing standard based protocols such as SIP, SDP, RTP, STUN, TURN, and ICE.

## Features

- Supported platforms: iOS8+
- Supported architectures: armv7, armv7s, arm64, i386, x86_64
- Supported platforms: iOS9+, macOS 10.12+
- Supported architectures: (iOS) armv7, armv7s, arm64, i386, x86_64; (macOS) x86_64
- pjsip 2.8
- IPv6 support
- OpenSSL support provided by the [OpenSSL-for-iPhone](https://github.com/x2on/OpenSSL-for-iPhone) build script and the [OpenSSL-Universal](https://github.com/krzyzanowskim/OpenSSL) pod
- Video support provided by the [OpenH264](https://github.com/cisco/openh264)
- OPUS now supported - this pod provides libopus
- OpenSSL supported (LTS 1.1.1b)
- Video support now provided by native frameworks ([VideoToolbox](https://developer.apple.com/documentation/videotoolbox?language=objc))
- OPUS now supported - this pod provides libopus (1.3.1)

## Installation

Add the following line to your `Podfile` and run `pod install` command.

```
```sh
pod 'pjsip'
```

## Example

See [example](example/ipjsystest) folder for integration example
See [example](https://github.com/chebur/pjsip/example/ipjsystest) folder for integration example

## Build manually

1. Run `brew install nasm` to build openh264.
1. Run [build.sh](build.sh).
2. Drag generated libraries and headers files into your xcode project.
2. Drag the generated libraries and headers files into your Xcode project.

See also [Getting Started: Building for Apple iPhone, iPad and iPod Touch](https://trac.pjsip.org/repos/wiki/Getting-Started/iPhone)

## Call for Pull Requests

It turns out that building pjsip library for iOS is not a trivial task. Since pjsip binaries has to be rebuild from time to time to automate this work I've decided to create bash scripts and share my work with a community.
It turns out that building pjsip library for iOS is not a trivial task. Since pjsip binaries has to be rebuild from time to time to automate this work I've decided to create bash scripts and share my work with a community.

It's just my private initiative and I want to state this as clear as possible that this is not an official repository.
It's just my private initiative and I want to state this as clear as possible that this is not an official repository.

I've finished developing my pjsip application, thats why I'm no longer interested in supporting this repository. But I know there are some people which relies on it. They may have buildtime and runtime issues which I'm not able to debug and investigate.
I've finished developing my pjsip application, thats why I'm no longer interested in supporting this repository. But I know there are some people which relies on it. They may have buildtime and runtime issues which I'm not able to debug and investigate.

If you are a kind of a person that have time and will to fix and update this build scripts, and experienced enough to debug issues, please send me your pull requests — you will be more than welcome.  
If you are a kind of a person that have time and will to fix and update this build scripts, and experienced enough to debug issues, please send me your pull requests — you will be more than welcome.
47 changes: 16 additions & 31 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#!/bin/sh

# environment variables
export OPENSSL_VERSION="1.1.1c" # specify the openssl version to use
export PJSIP_VERSION="2.9"
export OPUS_VERSION="1.3.1"
export MACOS_MIN_SDK_VERSION="10.12"
export IOS_MIN_SDK_VERSION="9.0"

# see http://stackoverflow.com/a/3915420/318790
function realpath { echo $(cd $(dirname "$1"); pwd)/$(basename "$1"); }
__FILE__=`realpath "$0"`
Expand All @@ -19,40 +26,18 @@ function download() {
OPENSSL_DIR="${BUILD_DIR}/openssl"
OPENSSL_ENABLED=
function openssl() {
OPENSSL_URL="https://github.com/x2on/OpenSSL-for-iPhone/archive/1.0.2i.tar.gz"
#OPENSSL_URL="https://raw.githubusercontent.com/x2on/OpenSSL-for-iPhone/master/build-libssl.sh"
OPENSSL_SH="build-libssl.sh"


if [ ! -f "${OPENSSL_DIR}/lib/libssl.a" ]; then
download ${OPENSSL_URL} ${OPENSSL_DIR}
pushd . > /dev/null
cd ${OPENSSL_DIR}
/bin/sh ${OPENSSL_SH}
mv include include2
mkdir -p include
mv include2 include/openssl
popd > /dev/null
if [ ! -d "${OPENSSL_DIR}/lib/iOS" ] || [ ! -d "${OPENSSL_DIR}/lib/macOS" ]; then
if [ ! -d "${OPENSSL_DIR}" ]; then
mkdir -p "${OPENSSL_DIR}"
fi
"${__DIR__}/openssl/openssl.sh" "--version=${OPENSSL_VERSION}" "--reporoot=${OPENSSL_DIR}" "--macos-min-sdk=${MACOS_MIN_SDK_VERSION}" "--ios-min-sdk=${IOS_MIN_SDK_VERSION}"
else
echo "Using OpenSSL..."
fi

OPENSSL_ENABLED=1
}

# openh264
OPENH264_DIR="${BUILD_DIR}/openh264"
OPENH264_ENABLED=
function openh264() {
if [ ! -f "${OPENH264_DIR}/lib/libopenh264.a" ] || [ ! -d "${OPENH264_DIR}/include/wels/" ]; then
"${__DIR__}/openh264.sh" "${OPENH264_DIR}"
else
echo "Using OpenH264..."
fi

OPENH264_ENABLED=1
}

# opus
OPUS_DIR="${BUILD_DIR}/opus"
OPUS_ENABLED=
Expand All @@ -62,16 +47,16 @@ function opus() {
else
echo "Using OPUS..."
fi

OPUS_ENABLED=1
}

# pjsip
PJSIP_DIR="${BUILD_DIR}/pjproject"
function pjsip() {
"${__DIR__}/pjsip.sh" "${PJSIP_DIR}" --with-openssl "${OPENSSL_DIR}" --with-openh264 "${OPENH264_DIR}" --with-opus "${OPUS_DIR}/dependencies"
"${__DIR__}/pjsip.sh" "${PJSIP_DIR}" --with-openssl "${OPENSSL_DIR}" --with-opus "${OPUS_DIR}/dependencies"
}

openssl
openh264
opus
pjsip
Binary file removed build/openh264/lib/libopenh264.a
Binary file not shown.
Binary file added build/openssl/lib/ios/libcrypto.a
Binary file not shown.
Binary file added build/openssl/lib/ios/libssl.a
Binary file not shown.
Binary file added build/openssl/lib/macos/libcrypto.a
Binary file not shown.
Binary file added build/openssl/lib/macos/libssl.a
Binary file not shown.
Binary file modified build/opus/dependencies/lib/libopus.a
Binary file not shown.
Binary file not shown.
Binary file not shown.
6 changes: 3 additions & 3 deletions build/pjproject/src/pjlib/include/pj/compat/os_auto.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
*/

/* Canonical OS name */
#define PJ_OS_NAME "x86_64-apple-darwin_ios"
#define PJ_OS_NAME "x86_64-apple-darwin18.6.0"

/* Legacy macros */
/* #undef PJ_WIN32 */
Expand Down Expand Up @@ -218,10 +218,10 @@

/* SSL socket availability. */
#ifndef PJ_HAS_SSL_SOCK
/* #undef PJ_HAS_SSL_SOCK */
#define PJ_HAS_SSL_SOCK 1
#endif
#ifndef PJ_SSL_SOCK_IMP
# define PJ_SSL_SOCK_IMP PJ_SSL_SOCK_IMP_NONE
# define PJ_SSL_SOCK_IMP PJ_SSL_SOCK_IMP_DARWIN
#endif


Expand Down
4 changes: 2 additions & 2 deletions build/pjproject/src/pjlib/include/pj/config.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $Id: config.h 5879 2018-09-05 03:40:41Z riza $ */
/* $Id: config.h 6029 2019-06-13 08:56:16Z nanang $ */
/*
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
* Copyright (C) 2003-2008 Benny Prijono <[email protected]>
Expand Down Expand Up @@ -1323,7 +1323,7 @@ PJ_BEGIN_DECL
#define PJ_VERSION_NUM_MAJOR 2

/** PJLIB version minor number. */
#define PJ_VERSION_NUM_MINOR 8
#define PJ_VERSION_NUM_MINOR 9

/** PJLIB version revision number. */
#define PJ_VERSION_NUM_REV 0
Expand Down
9 changes: 2 additions & 7 deletions build/pjproject/src/pjlib/include/pj/config_site.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
#define PJ_CONFIG_IPHONE 1
#define PJ_HAS_IPV6 1
#define PJMEDIA_HAS_OPENH264_CODEC 1
#define PJMEDIA_HAS_VIDEO 1
#define PJMEDIA_VIDEO_DEV_HAS_OPENGL 1
#define PJMEDIA_VIDEO_DEV_HAS_OPENGL_ES 1
#define PJMEDIA_VIDEO_DEV_HAS_IOS_OPENGL 1
#include <OpenGLES/ES3/glext.h>
#define PJMEDIA_HAS_VID_TOOLBOX_CODEC 1
#define PJ_HAS_IPV6 1
#include <pj/config_site_sample.h>
16 changes: 11 additions & 5 deletions build/pjproject/src/pjlib/include/pj/pool.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $Id: pool.h 5533 2017-01-19 06:10:15Z nanang $ */
/* $Id: pool.h 5990 2019-05-15 02:43:01Z nanang $ */
/*
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
* Copyright (C) 2003-2008 Benny Prijono <[email protected]>
Expand Down Expand Up @@ -177,10 +177,7 @@ PJ_BEGIN_DECL
static void my_perror(const char *title, pj_status_t status)
{
char errmsg[PJ_ERR_MSG_SIZE];
pj_strerror(status, errmsg, sizeof(errmsg));
PJ_LOG(1,(THIS_FILE, "%s: %s [status=%d]", title, errmsg, status));
PJ_PERROR(1,(THIS_FILE, status, title));
}
static void pool_demo_1(pj_pool_factory *pfactory)
Expand Down Expand Up @@ -399,6 +396,15 @@ PJ_IDECL(void) pj_pool_release( pj_pool_t *pool );
PJ_IDECL(void) pj_pool_safe_release( pj_pool_t **ppool );


/**
* Release the pool back to pool factory and set the pool pointer to zero.
* The memory pool content will be wiped out first before released.
*
* @param ppool Pointer to memory pool.
*/
PJ_IDECL(void) pj_pool_secure_release( pj_pool_t **ppool );


/**
* Get pool object name.
*
Expand Down
21 changes: 20 additions & 1 deletion build/pjproject/src/pjlib/include/pj/pool_i.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $Id: pool_i.h 5534 2017-01-19 07:41:25Z nanang $ */
/* $Id: pool_i.h 5990 2019-05-15 02:43:01Z nanang $ */
/*
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
* Copyright (C) 2003-2008 Benny Prijono <[email protected]>
Expand Down Expand Up @@ -100,3 +100,22 @@ PJ_IDEF(void) pj_pool_safe_release( pj_pool_t **ppool )
if (pool)
pj_pool_release(pool);
}

PJ_IDEF(void) pj_pool_secure_release( pj_pool_t **ppool )
{
pj_pool_block *b;
pj_pool_t *pool = *ppool;
*ppool = NULL;

if (!pool)
return;

b = pool->block_list.next;
while (b != &pool->block_list) {
volatile unsigned char *p = b->buf;
while (p < b->end) *p++ = 0;
b = b->next;
}

pj_pool_release(pool);
}
Loading

0 comments on commit 39d283c

Please sign in to comment.