media-server-go-demo
media-server-go-demo copied to clipboard
webrtc-to-rtmp demo can't work
Hi , I tested the webrtc-to-rtmp demo, but it can't work. Following is my test steps
- change the IP set in NewRtmpPusher to my nginx-rtmp server, then go build
- run the executable file webrtc-to-rtmp and open the webrtc test web in chrome, I can see myself in local and remote stream.
- there is no log of "video frame ==========" or "audio frame ===== " print, and no rtmp stream send to my nginx-rtmp server
I wondering if there is something wrong in my steps, any suggestion is appreciated~
Were you able to fix it?
After building the main media-server-go
, I executed the command go build
in the webrtc-to-rtmp/
directory and got the following:
$ go build
# github.com/notedit/media-server-go-demo/webrtc-to-rtmp
./server.go:124:30: cannot use func literal (type func([]byte, uint)) as type func([]byte, uint64) in argument to videoTrack.OnMediaFrame
./server.go:139:30: cannot use func literal (type func([]byte, uint)) as type func([]byte, uint64) in argument to audioTrack.OnMediaFrame
@jzvi12 replace uint by uint64 in the server.go file and now it should compile
In commit: f0bcbc9 in the mediaframemultiplexer.go
file the callback logic was disable.
Because in the media-server project (https://github.com/medooze/media-server) not the media-server-go project, some changes where made to media-server/include/media.h
file.
Amongst other things the GetData()
method gets overloaded in a clever way to optimize performance. But this is to much for the SWIG compiler, which then creates 3 functions, one being a switch for the other two, but returning an interface{}
instead of a pointer.
What is to do:
- install swig:
apt install swig
- edit
media-server/include/media.h
and remove follow lineconst BYTE* GetData() const { return buffer->GetData();}
currently at line 166 - edit
wrapper/mediaserver.i
and add%include "../media-server/include/media.h"
before%include "../media-server/include/acumulator.h"
currently at line 965 - run
swig -go -c++ -cgo -intgosize 64 mediaserver.i
- edit
mediaframemultiplexer.go
importfmt
andunsafe
and enable the code underOnMediaFrame
@marcelhencke Do you have some free time to support media-server-go developing? I am a bit busy these days.
@marcelhencke Do you have some free time to support media-server-go developing? I am a bit busy these days.
I don't have much free time myself. But since I want to build on this project and I need the GStreamer support, I would be happy to support the project and maintain it's functionality.