KMS:kurento媒體服務,即 kurento media server
很龐大的一個WEBRTC項目,GIT庫主項目:https://github.com/Kurento
基礎實現,修改了gst-plugin-bad,打開了openh264的插件(依賴於openh264)
然后在其上實現了kms-core, kms-elements, kms-filters,然后實現了相應的服務KMS
官方版本一直只支持ubuntu 16.04,相應docker也是16.04
最新ubuntu編譯時遇到了很多問題,相應修改/調整順序如下:
編譯命令:
dpkg-buildpackage -rfakeroot
編譯鏈接過程:
1.編譯kurento-module-creator
需要安裝debhelper default-jdk maven-debian-helper junit4 libcommons-cli-java libfreemarker-java libgoogle-gson-java libhamcrest-java libmaven-assembly-plugin-java libslf4j-java libwagon-java
需要修改debian/install文件,插入一行
target/classes/FindKurentoModuleCreator.cmake /usr/share/cmake-3.10/Modules/
ubuntu 18.04 的CMAKE版本是3.10
編譯完成后可以刪除
2.安裝kurento-module-creator
需要安裝libcommons-cli-java libfreemarker-java libgoogle-gson-java libslf4j-java
3.編譯kms-cmake-utils
4.安裝kms-cmake-utils
5.編譯kmsjsoncpp
需要取kurento下的jsoncpp庫
會在打包時signfile kmsjsoncpp_1.6.2.dsc失敗,使用dpkg-buildpackage -uc -us避免此錯誤
6.安裝kmsjsoncpp
需要同時安裝kmsjsoncpp-dev包
7.編譯kms-jsonrpc
需要安裝libboost-dev libboost-test-dev
其中的kmsjsoncpp-dev,由上一個流程編譯生成
8.安裝kms-jsonrpc
需要同時安裝kms-jsonrpc-dev包
9.編譯kms-core
編譯依賴:libboost-filesystem-dev libboost-regex-dev libboost-system-dev libglibmm-2.4-dev libsigc++-2.0-dev libvpx-dev
修改debian/control中,所有gstreamer-1.5相關字符全部修改為1.0
a.CMakeLists.txt中gstreamer-1.5相關字符全部修改為1.0
generic_find(LIBNAME gstreamer-1.0 VERSION ${GST_REQUIRED} REQUIRED)
generic_find(LIBNAME gstreamer-base-1.0 VERSION ${GST_REQUIRED} REQUIRED)
generic_find(LIBNAME gstreamer-video-1.0 VERSION ${GST_REQUIRED} REQUIRED)
generic_find(LIBNAME gstreamer-check-1.0 VERSION ${GST_REQUIRED})
generic_find(LIBNAME gstreamer-sdp-1.0 VERSION ${GST_REQUIRED} REQUIRED)
generic_find(LIBNAME gstreamer-pbutils-1.0 VERSION ${GST_REQUIRED} REQUIRED)
generic_find(LIBNAME gstreamer-rtp-1.0 VERSION ${GST_REQUIRED} REQUIRED)
b.一堆CMakeLists.txt中的1.5修改為1.0
c.修復編譯問題GF::GF():
BOOST_GLOBAL_FIXTURE (GF)后需要加;號
調用了std::cerr的,需要包含#include <iostream>
d. 臨時注釋掉CMakelists.txt中的add_subdirectory(tests)
e. 修改debian下kms-core.install,將1.5修改成1.0
10.安裝kms-core/kms-core-dev
11.編譯usrsctp
usrsctplib下的CMakeLists.txt中的
include_directories(${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/netinet ${PROJECT_SOURCE_DIR}/netinet6)
修改為:
include_directories(${PROJECT_SOURCE_DIR}/usrsctplib ${PROJECT_SOURCE_DIR}/usrsctplib/netinet ${PROJECT_SOURCE_DIR}/usrsctplib/netinet6)
error: ‘%s’ directive output truncated writing 73 bytes into a region of size 58 [-Werror=format-truncation=]
snprintf(msg, sizeof(msg), "OOTB, %s:%d at %s", __FILE__, __LINE__, __func__);
的修復辦法,在usrsctplib的CMakeLists.txt中插入
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -D__FILENAME__='\"$(subst ${CMAKE_SOURCE_DIR}/usrsctplib/netinet/,,$(abspath $<))\"'")
在usrsctplib的CMakeLists.txt中插入
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
解決openwebrtc-gst-plugins報告usrsctp的fPIC編譯問題
同時修改所有sctp_input.c/sctp_output.c/sctp_pcb.c中的__FILE__為__FILENAME__
刪除programs下的datachan_serv.c,datachan.h,同時需要刪除此目錄下CMakeLists.txt中編譯datachan_serv.c處
修改libusrsctp.install,將其中的usr/lib/*/lib*.so.*修改為usr/lib/*.so.*
修改libusrsctp-dev.install,將其中的usr/lib/*/*.so修改為usr/lib/*.a
會在打包時signfile時失敗,使用dpkg-buildpackage -uc -us避免此錯誤
12.安裝usrsctp
13.編譯openwebrtc-gst-plugins
修改debian/control,將1.5修改為1.0;修改debain/openwebrtc-gst-plugins.install,將1.5修改為1.0;修改debain/openwebrtc-gst-plugins-dev.install,將1.5修改為1.0
修改debian/openwebrtc-gst-plugins-dev.install,將其中的so修改為a,1.5修改為1.0
修改debian/rules,在dh_auto_configure --上插入一行NOCONFIGURE=1 ./autogen.sh(注意對齊)
修改debian/rules,在之前插入三行
export DEB_CFLAGS_MAINT_APPEND = -fPIC
export DEB_CXXFLAGS_MAINT_APPEND = -fPIC
export DEB_LDFLAGS_MAINT_APPEND = -fPIC
修改configure.ac,將其中的1.5修改為1.0,將-lusrsctp修改為-lusrsctp -lpthread
修改gstreamer-sctp-1.5.pc.in文件名為gstreamer-sctp-1.0.pc.in
修改gstreamer-sctp-1.5-uninstalled.pc.in文件名為gstreamer-sctp-1.0-uninstalled.pc.in
修改gst-libs/gst/sctp下的Makefile.am,將其中的1_5修改為1_0
修改ext/gst/sctp下的Makefile.am,將其中的1.5修改為1.0
修改gst/videorepair,將其中的1.5修改為1.0
修改Makefile.am,將其中的1.5修改為1.0
修改gstreamer-sctp-1.0.pc.in,將其中的1.5修改為1.0
會在打包時signfile時失敗,使用dpkg-buildpackage -uc -us避免此錯誤
14.安裝openwebrtc-gst-plugins
15.編譯openh264
需要編譯Kurento提供的openh264,github/gitlib上是openh264-1
16.安裝openh264
17.編譯openh264-gst-plugins-bad-1.0
編譯依賴:cdbs flite-dev gobject-introspection libasound2-dev libcdaudio-dev libdc1394-22-dev libgudev-1.0-dev libusb-1.0-0-dev libbluetooth-dev libsbc-dev gstreamer1.0-doc gstreamer1.0-plugins-base-doc gtk-doc-tools ladspa-sdk libass-dev libbs2b-dev libbz2-dev libchromaprint-dev libcurl4-gnutls-dev libdca-dev libde265-dev libdvdnav-dev libexempi-dev libexif-dev libfaad-dev libfluidsynth-dev libgirepository1.0-dev libgme-dev libgsm1-dev libiptcdata0-dev libkate-dev liblilv-dev libmjpegtools-dev libmms-dev libmodplug-dev libmpcdec-dev libofa0-dev libopenal-dev libopencv-dev libopenexr-dev libopenjp2-7-dev libopus-dev librsvg2-dev librtmp-dev libsndfile1-dev libsoundtouch-dev libspandsp-dev libsrtp0-dev libvo-aacenc-dev libvo-amrwbenc-dev libwebp-dev libwebrtc-audio-processing-dev libwildmidi-dev libx265-dev libxvidcore-dev libzbar-dev libzvbi-dev libpcap-dev libvulkan-dev libgstreamer-plugins-good1.0-dev libopenmpt-dev libsrtp2-dev
需要從ubuntu 18.04版本對應的取gst-plugins-bad1.0_1.14.1.orig.tar.xz,gst-plugins-bad1.0_1.14.1-1ubuntu1_ubuntu18.04.1.debian.tar.xz
從kurentu中的gst-plugins-bad庫,取得debain目錄下的openh264-gst-plugins-bad-1.0.install/
修改debain/build-deps.in,其后添加依賴openh264, libpcap-dev
修改debian/control.in,其后添加一段
Package: openh264-gst-plugins-bad-@GST_ABI@
Architecture: any
Multi-Arch: same
Pre-Depends: ${misc:Pre-Depends}
Depends: ${misc:Depends},
${shlibs:Depends},
gstreamer@GST_ABI@-plugins-base,
openh264,
libgstreamer-plugins-bad@GST_DEB_ABI@ (= ${binary:Version}),
Description: GStreamer plugins from openh264
18.安裝openh264-gst-plugins-bad-1.0
19.編譯kms-elements
編譯依賴:
修改debian/control中,所有gstreamer-1.5相關字符全部修改為1.0
a.CMakeLists.txt中gstreamer-1.5相關字符全部修改為1.0
generic_find(LIBNAME gstreamer-1.0 VERSION ${GST_REQUIRED} REQUIRED)
generic_find(LIBNAME gstreamer-base-1.0 VERSION ${GST_REQUIRED} REQUIRED)
generic_find(LIBNAME gstreamer-video-1.0 VERSION ${GST_REQUIRED} REQUIRED)
generic_find(LIBNAME gstreamer-app-1.0 VERSION ${GST_REQUIRED} REQUIRED)
generic_find(LIBNAME gstreamer-check-1.0 VERSION ${GST_REQUIRED} REQUIRED)
generic_find(LIBNAME gstreamer-sdp-1.0 VERSION ${GST_REQUIRED} REQUIRED)
generic_find(LIBNAME gstreamer-rtp-1.0 VERSION ${GST_REQUIRED} REQUIRED)
generic_find(LIBNAME gstreamer-pbutils-1.0 VERSION ${GST_REQUIRED} REQUIRED)
generic_find(LIBNAME gstreamer-sctp-1.0 REQUIRED)
b.搜索名下一堆的CMakeLists.txt中,將其中的1.5改成1.0
c.修復編譯問題GF::GF():
BOOST_GLOBAL_FIXTURE (GF)后需要加;號
d.臨時注釋掉tests目錄的編譯,在CMakeLists.txt中修改
# add_subdirectory(tests)
20.安裝kms-elements
21.編譯kms-filters
編譯依賴:libopencv-dev
修改CMakeLists.txt中,所有gstreamer-1.5相關字符全部修改為1.0,同時添加兩行:
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DHAVE_OPENCV_IMGCODECS")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAVE_OPENCV_IMGCODECS")
搜索名下一堆的CMakeLists.txt中,將其中的1.5改成1.0
classifier.cpp文件中Mat frame (img);修改為Mat frame = cvarrToMat(img);
臨時注釋掉add_subdirectory(tests)這一行
修改debian/kms-filters.install,將其中的1.5改成1.0
22.安裝kms-filters
23.編譯kurento-media-server
編譯依賴:libopencv-dev kms-filters-dev libboost-log-dev libboost-program-options-dev libboost-thread-dev libssl1.0-dev
修改CMakeLists.txt中,所有gstreamer-1.5相關字符全部修改為1.0
調用了std::cout的,需要包含#include <iostream>
臨時注釋掉tests目錄的編譯,在CMakeLists.txt中修改
# add_subdirectory(tests)
24.資料信息:
If tests fail, packages are not generated. To skip tests, edit the file debian/rules and change -DGENERATE_TESTS=TRUE to -DGENERATE_TESTS=FALSE -DDISABLE_TESTS=TRUE.
測試失敗有更簡便的修改辦法了
