Remove second streambegin from RTMP server, attempted fixes in SendUSR/SendCTL RTMP chunking functions

This commit is contained in:
Thulinma 2011-08-21 17:27:38 +02:00
parent b240874ede
commit 5e7b316d21
3 changed files with 16 additions and 16 deletions

View file

@ -372,7 +372,7 @@ void Connector_RTMP::parseChunk(){
if (!isalpha(*i) && !isdigit(*i)){streamname.erase(i);}else{*i=tolower(*i);}
}
streamname = "/tmp/shared_socket_" + streamname;
Socket.write(RTMPStream::SendUSR(0, 1));//send UCM StreamBegin (0), stream 1
//Socket.write(RTMPStream::SendUSR(0, 1));//send UCM StreamBegin (0), stream 1
//send a status reply
AMF::Object amfreply("container", AMF::AMF0_DDV_CONTAINER);
amfreply.addContent(AMF::Object("", "onStatus"));//status reply
@ -528,7 +528,7 @@ void Connector_RTMP::parseChunk(){
if (!isalpha(*i) && !isdigit(*i)){streamname.erase(i);}else{*i=tolower(*i);}
}
streamname = "/tmp/shared_socket_" + streamname;
Socket.write(RTMPStream::SendUSR(0, 1));//send UCM StreamBegin (0), stream 1
//Socket.write(RTMPStream::SendUSR(0, 1));//send UCM StreamBegin (0), stream 1
//send a status reply
AMF::Object amfreply("container", AMF::AMF0_DDV_CONTAINER);
amfreply.addContent(AMF::Object("", "onStatus"));//status reply

View file

@ -114,10 +114,10 @@ int main(int argc, char ** argv){
fprintf(stderr, "CTRL: Set peer bandwidth: %i\n", RTMPStream::snd_window_size);
break;
case 8:
fprintf(stderr, "Received %i bytes audio data\n", next.len);
if (Detail & (DETAIL_EXPLICIT | DETAIL_RECONSTRUCT)){
F.ChunkLoader(next);
if ((Detail & DETAIL_EXPLICIT) == DETAIL_EXPLICIT){
fprintf(stderr, "Received %i bytes audio data\n", next.len);
std::cerr << "Got a " << F.len << " bytes " << F.tagType() << " FLV tag of time " << F.tagTime() << "." << std::endl;
}
if ((Detail & DETAIL_RECONSTRUCT) == DETAIL_RECONSTRUCT){
@ -126,10 +126,10 @@ int main(int argc, char ** argv){
}
break;
case 9:
fprintf(stderr, "Received %i bytes video data\n", next.len);
if (Detail & (DETAIL_EXPLICIT | DETAIL_RECONSTRUCT)){
F.ChunkLoader(next);
if ((Detail & DETAIL_EXPLICIT) == DETAIL_EXPLICIT){
fprintf(stderr, "Received %i bytes video data\n", next.len);
std::cerr << "Got a " << F.len << " bytes " << F.tagType() << " FLV tag of time " << F.tagTime() << "." << std::endl;
}
if ((Detail & DETAIL_RECONSTRUCT) == DETAIL_RECONSTRUCT){

View file

@ -162,7 +162,7 @@ std::string RTMPStream::SendChunk(unsigned int cs_id, unsigned char msg_type_id,
/// \param ts Timestamp of the media data, relative to current system time.
std::string RTMPStream::SendMedia(unsigned char msg_type_id, unsigned char * data, int len, unsigned int ts){
RTMPStream::Chunk ch;
ch.cs_id = msg_type_id;
ch.cs_id = msg_type_id+42;
ch.timestamp = ts;
ch.len = len;
ch.real_len = len;
@ -199,7 +199,7 @@ std::string RTMPStream::SendCTL(unsigned char type, unsigned int data, unsigned
ch.msg_type_id = type;
ch.msg_stream_id = 0;
ch.data.resize(5);
*(int*)((char*)ch.data.c_str()) = htonl(data);
*(unsigned int*)((char*)ch.data.c_str()) = htonl(data);
ch.data[4] = data2;
return ch.Pack();
}//SendCTL
@ -215,7 +215,7 @@ std::string RTMPStream::SendUSR(unsigned char type, unsigned int data){
ch.msg_type_id = 4;
ch.msg_stream_id = 0;
ch.data.resize(6);
*(int*)((char*)ch.data.c_str()+2) = htonl(data);
*(unsigned int*)((char*)ch.data.c_str()+2) = htonl(data);
ch.data[0] = 0;
ch.data[1] = type;
return ch.Pack();
@ -232,8 +232,8 @@ std::string RTMPStream::SendUSR(unsigned char type, unsigned int data, unsigned
ch.msg_type_id = 4;
ch.msg_stream_id = 0;
ch.data.resize(10);
*(int*)((char*)ch.data.c_str()+2) = htonl(data);
*(int*)((char*)ch.data.c_str()+6) = htonl(data2);
*(unsigned int*)((char*)ch.data.c_str()+2) = htonl(data);
*(unsigned int*)((char*)ch.data.c_str()+6) = htonl(data2);
ch.data[0] = 0;
ch.data[1] = type;
return ch.Pack();