问题
I'm receiving audio via RTP, so I'm opening input from the SDP I generate.
Media is coming from Port_sender
, IP_sender
. IP and port of the server for listening: IP_server
, Port_server
. Here is my SDP template. What of {Port_sender, IP_sender, IP_server, Port_server}
should I put in {%1%, %2%, %3%}
for the SDP that I feed to ffmpeg and for the SDP that I give back to the sender?
\n\nv=0\n
o=- 0 0 IN IP4 %1%\n
s=name\n
c=IN IP4 %2%\n
t=0 0\n
a=tool:libavformat 57.3.100\n
m=audio %3% RTP/AVP 97\n
b=AS:705\n
a=rtpmap:97 PCMU/44100/2\n"
Debugging it from different IPs is hard for me now. But from one computer it works perfectly.
回答1:
I encourage you to read the RFC 4566, it explains everything you are wondering.
- o= stands for Origin
- c= stands for Connection data
- m= stands for Media descriptions
For the question at hand, I assume you receive a SIP INVITE
with a SDP
offer, and you have to reply with a SIP 200 OK
containing the SDP
reply.
In that scenario you should reply with:
- %1% -> IP_server
- %2% -> IP_server, assuming a uni-cast session "the connection address contains the uni-cast IP address of the expected data source"
- %3% -> Port_sender, since m= is the transport port to which the media stream is sent (Port that was defined by the sender in his offer).
来源:https://stackoverflow.com/questions/36079976/sdp-for-ffmpeg-ip-addresses