Fixed stream receiving, hopefully...
This commit is contained in:
parent
40bcb2ba72
commit
a586706189
1 changed files with 29 additions and 8 deletions
|
@ -353,12 +353,19 @@ void Connector_RTMP::parseChunk(){
|
||||||
if ((amfdata.getContentP(0)->StrValue() == "publish")){
|
if ((amfdata.getContentP(0)->StrValue() == "publish")){
|
||||||
if (amfdata.getContentP(3)){
|
if (amfdata.getContentP(3)){
|
||||||
streamname = amfdata.getContentP(3)->StrValue();
|
streamname = amfdata.getContentP(3)->StrValue();
|
||||||
bool stoptokens = false;
|
for (std::string::iterator i=streamname.begin(); i != streamname.end(); ++i){
|
||||||
for (std::string::iterator i=streamname.end()-1; i>=streamname.begin(); --i){
|
if (*i == '?'){streamname.erase(i, streamname.end()); break;}
|
||||||
if (*i == '?'){stoptokens = true;}
|
if (!isalpha(*i) && !isdigit(*i)){
|
||||||
if (stoptokens || (!isalpha(*i) && !isdigit(*i))){streamname.erase(i);}else{*i=tolower(*i);}
|
streamname.erase(i);
|
||||||
|
--i;
|
||||||
|
}else{
|
||||||
|
*i=tolower(*i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
streamname = "/tmp/shared_socket_" + streamname;
|
streamname = "/tmp/shared_socket_" + streamname;
|
||||||
|
#if DEBUG >= 4
|
||||||
|
fprintf(stderr, "Connecting to buffer %s...\n", streamname.c_str());
|
||||||
|
#endif
|
||||||
SS = Socket::Connection(streamname);
|
SS = Socket::Connection(streamname);
|
||||||
if (!SS.connected()){
|
if (!SS.connected()){
|
||||||
#if DEBUG >= 1
|
#if DEBUG >= 1
|
||||||
|
@ -367,6 +374,10 @@ void Connector_RTMP::parseChunk(){
|
||||||
Socket.close();//disconnect user
|
Socket.close();//disconnect user
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
SS.write(Socket.getHost()+'\n');
|
||||||
|
#if DEBUG >= 4
|
||||||
|
fprintf(stderr, "Connected to buffer, starting to sent data...\n");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
//send a _result reply
|
//send a _result reply
|
||||||
AMF::Object amfreply("container", AMF::AMF0_DDV_CONTAINER);
|
AMF::Object amfreply("container", AMF::AMF0_DDV_CONTAINER);
|
||||||
|
@ -562,12 +573,19 @@ void Connector_RTMP::parseChunk(){
|
||||||
if ((amfdata.getContentP(0)->StrValue() == "publish")){
|
if ((amfdata.getContentP(0)->StrValue() == "publish")){
|
||||||
if (amfdata.getContentP(3)){
|
if (amfdata.getContentP(3)){
|
||||||
streamname = amfdata.getContentP(3)->StrValue();
|
streamname = amfdata.getContentP(3)->StrValue();
|
||||||
bool stoptokens = false;
|
for (std::string::iterator i=streamname.begin(); i != streamname.end(); ++i){
|
||||||
for (std::string::iterator i=streamname.end()-1; i>=streamname.begin(); --i){
|
if (*i == '?'){streamname.erase(i, streamname.end()); break;}
|
||||||
if (*i == '?'){stoptokens = true;}
|
if (!isalpha(*i) && !isdigit(*i)){
|
||||||
if (stoptokens || (!isalpha(*i) && !isdigit(*i))){streamname.erase(i);}else{*i=tolower(*i);}
|
streamname.erase(i);
|
||||||
|
--i;
|
||||||
|
}else{
|
||||||
|
*i=tolower(*i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
streamname = "/tmp/shared_socket_" + streamname;
|
streamname = "/tmp/shared_socket_" + streamname;
|
||||||
|
#if DEBUG >= 4
|
||||||
|
fprintf(stderr, "Connecting to buffer %s...\n", streamname.c_str());
|
||||||
|
#endif
|
||||||
SS = Socket::Connection(streamname);
|
SS = Socket::Connection(streamname);
|
||||||
if (!SS.connected()){
|
if (!SS.connected()){
|
||||||
#if DEBUG >= 1
|
#if DEBUG >= 1
|
||||||
|
@ -577,6 +595,9 @@ void Connector_RTMP::parseChunk(){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
SS.write(Socket.getHost()+'\n');
|
SS.write(Socket.getHost()+'\n');
|
||||||
|
#if DEBUG >= 4
|
||||||
|
fprintf(stderr, "Connected to buffer, starting to send data...\n");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
//send a _result reply
|
//send a _result reply
|
||||||
AMF::Object amfreply("container", AMF::AMF0_DDV_CONTAINER);
|
AMF::Object amfreply("container", AMF::AMF0_DDV_CONTAINER);
|
||||||
|
|
Loading…
Add table
Reference in a new issue