Code Monkey home page Code Monkey logo

media-server-go's Introduction

media-server-go

Build Status

WebRTC media server for go

How to use

Read the Tutorial

Yon can see the demos from here Demos

Examples

Install

media-server-go is not go getable, so you should clone it and build it yourself.

You should install libtool and autoconf automake before you build

On ubuntu

apt install autoconf
apt install libtool
apt install automake

On macOS

brew install libtool
brew install autoconf
brew install automake

Your compiler should support c++17, for linux, you should update your gcc/g++ to 7.0+

for macos, clang should support c++17.

sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update -qq
sudo apt-get install g++-7
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 90
git clone --recurse-submodules https://github.com/notedit/media-server-go.git  

cd media-server-go

make

go install 

then you can use media-server-go in your project.

Thanks

media-server-go's People

Contributors

feixiao avatar notedit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

media-server-go's Issues

Undefined symbols for architecture x86_64

After successfull installation of native libs installation of media-server-go:

/Library/Developer/CommandLineTools/usr/bin/ranlib: file: /usr/local/var/go/demo-media/src/media-server-go-native/media-server/bin/release/libmediaserver.a(RTPMap.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: /usr/local/var/go/demo-media/src/media-server-go-native/media-server/bin/release/libmediaserver.a(RTPPacketSched.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: /usr/local/var/go/demo-media/src/media-server-go-native/media-server/bin/release/libmediaserver.a(RTPOutgoingSource.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: /usr/local/var/go/demo-media/src/media-server-go-native/media-server/bin/release/libmediaserver.a(RTCPReport.o) has no symbols

When i run demo "media-server-go-demo"
go run webrtc-to-hls/server.go

�My console display (error)

# pkg-config --cflags  -- gstreamer-1.0 gstreamer-base-1.0 gstreamer-app-1.0 gstreamer-plugins-base-1.0 gstreamer-video-1.0 gstreamer-audio-1.0 gstreamer-plugins-bad-1.0
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libffi', required by 'gobject-2.0', not found
pkg-config: exit status 1

# github.com/notedit/media-server-go/wrapper
Undefined symbols for architecture x86_64:
  "RTPSession::SendPacket(RTPPacket&)", referenced from:
      RTPSessionFacade::Enqueue(std::__1::shared_ptr<RTPPacket> const&) in _x004.o
  "RTPPacket::SetPayload(unsigned char const*, unsigned int)", referenced from:
      RawRTPSessionFacade::onRTPPacket(unsigned char*, int) in _x004.o
  "_srtp_crypto_policy_set_aes_gcm_128_16_auth", referenced from:
      RTPTransport::SetLocalCryptoSDES(char const*, unsigned char const*, unsigned int) in libmediaserver.a(RTPTransport.o)
      RTPTransport::SetRemoteCryptoSDES(char const*, unsigned char const*, unsigned int) in libmediaserver.a(RTPTransport.o)
      SRTPSession::Setup(char const*, unsigned char const*, unsigned long) in libmediaserver.a(SRTPSession.o)
  "_srtp_crypto_policy_set_aes_gcm_256_16_auth", referenced from:
      RTPTransport::SetLocalCryptoSDES(char const*, unsigned char const*, unsigned int) in libmediaserver.a(RTPTransport.o)

My gcc version 7.4

gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc@7/7.4.0_2/libexec/gcc/x86_64-apple-darwin18.5.0/7.4.0/lto-wrapper
Target: x86_64-apple-darwin18.5.0
Configured with: ../configure --build=x86_64-apple-darwin18.5.0 --prefix=/usr/local/Cellar/gcc@7/7.4.0_2 --libdir=/usr/local/Cellar/gcc@7/7.4.0_2/lib/gcc/7 --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-7 --with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc --with-isl=/usr/local/opt/isl --with-system-zlib --enable-checking=release --with-pkgversion='Homebrew GCC 7.4.0_2' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues --disable-nls --disable-multilib --with-native-system-header-dir=/usr/include --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
Thread model: posix
gcc version 7.4.0 (Homebrew GCC 7.4.0_2) 

Pls help!!

media-server crashes when i call IncomingStream.Stop() or Transport.Stop()

Hi,

when i call IncomingStream.Stop(), I got the following crash log(mac):

1555322258.905][LOG]<DTLSConnection::GenerateCertificate()
[0x47da5c0][1555322258.905][LOG]<DTLSConnection::Initialize(5)
=== RUN Test_SFUStop
[0x47da5c0][1555322258.905][LOG]-EnableLog [1]
[0x47da5c0][1555322258.905][LOG]>RTPBundleTransport::Init()
[0x47da5c0][1555322258.906][LOG]-RTPBundleTransport::Init() | Got port [57774]
[0x47da5c0][1555322258.906][LOG]<RTPBundleTransport::Init()
[0x700008394000][1555322258.906][LOG]>EventLoop::Run() | [0x6800018]
[0x47da5c0][1555322258.908][LOG]-RTPBundleTransport::AddICETransport [52fdfc072182654f:ez5G]
[0x47da5c0][1555322258.908][LOG]-RemoteRateEstimator adding stream [ssrc:0]
[0x47da5c0][1555322258.908][LOG]-DTLSConnection::SetSRTPProtectionProfiles() [profiles:'']
[0x47da5c0][1555322258.908][LOG]-DTLSICETransport::SetLocalSTUNCredentials() | [frag:52fdfc072182654f,pwd:163f5f0f9a621d729566c74d10037c4d7bbb0407d1e2c649]
[0x47da5c0][1555322258.908][LOG]-DTLSICETransport::SetRemoteSTUNCredentials() | [frag:ez5G,pwd:1F1qS++jzWLSQi0qQDZkX/QV]
[0x47da5c0][1555322258.908][LOG]-DTLSICETransport::SetRemoteCryptoDTLS | [setup:actpass,hash:sha-256,fingerprint:D2:FA:0E:C3:22:59:5E:14:95:69:92:3D:13:B4:84:24:2C:C2:A2:C0:3E:FD:34:8E:5E:EA:6F:AF:52:CE:E6:0F]
[0x47da5c0][1555322258.908][LOG]-DTLSConnection::SetRemoteSetup() | [remote:2]
[0x47da5c0][1555322258.908][LOG]>DTLSConnection::Init()
[0x47da5c0][1555322258.909][LOG]<DTLSConnection::Init()
[0x47da5c0][1555322258.909][LOG]-RTPBundleTransport::AddRemoteCandidate [username:52fdfc072182654f:ez5G,candidate:35.188.215.104:59110}
[0x47da5c0][1555322258.909][LOG]-RTPBundleTransport::AddRemoteCandidate [username:52fdfc072182654f:ez5G,candidate:35.188.215.104:59110}
[0x700008394000][1555322258.910][ERR]-RTPBundleTransport::AddRemoteCandidate already present [candidate:35.188.215.104:59110]
[0x47da5c0][1555322258.910][LOG]-DTLSICETransport::AddIncomingSourceGroup() [mid:'',rid:'',ssrc:3510681183,fec:0,rtx:0]
[0x47da5c0][1555322258.910][LOG]-RemoteRateEstimator adding stream [ssrc:3510681183]
[0xc4202fb410]
[0x47da5c0][1555322258.910][LOG]-DTLSICETransport::AddIncomingSourceGroup() [mid:'',rid:'',ssrc:3004364195,fec:1080772241,rtx:1126032854]
[0x47da5c0][1555322258.910][LOG]-RemoteRateEstimator adding stream [ssrc:3004364195]
[0xc4202fb470]
[0x47da5c0][1555322258.911][LOG]-DTLSICETransport::RemoveIncomingSourceGroup() [mid:'',rid:'',ssrc:3510681183,fec:0,rtx:0]
libc++abi.dylib: terminating with uncaught exception of type std::__1::bad_weak_ptr: bad_weak_ptr
SIGABRT: abort
PC=0x7fff7e255b86 m=0 sigcode=0
signal arrived during cgo execution

goroutine 6 [syscall, locked to thread]:
runtime.cgocall(0x418f090, 0xc4200b9ce8, 0xc4202fb3e0)
/Users/wfli/ks/go/src/runtime/cgocall.go:132 +0xe4 fp=0xc4200b9ca0 sp=0xc4200b9c60 pc=0x40044a4
github.com/notedit/media-server-go/wrapper._Cfunc__wrap_DTLSICETransport_RemoveIncomingSourceGroup_native_a625d9984f014aad(0x6008000, 0x6805400, 0xc420001600)
github.com/notedit/media-server-go/wrapper/_obj/_cgo_gotypes.go:931 +0x4a fp=0xc4200b9ce8 sp=0xc4200b9ca0 pc=0x4104aca
github.com/notedit/media-server-go/wrapper.SwigcptrDTLSICETransport.RemoveIncomingSourceGroup(0x6008000, 0x43a84a0, 0xc4202f1258, 0xc4200b9d88)
/Users/wfli/ks/goworkspace/src/github.com/notedit/media-server-go/wrapper/native.go:3660 +0x42 fp=0xc4200b9d10 sp=0xc4200b9ce8 pc=0x41198f2
github.com/notedit/media-server-go/wrapper.(*SwigcptrDTLSICETransport).RemoveIncomingSourceGroup(0xc4202f0e88, 0x43a84a0, 0xc4202f1258, 0x24)
:1 +0x50 fp=0xc4200b9d40 sp=0xc4200b9d10 pc=0x411c0c0
github.com/notedit/media-server-go.(*IncomingStream).CreateTrack.func1()
/Users/wfli/ks/goworkspace/src/github.com/notedit/media-server-go/incomingstream.go:282 +0x112 fp=0xc4200b9df0 sp=0xc4200b9d40 pc=0x418b942
github.com/notedit/media-server-go.(*IncomingStreamTrack).Stop(0xc420094840)
/Users/wfli/ks/goworkspace/src/github.com/notedit/media-server-go/incomingstreamtrack.go:518 +0x12b fp=0xc4200b9e48 sp=0xc4200b9df0 pc=0x417f85b
github.com/notedit/media-server-go.(*IncomingStream).Stop(0xc4202d7800)
/Users/wfli/ks/goworkspace/src/github.com/notedit/media-server-go/incomingstream.go:315 +0xaa fp=0xc4200b9f00 sp=0xc4200b9e48 pc=0x417ddaa
github.com/notedit/media-server-go.Test_SFUStop(0xc42010a0f0)

build error

Undefined symbols for architecture x86_64:
"_srtp_crypto_policy_set_aes_gcm_128_16_auth", referenced from:
SRTPSession::Setup(char const*, unsigned char const*, unsigned long) in libmediaserver.a(SRTPSession.o)
"_srtp_crypto_policy_set_aes_gcm_256_16_auth", referenced from:
SRTPSession::Setup(char const*, unsigned char const*, unsigned long) in libmediaserver.a(SRTPSession.o)
ld: symbol(s) not found for architecture x86_64

Stream does not display

When I setup your sample rtmp-to-webrtc to the CentOS server, everything is built OK but the video is not played on the web page.

Manually write video packets to outgoing stream

There currently does not seem to be a way to directly write data to an outgoing stream track, similar to the OnMediaFrame callback of the ingoing stream track.
Is there a possibility to add something like a WriteMediaFrame method?

go media-server-go lib build failed on ubuntu 16.04 x64

after successfull installation of native libs installation of media-server-go fails with:

# github.com/notedit/media-server-go/wrapper
/tmp/go-build087762447/b057/_x004.o: In function `RTPSessionFacade::Enqueue(std::shared_ptr<RTPPacket> const&)':
go/src/github.com/notedit/media-server-go/wrapper/mediaserver_wrap.cxx:462: undefined reference to `RTPSession::SendPacket(RTPPacket&)'
go/src/github.com/notedit/media-server-go/wrapper/mediaserver_wrap.cxx:462: undefined reference to `RTPSession::SendPacket(RTPPacket&)'
/tmp/go-build087762447/b057/_x004.o: In function `RawRTPSessionFacade::onRTPPacket(unsigned char*, int)':
go/src/github.com/notedit/media-server-go/wrapper/mediaserver_wrap.cxx:760: undefined reference to `RTPPacket::SetPayload(unsigned char const*, unsigned int)'
collect2: error: ld returned 1 exit status 

Build issue

Hello

I have some issue with building my app
$ GOOS=linux GOARCH=amd64 go build
../../../../notedit/media-server-go/activespeakerdetector.go:5:2: build constraints exclude all Go files in .../go/src/github.com/notedit/media-server-go/wrapper

how to handle reconnectivity issue

How to handle the situation when the stream disconnects and should reconnect. Basically, what I want to do is wait 20 seconds after the initial disconnect, if the stream reconnects then it will resume as it is else it will stop and prompt user to create a new one.

So basically i need pause or resume functionality

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.