Android 下 libvpx &&H264编译 以及集成进 pjsip

Android 下 libvpx &&H264编译 以及集成进 pjsip,第1张

概述编译libvpx(Linux下)1下载libvpx原代码https://github.com/webmproject/libvpxeleases2下载AndroidNDK最新版https://developer.android.google.cndk/downloads/3下载Javajdkhttps://pan.baidu.com/s/1BK65e5Qr5UsghepfXoWbXA提取码java4配置javaj 编译libvpx(linux下)

1下载libvpx原代码
https://github.com/webmproject/libvpx/releases

2 下载AndroID NDK 最新版
https://developer.android.google.cn/ndk/downloads/

3下载Java jdk
https://pan.baidu.com/s/1BK65e5Qr5UsghepfXoWbXA
提取码 java

4 配置java jdk

 $tar zxvf jdk-8u77-linux-x64.tar.gz    将解压好的jdk1.8.0_77文件夹用最高权限复制到 /usr/lib/jvm/jdk1.8.0_77 目录里。jvm/jdk1.8.0_77目录自己新建。   $sudo cp -r  ./jdk1.8.0_77/   /usr/lib/jvm/jdk1.8.0_77/  拷贝完后,进入/usr/lib/jvm/jdk1.8.0_77目录,查看jdk文件是否都拷贝到该目录下 配置环境变量,保存成env.sh,env.sh后面经常会用到,保存成文件,用时会方便点。 #!/bin/sh  export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_77  export CLAsspATH=$CLAsspATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib    export PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin:           保存成env.sh文件后执行,当然你不嫌累,可以一条的执行: $source env.sh 将系统默认的JDK修改成自己的JDK$sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.8.0_77/bin/java 300$sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.8.0_77/bin/javac 300$sudo update-alternatives --config java$sudo update-alternatives --config javac查看JDK安装是否成功 $java -version 如果成功,显示如下信息,如果不显示下面信息,请检查前面设置安装是否正确: java version "1.8.0_77"Java(TM) SE Runtime Environment (build 1.8.0_77-b03)Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode) 

5配置环境变量
export NDK=/path/to/AndroID-NDK
export HOST_TAG=linux-x86_64 # adjust to your building host
export TOolCHAIN=$NDK/toolchains/llvm/prebuilt/$HOST_TAG
export AR=$TOolCHAIN/bin/aarch64-linux-androID-ar
export AS=$TOolCHAIN/bin/aarch64-linux-androID-as
export CC=$TOolCHAIN/bin/aarch64-linux-androID21-clang
export CXX=$TOolCHAIN/bin/aarch64-linux-androID21-clang++
export LD=$TOolCHAIN/bin/aarch64-linux-androID-ld
export RANliB=$TOolCHAIN/bin/aarch64-linux-androID-ranlib
export STRIP=$TOolCHAIN/bin/aarch64-linux-androID-strip

4编译命令 进入libvpx根目录
./configure --target=arm64-androID-gcc --enable-pic --disable-examples
–disable-tools --disable-docs --enable-realtime-only
–disable-install-bins --disable-unit-tests --disable-webm-io
–disable-libyuv
–prefix=/path/to/target/installation
生成静态文件库,安装路径后面集成有用

编译H264

1 下载 h264原代码
https://codeload.github.com/cisco/openh264/zip/v1.6.0

2 下载 AndroID sdk
android-sdk_r24.4.1-linux.tgz

3 配置环境变量
export ANDROID_SDK_ROOT=/home/xxx/PJsIP/androID-sdk-linux
export PATH=$ANDROID_SDK_ROOT/tools:$PATH
上面中xxx为我的工作目录。ANDROID_SDK_ROOT变量请根据自己的SDK路径配置。

4 下载ndk 版本13rb (h264 需要使用老版本ndk编译)
android-ndk-r13b-linux-x86_64.zip

5编译
$make OS=androID NDKROOT=/home/xxx/PJsIP/androID-ndk-r13b TARGET=androID-22 PREFIX=./androIDlib install-shared
安装的路径androIDlib 后面集成进pJsip 有用,
生成的openh264也有用

集成libvpx && h264 进pJsip

1 下载pJsip2.10
https://github.com/pjsip/pjproject/releases
链接2
https://pjsip.org/download.htm

2 修改配置文件 进入目录/pjlib/include/pj/ 创建文件 config_site.h
复制内容粘贴进去

