Git Product home page Git Product logo

owatch's Introduction

owatch

一个RTP流服务器, 可从获取输入流(H264文件, 域套接字)并封装为RTP包发送

Dependency

Build

make

Build Test

make test

测试程序的使用方法可查看相应程序的源码

Build All

make all 编译主程序和所有测试程序

Build for ARM

make CROSS_COMPILE={your-cross-compile-toolchain-prefix} 指定交叉编译工具链前缀

Usage

play.sdp:

m=video 9000/2 RTP/AVP 96
a=rtpmap:96 H264/90000

使用VLC打开play.sdp文件播放

Note

JRTPLIB的交叉编译

JRTPLIB的源码目录下新建文件toolchain.cmake:

set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_C_COMPILER $(your-cross-compiler-for-C))
set(CMAKE_CXX_COMPILER $(your-cross-compiler-for-C++))

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

CMakeLists.txt中添加:

set(CMAKE_INSTALL_PREFIX $(path-to-your-cross-compile-toolchain-root)
set(CMAKE_FIND_ROOT_PATH $(path-to-your-cross-compile-toolchain-root))

添加后的CMakeLists.txt如下:

...

project(jrtplib)
set(VERSION_MAJOR 3)
set(VERSION_MINOR 11)
set(VERSION_DEBUG 1)
set(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_DEBUG}")

// 添加下面两行
set(CMAKE_INSTALL_PREFIX $(path-to-your-cross-compile-toolchain-root)
set(CMAKE_FIND_ROOT_PATH $(path-to-your-cross-compile-toolchain-root))

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake")
if (CMAKE_INSTALL_PREFIX AND NOT CMAKE_PREFIX_PATH)
    #message("Setting CMAKE_PREFIX_PATH to ${CMAKE_INSTALL_PREFIX}")
    file(TO_CMAKE_PATH "${CMAKE_INSTALL_PREFIX}" CMAKE_PREFIX_PATH)
endif()

...

JRTPLIB交叉编译默认目标平台是大端序,可改为小端序: -DJRTPLIB_USE_BIGENDIAN=OFF

执行cmake . -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake -DJRTPLIB_USE_BIGENDIAN=OFF

然后make && sudo make install

timestampinc的计算

假设采样率为90000Hz, 帧率为24FPS, 则timestamp为90000/24=3750

Linux网络栈参数修改

使用Unix Domain Socket时,不需要考虑网络延迟、丢包等问题,可以发送较大的包,这时候Linux设置的Buffer Size可能会导致发送包失败(EMSGSIZE),可以调整Linux网络参数使较大的包能够成功发送:

查看默认和最大的发送数据包大小:

$ cat /proc/sys/net/core/wmem_default
$ cat /proc/sys/net/core/wmem_max

查看默认和最大的接收数据包大小

$ cat /proc/sys/net/core/rmem_default
$ cat /proc/sys/net/core/rmem_max

可在/etc/sysctl.conf中修改以上参数:

net.core.wmem_default=1048576
net.core.wmem_max=1048576
net.core.rmem_default=1048576
net.core.rmem_max=1048576

使修改生效:

$ sysctl -p

owatch's People

Contributors

lixiangyuan98 avatar

Watchers

 avatar

Forkers

twigcn jjzhang166

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.