c++ - How do I receive RTP/TCP packets using JRTPLIB V3.11.1? -


use jrtplib v3.11.1 implement rtsp client, , use tcp protocol transmission of rtp packets, rtsp protocol has successful interaction, can not receive rtp data. rtp session created using rtsp socket handle

// class mytcptransmitter : public jrtplib::rtptcptransmitter { public:     mytcptransmitter() : jrtplib::rtptcptransmitter(0), m_name("1") { }      void onsenderror(jrtplib::sockettype sock)     {         std::cout << m_name << ": error sending on socket " << sock << ", removing destination" << std::endl;         deletedestination(jrtplib::rtptcpaddress(sock));     }      void onreceiveerror(jrtplib::sockettype sock)     {         std::cout << m_name << ": error receiving socket " << sock << ", removing destination" << std::endl;         deletedestination(jrtplib::rtptcpaddress(sock));     } private:     std::string m_name; }; 

class myrtpsession : public jrtplib::rtpsession

#include "jrtplib3/rtpudpv4transmitter.h" #include "jrtplib3/rtpsessionparams.h" #include "jrtplib3/rtptcptransmitter.h" #include "jrtplib3/rtptcpaddress.h" using namespace jrtplib; // myrtpsession::myrtpsession() { }  int myrtpsession::create_default(int rtsp_socket) {     rtpsessionparams sessparams;     sessparams.setowntimestampunit(1.0 / 90000.0);     sessparams.setusepollthread(true);      mytcptransmitter trans1;     trans1.init(true);     trans1.create(65535, 0);     trans1.adddestination(jrtplib::rtptcpaddress(rtsp_socket)); //?      int status = create(sessparams, &trans1);     if (status < 0) {         log_warn("rtp socket %d used, choose other one, err:%s", socket,                  rtpgeterrorstring(status).c_str());     }      adddestination(jrtplib::rtptcpaddress(rtsp_socket)); // ?     return status; } 

event loop but it's not helpful

void myrtpsession::onpollthreadstep() {     begindataaccess();      if (gotofirstsourcewithdata()) {         {             rtppacket *pack;             rtpsourcedata *srcdat = getcurrentsourceinfo();             while ((pack = getnextpacket()) != null) {                 processrtppacket(*srcdat, *pack);                 deletepacket(pack);             }         } while (gotonextsourcewithdata());     }      enddataaccess();     poll(); } 

receive method

void myrtpsession::onvalidatedrtppacket(rtpsourcedata *srcdat, rtppacket *rtppack, bool isonprobation, bool *ispackethandled){     //log_info("%s onvalidatedrtppacket", src_name);     //processrtppacket(*srcdat, *rtppack); } 

processing logic

void myrtpsession::processrtppacket(const rtpsourcedata &srcdat, const rtppacket &pack) {     //=========================? } 

how use jrtplib tcp?


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -