Commit f5ff0eab authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Quite a bunch of SDP conformance fixes.

parent 695afefc
-- Changes from version 0.3.2 to version 0.3.3
* Avoid some useless memory allocations
* Interface selection support for IPv6 announces
* Set default program TTL to 255 similarly
* Include charset session-level attribute
* Lots of conformance fixes:
- tool is a session-level attribute
- default SAP TTL is 255
- IPv6 announces must not include a TTL
- mux and packetformat attributes do not exists
- use CRLF rather than just LF
* Move playlist group and connection infos to session-level
-- Changes from version 0.3.1 to version 0.3.2
* Fix broken multicast TTL setting on IPv4 packets
......
......@@ -103,40 +103,43 @@ bool Message::AddProgram(Program *p)
/* RFC 2327 Compliance ? */
string ipv = (p->GetAddress().find(':') == string::npos) ? "IP4" : "IP6";
string v="v=0\n"; // SDP version
string sdp = "v=0\r\n"; // SDP version
string ver="";
stringstream ssin(ver);
ssin << version;
ver = ssin.str();
string o="o="+p->GetUser()+" "+ver+" 1 IN "+ipv+" "+p->GetMachine()+"\n";
string s="s="+p->GetName()+"\n";
string u="u="+p->GetSite()+"\n";
string t;
if(p->IsPermanent())
t="t=0 0\n";
sdp += "o=" + p->GetUser() + " " + ver + " 1 IN " + ipv + " "
+ p->GetMachine() + "\r\n";
sdp += "s=" + p->GetName() + "\r\n";
sdp += "u=" + p->GetSite() + "\r\n";
sdp += "c=IN " + ipv + " " + p->GetAddress();
if (ipv == "IP4")
sdp += "/" + p->GetTTL(); /* only IPv4 multicast shall have a TTL */
sdp += "\r\n";
if (p->IsPermanent())
sdp += "t=0 0\r\n";
else
return false;
string m = "m=video " + p->GetPort() + " "
+ (p->IsRTP() ? "RTP/AVP" : "udp") +" 33\n";
/* Session level attributes */
sdp += "a=tool:" + (string)PACKAGE_STRING + "\r\n";
string c="c=IN "+ipv+" "+p->GetAddress();
if (ipv == "IP4")
c +="/"+p->GetTTL();
c += "\n";
if (p->HasPlGroup())
sdp += "a=x-plgroup:" + p->GetPlGroup() + "\r\n";
string a = p->IsRTP()
? "a=rtpmap:33 MP2T/90000\n"
: "a=type:udp\na=mux:m2t\na=packetformat:RAW\n";
/* Media and media-level attributes */
sdp += "a=type:broadcast\r\n";
sdp += "a=charset:UTF-8\r\n";
a+= "a=tool:"+(string)PACKAGE_STRING+"\n";
string m = "m=video " + p->GetPort() + " "
+ (p->IsRTP() ? "RTP/AVP" : "udp") +" 33\r\n";
if( p->HasPlGroup() )
{
a+= "a=x-plgroup:"+p->GetPlGroup()+"\n";
}
if (p->IsRTP())
m += "a=rtpmap:33 MP2T/90000\r\n";
string sdp = v + o + s + u + t + m + c + a;
sdp += m;
puts (sdp.c_str ());
......
......@@ -39,7 +39,7 @@ Program::Program() : b_rtp(false), b_has_pl_group(false)
address="";
port="";
permanent = true;
program_ttl = "15";
program_ttl = "255";
machine = "localhost";
user = "VideoLAN";
site = "http://www.videolan.org";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment