diff --git a/src/main.c b/src/main.c index 0ab38c734..3e5e966b2 100644 --- a/src/main.c +++ b/src/main.c @@ -1434,7 +1434,8 @@ int main(int argc, char *argv[]) uint8_t avType; if(strcmp("none", vidcap_params_get_driver(vidcap_params_head)) != 0 && (strcmp("none",audio_send) != 0)) avType = 0; //AVStream else if((strcmp("none",audio_send) != 0)) avType = 2; //AStream - else avType = 1; //VStream + else if(strcmp("none", vidcap_params_get_driver(vidcap_params_head))) avType = 1; //VStream + else printf("[RTSP SERVER] no stream type... check capture devices input\n"); rtsp_server = init_rtsp_server(0, &root_mod, avType); //port, root_module, avType c_start_server(rtsp_server); #endif diff --git a/src/rtsp/BasicRTSPOnlySubsession.cpp b/src/rtsp/BasicRTSPOnlySubsession.cpp index 722572455..03198c912 100644 --- a/src/rtsp/BasicRTSPOnlySubsession.cpp +++ b/src/rtsp/BasicRTSPOnlySubsession.cpp @@ -89,7 +89,7 @@ void BasicRTSPOnlySubsession ::setSDPLines() { //TODO: should be more dynamic //VStream - if(avType == 1){ + if(avType == 1 || avType == 0){ unsigned estBitrate = 5000; char const* mediaType = "video"; uint8_t rtpPayloadType = 96; @@ -123,7 +123,7 @@ void BasicRTSPOnlySubsession fSDPLines = sdpLines; } //AStream - if(avType == 2){ + if(avType == 2 || avType == 0){ unsigned estBitrate = 384; char const* mediaType = "audio"; uint8_t rtpPayloadType = 97; @@ -172,7 +172,7 @@ void BasicRTSPOnlySubsession::getStreamParameters(unsigned clientSessionId, Port& serverRTCPPort, void*& streamToken) { - if(Vdestination == NULL && avType == 1){ + if(Vdestination == NULL && (avType == 1 || avType == 0)){ if (fSDPLines == NULL){ setSDPLines(); } @@ -183,7 +183,7 @@ void BasicRTSPOnlySubsession::getStreamParameters(unsigned clientSessionId, destinationAddr.s_addr = destinationAddress; Vdestination = new Destinations(destinationAddr, clientRTPPort,clientRTCPPort); } - if(Adestination == NULL && avType == 2){ + if(Adestination == NULL && (avType == 2 || avType == 0)){ if (fSDPLines == NULL){ setSDPLines(); } @@ -208,8 +208,7 @@ void BasicRTSPOnlySubsession::startStream(unsigned clientSessionId, struct response *resp = NULL; if (Vdestination != NULL){ - - if(avType == 1){ + if(avType == 1 || avType == 0){ char pathV[1024]; memset(pathV, 0, sizeof(pathV)); @@ -238,8 +237,7 @@ void BasicRTSPOnlySubsession::startStream(unsigned clientSessionId, } if(Adestination != NULL){ - - if(avType == 2){ + if(avType == 2 || avType == 0){ char pathA[1024]; struct msg_sender *msg = (struct msg_sender *) @@ -271,13 +269,10 @@ void BasicRTSPOnlySubsession::startStream(unsigned clientSessionId, } void BasicRTSPOnlySubsession::deleteStream(unsigned clientSessionId, void*& streamToken){ - if (Vdestination == NULL){ - - } else { - char pathV[1024]; - Vdestination = NULL; - - if(avType == 1 || Vdestination != NULL){ + if (Vdestination != NULL){ + if(avType == 1 || avType == 0){ + char pathV[1024]; + Vdestination = NULL; memset(pathV, 0, sizeof(pathV)); enum module_class path_sender[] = { MODULE_CLASS_SENDER, MODULE_CLASS_NONE }; append_message_path(pathV, sizeof(pathV), path_sender); @@ -299,13 +294,10 @@ void BasicRTSPOnlySubsession::deleteStream(unsigned clientSessionId, void*& stre } } - if(Adestination == NULL){ - - } else { - char pathA[1024]; - Adestination = NULL; - - if(avType == 2 || Adestination != NULL){ + if(Adestination != NULL){ + if(avType == 2 || avType == 0){ + char pathA[1024]; + Adestination = NULL; memset(pathA, 0, sizeof(pathA)); enum module_class path_sender[] = { MODULE_CLASS_AUDIO, MODULE_CLASS_SENDER, MODULE_CLASS_NONE }; append_message_path(pathA, sizeof(pathA), path_sender);