#define PJ_CONfig_ANDROID 1//To enable vIDeo#define PJMEDIA_HAS_VIDEO 1//To enable libyuv#define PJMEDIA_HAS_libyuv 1//To enable TCP transport#define PJ_HAS_TCP 1#include <pj/config_site_sample.h>

3:编译

TARGET_ABI=armeabi-v7a  APP_PLATFORM=androID-22 ./configure-androID --use-ndk-cflags --with-vpx=/path/to/target/installation--with-openh264=./androIDlib 注意:--with-vpx =编译libvpx 后j静态库安装的路径--with-openh264=编译openh264后安装的路径两个集成 可单独执行,集成单独一个根据提示执行:make dep && make clean && make最后进入 cd pJsip-apps/src/swig 执行make 命令 生成 jni 文件以及so库重新编译一次 需要 clean三个地方$ cd /path/to/your/pJsip/dir$ make clean# cleanup pJsua sample app$ cd pJsip-apps/src/pJsua/androID/jni$ make clean# also cleanup pJsua2 sample app (SWIG)$ cd /path/to/your/pJsip/dir$ cd pJsip-apps/src/swig$ make clean
注意

如果系统默认安装的swig 版本不能低于2.05 可使用 swig -version 查看
可使用linux 4.02
链接:https://pan.baIDu.com/s/1NQBxMrqdQJFzlQLdcKGsHg
提取码:java
复制这段内容后打开百度网盘手机App, *** 作更方便哦

我在ubuntu 中执行编译 2.10的代码会报错,

