MonaSolutions / MonaServer2

Temporary project planned to replace MonaServer
GNU General Public License v3.0
267 stars 36 forks source link

Can stream via SRT to MonaServer/MonaTiny but cannot access that stream #75

Open maltris opened 4 months ago

maltris commented 4 months ago

Hello,

I am trying to utilize MonaServer/MonaTiny to stream to a server and then fetch that stream from there. With RTMP this works perfectly fine, however I wanted to check out SRT:

ffmpeg -re -i ~/myvid.webm -f mpegts 'srt://127.0.0.1:9710/?streamid=1'

ffplay "srt://127.0.0.1:9710/?streamid=1"

The sender transmits, but the receiver will not be able to fetch any stream. Just empty.

The debug log looks like this:

# Server starts:

Application.cpp[134] MonaTiny v1.770
Application.cpp[136] Load configuration file MonaTiny.ini
Server.cpp[30] 12 threads in server threadPool
Protocol.cpp[52] SRT set 903384749 socket buffers set to 65536B in reception and 65536B in sends
Protocols.h[82] SRT server started on 0.0.0.0:9710

# Publisher connects:

12:42:58.982833/MonaTiny*E:SRT.cn: srt_accept: no pending connection available at the moment
Sessions.h[85] SRT 1-127.0.0.1:45734 created (client.id=440551760f5ac9a26b0288d29548e2b12cba91ab8c2667abd935d6dad799a08c)
MonaTiny.cpp[99] SRT 127.0.0.1:45734 connects to /
Peer.cpp[162] Client 127.0.0.1:45734 connection
Protocol.cpp[51] SRT socket, Operation not supported: Cannot do this operation on a CONNECTED socket
Protocol.cpp[52] SRT set 903384748 socket buffers set to 65536B in reception and 65536B in sends
Publication.cpp[31] New publication 1
MonaTiny.cpp[176] SRT 127.0.0.1:45734 subscribe to 1
ServerAPI.cpp[246] 127.0.0.1:45734 subscribes to 1
Server.cpp[119] 1 clients

# Consumer connects:

12:43:04.058850/MonaTiny*E:SRT.cn: srt_accept: no pending connection available at the moment
Sessions.h[85] SRT 2-127.0.0.1:51515 created (client.id=5f134281ef434dcb3ca9af15e9e4d2d94436aa62b4991f2521e97136dda2e43a)
MonaTiny.cpp[99] SRT 127.0.0.1:51515 connects to /
Peer.cpp[162] Client 127.0.0.1:51515 connection
Protocol.cpp[51] SRT socket, Operation not supported: Cannot do this operation on a CONNECTED socket
Protocol.cpp[52] SRT set 903384747 socket buffers set to 65536B in reception and 65536B in sends
MonaTiny.cpp[176] SRT 127.0.0.1:51515 subscribe to 1
ServerAPI.cpp[246] 127.0.0.1:51515 subscribes to 1
Server.cpp[119] 2 clients

My setup is running in docker but for debug purposes in host networking mode:

docker run --rm -it -v "./MonaServer.ini:/usr/local/bin/MonaTiny.ini" --net=host --name=mona monaimage

The libsrt is 1.5.3 (from Alpine 3.19), MonaServer is commit 13b4eb45705b7ebff2dd6cd93ad11d43aea45dc1.

My MonaServer.ini/MonaTiny.ini looks like this:

description=MonaServer
cores=0
poolBuffers=true
wwwDir="www"
dataDir="data"

[logs]
directory=MonaServer.log
maxSize=1000000
rotation=10

[net]
bufferSize=65536
recvBufferSize=65536
sendBufferSize=65536

[publication]
server=mona
segments=0
duration=0
append=false

[HTTP=false]
[HTTPS=false]
[WS=false]
[WSS=false]
[STUN=false]

[SRT]
; socket bind
port=9710
host=0.0.0.0
publicPort=9710
publicHost=0.0.0.0
; socket parameters, if not set use [net] parameters (see above in CATEGORIZED)
bufferSize=65536
recvBufferSize=65536
sendBufferSize=65536
; SRTO_TLPKTDROP, see https://github.com/Haivision/srt/blob/master/docs/API.md#options
pktdrop=true
; SRTO_PBKEYLEN, see https://github.com/Haivision/srt/blob/master/docs/API.md#options
encryption=0
; SRTO_PASSPHRASE, see https://github.com/Haivision/srt/blob/master/docs/API.md#options
passphrase=
; SRTO_RCVLATENCY, see https://github.com/Haivision/srt/blob/master/docs/API.md#options
;latency=120
; SRTO_PEERLATENCY, see https://github.com/Haivision/srt/blob/master/docs/API.md#options
;peerlatency=0
; SRTO_MSS, see https://github.com/Haivision/srt/blob/master/docs/API.md#options
;mss=1500
; SRTO_OHEADBW, see https://github.com/Haivision/srt/blob/master/docs/API.md#options
overheadbw=25
; SRTO_MAXBW, see https://github.com/Haivision/srt/blob/master/docs/API.md#options
maxbw=-1

[RTMP=false]
[RTMPS=false]
[RTMFP=false]

Any help would be appreciated!