VLC crash with wrong announcemnt stream
Posted: 02 Feb 2006 08:41
Hi I use mini sap server in my local network, and I have some stream witch require some specific sap announcement, so I implement net program type in minisap server. I called it raw, it works fine (see patch below). But when I was writing it , I discovered bug in VLC. By mistake I announced stream like
instead of
I just forgot add newline after each line, in result all VLCs(0.8.2,0.8.4a) crashes in my network, I don't have windows machines in my LAN, we use only Mac OS X, so I don't test behavior of windows version VLC in this situation.
This patch add new program type in mini-sap server. I'am not good C++ coder, I prefer perl, so maybe my code is not optimal and may contain errors, but it works for me
Code: Select all
v=0o=QTSS_Play_List 4213894667 201385813 IN IP4 192.168.9.6s=In channel 2c=IN IP4 224.1.2.2b=AS:1605t=0 0
....
Code: Select all
v=0
o=QTSS_Play_List 4213894667 201385813 IN IP4 192.168.9.6
s=Intelsoft channel 2
c=IN IP4 224.1.2.2
b=AS:1605
t=0 0
....
This patch add new program type in mini-sap server. I'am not good C++ coder, I prefer perl, so maybe my code is not optimal and may contain errors, but it works for me
Code: Select all
diff -bruN ./minisapserver-0.3.2/message.cpp ./minisapserver-0.3.2.patched/message.cpp
--- ./minisapserver-0.3.2/message.cpp 2005-07-21 01:23:13.000000000 +0700
+++ ./minisapserver-0.3.2.patched/message.cpp 2006-02-02 11:25:26.000000000 +0600
@@ -176,6 +176,11 @@
sdp += v + o + s + u + t + m + c + a;
+ if ( p->IsRaw() )
+ {
+ sdp = p->GetRaw();
+ }
+
printf("%s\n",sdp.c_str());
return;
diff -bruN ./minisapserver-0.3.2/parser.cpp ./minisapserver-0.3.2.patched/parser.cpp
--- ./minisapserver-0.3.2/parser.cpp 2005-07-21 01:23:13.000000000 +0700
+++ ./minisapserver-0.3.2.patched/parser.cpp 2006-02-02 10:48:14.000000000 +0600
@@ -304,6 +304,14 @@
pp->SetTTL(tline);
}
+ if(strstr(line,"raw="))
+ {
+ strgeta(line,tline,'=');
+ something=1;
+ pp->SetRaw(tline);
+ }
+
+
if(strstr(line,"playlist_group="))
{
ICONV_CONST char *tptr;
@@ -340,6 +348,12 @@
pp->SetRTP(true);
}
+ if(strstr(line,"type=") && strstr(line,"raw") )
+ {
+ pp->SetRawFlag(true);
+ }
+
+
if(strstr(line,"user="))
{
strgeta(line,tline,'=');
diff -bruN ./minisapserver-0.3.2/program.cpp ./minisapserver-0.3.2.patched/program.cpp
--- ./minisapserver-0.3.2/program.cpp 2005-07-21 01:23:23.000000000 +0700
+++ ./minisapserver-0.3.2.patched/program.cpp 2006-02-02 11:30:34.000000000 +0600
@@ -39,6 +39,8 @@
address="";
port="";
permanent = true;
+ b_raw = false;
+ raw = "";
program_ttl = "15";
machine = "localhost";
user = "VideoLAN";
@@ -54,10 +56,12 @@
string Program::GetPort(void){return port;}
string Program::GetTTL(void){return program_ttl;}
string Program::GetPlGroup(void){return pl_group;}
+string Program::GetRaw(void){return raw;}
bool Program::IsPermanent(void){return permanent;}
bool Program::IsRTP(void){return b_rtp;}
bool Program::HasPlGroup(void){return b_has_pl_group;}
+bool Program::IsRaw(void){return b_raw;}
void Program::SetName(char* n){name=n;}
void Program::SetUser(char* u){user=u;}
@@ -67,6 +71,8 @@
void Program::SetPlGroup(char *h){pl_group=h;}
void Program::SetRTP(bool b){b_rtp = b;}
void Program::SetHasPlGroup(bool b){b_has_pl_group = b ;}
+void Program::SetRawFlag(bool b){b_raw = b;}
+void Program::SetRaw(char* s){raw += s; raw += "\n"; }
void Program::SetPort(char* p)
{
int i_port=atoi(p);
@@ -78,7 +84,7 @@
void Program::SetTTL(char *p){program_ttl=p;}
-Program::Program(string n, string u, string m, string s, string a,string p)
+Program::Program(string n, string u, string m, string s, string a,string p,string r)
: b_has_pl_group (false)
{
name=n;
@@ -88,4 +94,5 @@
address=a;
port=p;
permanent=true;
+ raw = r;
}
diff -bruN ./minisapserver-0.3.2/program.h ./minisapserver-0.3.2.patched/program.h
--- ./minisapserver-0.3.2/program.h 2005-07-21 01:23:13.000000000 +0700
+++ ./minisapserver-0.3.2.patched/program.h 2006-02-02 10:07:50.000000000 +0600
@@ -25,7 +25,7 @@
class Program
{
public:
- Program(string, string, string, string, string,string);
+ Program(string, string, string, string, string,string,string);
Program();
~Program();
@@ -38,6 +38,7 @@
string GetPort();
string GetTTL();
string GetPlGroup();
+ string GetRaw();
/* Functions to set the values */
void SetName(char*);
@@ -50,10 +51,13 @@
void SetPlGroup(char *);
void SetHasPlGroup(bool);
void SetRTP(bool);
+ void SetRaw(char *);
+ void SetRawFlag(bool);
bool IsPermanent();
bool IsRTP();
bool HasPlGroup();
+ bool IsRaw();
private:
string name;
@@ -64,9 +68,11 @@
string port;
string program_ttl;
string pl_group;
+ string raw;
bool permanent;
bool b_rtp;
bool b_has_pl_group;
+ bool b_raw;
uint32_t start_time;
uint32_t stop_time;
/* TODO support for periodical programs */
diff -bruN ./minisapserver-0.3.2/sap.cfg ./minisapserver-0.3.2.patched/sap.cfg
--- ./minisapserver-0.3.2/sap.cfg 2005-07-21 00:51:07.000000000 +0700
+++ ./minisapserver-0.3.2.patched/sap.cfg 2006-02-02 11:38:04.000000000 +0600
@@ -68,3 +68,27 @@
program_ttl=12
address=227.65.43.21
port=1234
+
+#RAW Example
+[programm]
+type=raw
+address=224.1.2.2
+raw=v=0
+raw=o=QTSS_Play_List 4213892669 201383815 IN IP4 192.168.9.6
+raw=s=Raw channel 2
+raw=c=IN IP4 224.1.2.2
+raw=b=AS:1605
+raw=t=0 0
+raw=a=x-broadcastcontrol:RTSP
+raw=m=audio 2000 RTP/AVP 96
+raw=b=AS:126
+raw=a=rtpmap:96 mpeg4-generic/44100/2
+raw=a=control:trackID=1
+raw=a=fmtp:96 profile-level-id=15;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3;config=1210
+raw=m=video 2002 RTP/AVP 97
+raw=b=AS:1478
+raw=a=rtpmap:97 MP4V-ES/90000
+raw=a=control:trackID=2
+raw=a=cliprect:0,0,304,704
+raw=a=framesize:97 704-304
+raw=a=fmtp:97 profile-level-id=1;config=0000012000C48D8800CD1604261463