pjmedia_format_ID.java
pjmedia_event_type.java
使用老版本直接替换

 * This file was automatically generated by SWIG (http://www.swig.org). * Version 4.0.1 * * Do not make changes to this file unless you kNow what you are doing--modify * the SWIG interface file instead. * ----------------------------------------------------------------------------- */package org.pJsip.pJsua2;public final class pjmedia_format_ID {  public final static int PJMEDIA_FORMAT_L16 = 0;  public final static int PJMEDIA_FORMAT_PCM = PJMEDIA_FORMAT_L16;  public final static int PJMEDIA_FORMAT_PCMA = ((('W' << 24)|('A' << 16))|('L' << 8))|'A';  public final static int PJMEDIA_FORMAT_ALAW = PJMEDIA_FORMAT_PCMA;  public final static int PJMEDIA_FORMAT_PCMU = ((('W' << 24)|('A' << 16))|('L' << 8))|'u';  public final static int PJMEDIA_FORMAT_ulAW = PJMEDIA_FORMAT_PCMU;  public final static int PJMEDIA_FORMAT_AMR = ((('R' << 24)|('M' << 16))|('A' << 8))|' ';  public final static int PJMEDIA_FORMAT_G729 = ((('9' << 24)|('2' << 16))|('7' << 8))|'G';  public final static int PJMEDIA_FORMAT_ILBC = ((('C' << 24)|('B' << 16))|('L' << 8))|'I';  public final static int PJMEDIA_FORMAT_RGB24 = ((('3' << 24)|('B' << 16))|('G' << 8))|'R';  public final static int PJMEDIA_FORMAT_RGBA = ((('A' << 24)|('B' << 16))|('G' << 8))|'R';  public final static int PJMEDIA_FORMAT_BGRA = ((('A' << 24)|('R' << 16))|('G' << 8))|'B';  public final static int PJMEDIA_FORMAT_RGB32 = PJMEDIA_FORMAT_RGBA;  public final static int PJMEDIA_FORMAT_DIB = (((' ' << 24)|('B' << 16))|('I' << 8))|'D';  public final static int PJMEDIA_FORMAT_GBRP = ((('P' << 24)|('R' << 16))|('B' << 8))|'G';  public final static int PJMEDIA_FORMAT_AYUV = ((('V' << 24)|('U' << 16))|('Y' << 8))|'A';  public final static int PJMEDIA_FORMAT_YUY2 = ((('2' << 24)|('Y' << 16))|('U' << 8))|'Y';  public final static int PJMEDIA_FORMAT_UYVY = ((('Y' << 24)|('V' << 16))|('Y' << 8))|'U';  public final static int PJMEDIA_FORMAT_YVYU = ((('U' << 24)|('Y' << 16))|('V' << 8))|'Y';  public final static int PJMEDIA_FORMAT_I420 = ((('0' << 24)|('2' << 16))|('4' << 8))|'I';  public final static int PJMEDIA_FORMAT_IYUV = PJMEDIA_FORMAT_I420;  public final static int PJMEDIA_FORMAT_YV12 = ((('2' << 24)|('1' << 16))|('V' << 8))|'Y';  public final static int PJMEDIA_FORMAT_NV21 = ((('1' << 24)|('2' << 16))|('V' << 8))|'N';  public final static int PJMEDIA_FORMAT_I422 = ((('2' << 24)|('2' << 16))|('4' << 8))|'I';  public final static int PJMEDIA_FORMAT_I420JPEG = ((('0' << 24)|('2' << 16))|('4' << 8))|'J';  public final static int PJMEDIA_FORMAT_I422JPEG = ((('2' << 24)|('2' << 16))|('4' << 8))|'J';  public final static int PJMEDIA_FORMAT_H261 = ((('1' << 24)|('6' << 16))|('2' << 8))|'H';  public final static int PJMEDIA_FORMAT_H263 = ((('3' << 24)|('6' << 16))|('2' << 8))|'H';  public final static int PJMEDIA_FORMAT_H263P = ((('3' << 24)|('6' << 16))|('2' << 8))|'P';  public final static int PJMEDIA_FORMAT_H264 = ((('4' << 24)|('6' << 16))|('2' << 8))|'H';  public final static int PJMEDIA_FORMAT_MJPEG = ((('G' << 24)|('P' << 16))|('J' << 8))|'M';  public final static int PJMEDIA_FORMAT_MPEG1VIDEO = ((('V' << 24)|('1' << 16))|('P' << 8))|'M';  public final static int PJMEDIA_FORMAT_MPEG2VIDEO = ((('V' << 24)|('2' << 16))|('P' << 8))|'M';  public final static int PJMEDIA_FORMAT_MPEG4 = ((('4' << 24)|('G' << 16))|('P' << 8))|'M';}
 * Version 4.0.1 * * Do not make changes to this file unless you kNow what you are doing--modify * the SWIG interface file instead. * ----------------------------------------------------------------------------- */package org.pJsip.pJsua2;public final class pjmedia_event_type {  public final static int PJMEDIA_EVENT_NONE = 0;  public final static int PJMEDIA_EVENT_FMT_CHANGED = ((('H' << 24)|('C' << 16))|('M' << 8))|'F';  public final static int PJMEDIA_EVENT_WND_CLOSING = ((('L' << 24)|('C' << 16))|('N' << 8))|'W';  public final static int PJMEDIA_EVENT_WND_CLOSED = ((('O' << 24)|('C' << 16))|('N' << 8))|'W';  public final static int PJMEDIA_EVENT_WND_RESIZED = ((('Z' << 24)|('R' << 16))|('N' << 8))|'W';  public final static int PJMEDIA_EVENT_MOUSE_BTN_DOWN = ((('N' << 24)|('D' << 16))|('S' << 8))|'M';  public final static int PJMEDIA_EVENT_KEYFRAME_FOUND = ((('F' << 24)|('R' << 16))|('F' << 8))|'I';  public final static int PJMEDIA_EVENT_KEYFRAME_MISSING = ((('M' << 24)|('R' << 16))|('F' << 8))|'I';  public final static int PJMEDIA_EVENT_ORIENT_CHANGED = ((('T' << 24)|('N' << 16))|('R' << 8))|'O';  public final static int PJMEDIA_EVENT_RX_RTCP_FB = ((('B' << 24)|('F' << 16))|('T' << 8))|'R';  public final static int PJMEDIA_EVENT_AUD_DEV_ERROR = ((('R' << 24)|('R' << 16))|('E' << 8))|'A';  public final static int PJMEDIA_EVENT_VID_DEV_ERROR = ((('R' << 24)|('R' << 16))|('E' << 8))|'V';  public final static int PJMEDIA_EVENT_MEDIA_TP_ERR = ((('R' << 24)|('R' << 16))|('E' << 8))|'T';}
总结

以上是内存溢出为你收集整理的Android 下 libvpx &&H264编译 以及集成进 pjsip全部内容,希望文章能够帮你解决Android 下 libvpx &&H264编译 以及集成进 pjsip所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1054762.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-25
下一篇 2022-05-25

发表评论

登录后才能评论

评论列表(0条)

保存