From: aeyakovenko <aey...@us...> - 2004-08-12 07:25:59
|
Update of /cvsroot/gaim-vv/gst-jrtp/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13012 Modified Files: Makefile jrtplib_c.cpp Log Message: will now only log to a file if DEBUG is defined Index: Makefile =================================================================== RCS file: /cvsroot/gaim-vv/gst-jrtp/src/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -p -r1.2 -r1.3 --- Makefile 4 Jul 2004 07:53:02 -0000 1.2 +++ Makefile 12 Aug 2004 07:25:46 -0000 1.3 @@ -42,9 +42,9 @@ pkglibdir = $(libdir)/gst-plugin pkgincludedir = $(includedir)/gst-plugin top_builddir = .. -ACLOCAL = aclocal -AUTOCONF = autoconf -AUTOMAKE = automake +ACLOCAL = ${SHELL} /home/aeyakovenko/projects/gst-jrtp/missing --run aclocal +AUTOCONF = ${SHELL} /home/aeyakovenko/projects/gst-jrtp/missing --run autoconf +AUTOMAKE = ${SHELL} /home/aeyakovenko/projects/gst-jrtp/missing --run automake AUTOHEADER = ${SHELL} /home/aeyakovenko/projects/gst-jrtp/missing --run autoheader INSTALL = /bin/install -c @@ -81,7 +81,7 @@ HAVE_PKGCONFIG = yes INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s LIBTOOL = $(SHELL) $(top_builddir)/libtool LN_S = ln -s -MAINT = +MAINT = # OBJDUMP = @OBJDUMP@ OBJEXT = o PACKAGE = gst-plugin @@ -119,9 +119,9 @@ am_libgstjrtp_la_OBJECTS = libgstjrtp_la libgstjrtp_la-gstjrtp.lo libgstjrtp_la_OBJECTS = $(am_libgstjrtp_la_OBJECTS) -DEFS = -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DGST_PLUGIN_VERSION=\"0.1.1.1\" -DGST_PLUGIN_VERSION_RELEASE=\"20040704_004233\" -DPACKAGE=\"gst-plugin\" -DVERSION=\"0.1.1.1\" -DPACKAGE=\"gst-plugin\" -DVERSION=\"0.1.1.1\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 +DEFS = -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DGST_PLUGIN_VERSION=\"0.1.1.1\" -DGST_PLUGIN_VERSION_RELEASE=\"20040812_001821\" -DPACKAGE=\"gst-plugin\" -DVERSION=\"0.1.1.1\" -DPACKAGE=\"gst-plugin\" -DVERSION=\"0.1.1.1\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 DEFAULT_INCLUDES = -I. -I$(srcdir) -CPPFLAGS = +CPPFLAGS = -g -DDEBUG LDFLAGS = LIBS = depcomp = $(SHELL) $(top_srcdir)/depcomp @@ -165,10 +165,10 @@ clean-libtool: distclean-libtool: -rm -f libtool -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) +$(srcdir)/Makefile.in: # Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) cd $(top_srcdir) && \ $(AUTOMAKE) --gnu src/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status +Makefile: # $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && \ CONFIG_HEADERS= CONFIG_LINKS= \ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status Index: jrtplib_c.cpp =================================================================== RCS file: /cvsroot/gaim-vv/gst-jrtp/src/jrtplib_c.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -p -r1.6 -r1.7 --- jrtplib_c.cpp 16 Jul 2004 04:49:44 -0000 1.6 +++ jrtplib_c.cpp 12 Aug 2004 07:25:46 -0000 1.7 @@ -31,7 +31,27 @@ #include <sys/poll.h> #include <errno.h> -std::ofstream *jrtplib_clog(NULL); +#ifdef DEBUG +std::ofstream *jrtplib_clog(NULL); +#endif + +#ifdef DEBUG + #define JRTPLIB_CLOG(string) \ + if(jrtplib_clog == NULL) \ + jrtplib_clog = new std::ofstream("jrtplib_c.log", std::ios_base::app); \ + (*jrtplib_clog)<<string; + #define JRTPLIB_CLOG_CLOSE() \ + if(jrtplib_clog != NULL) \ + {\ + JRTPLIB_CLOG("good bye");\ + jrtplib_clog->close();\ + delete jrtplib_clog;\ + jrtplib_clog = NULL;\ + } +#else + #define JRTPLIB_CLOG(string) + #define JRTPLIB_CLOG_CLOSE() +#endif void checkerror(int rtperr) { @@ -42,22 +62,21 @@ void checkerror(int rtperr) // This function gets the error string for a certain error code errstr = RTPGetErrorString(rtperr); - (*jrtplib_clog)<<"Error: "<<errstr<<std::endl; + JRTPLIB_CLOG("Error: "<<errstr<<std::endl); + //(*jrtplib_clog)<<"Error: "<<errstr<<std::endl; } } //creates a session with a default pt mark and time inc jrtpsession_t jrtpsession_init() { RTPSession* s = new RTPSession(); - //if(sess->SetReceiveMode(RECEIVEMODE_ACCEPTSOME) < 0) - if(s->SetReceiveMode(RECEIVEMODE_ALL) < 0) + //if(s->SetReceiveMode(RECEIVEMODE_ALL) < 0) + if(s->SetReceiveMode(RECEIVEMODE_ACCEPTSOME) < 0) { delete s; return NULL; } checkerror(s->SetMaxPacketSize(RTP_MAXIMUMPACKETSIZE)); - if(jrtplib_clog == NULL) - jrtplib_clog = new std::ofstream("jrtplib_c.log", std::ios_base::app); return s; } int jrtpsession_create(jrtpsession_t sess, unsigned long localportbase) @@ -107,12 +126,12 @@ int jrtpsession_setdestinationaddrs(jrtp semicollon = ips.size(); } std::string ip(ips.substr(0, semicollon)); - (*jrtplib_clog)<<"parsed destination addr "<<ip<<std::endl; + JRTPLIB_CLOG("parsed destination addr "<<ip); if(parsing == true) { ips = ips.substr(semicollon + 1, ips.size() - (semicollon + 1)); - (*jrtplib_clog)<<"left over destination addrs "<<ips<<std::endl; + JRTPLIB_CLOG("left over destination addrs "<<ips); } int port(-1); @@ -127,7 +146,7 @@ int jrtpsession_setdestinationaddrs(jrtp unsigned long addr = inet_addr(ip.c_str()); if(addr != INADDR_NONE) { - (*jrtplib_clog)<<"setting destination addr "<<ip<<":"<<port<<std::endl; + JRTPLIB_CLOG("setting destination addr "<<ip<<":"<<port); addr = ntohl(addr); s->AddDestination(addr, port); } @@ -169,7 +188,7 @@ int jrtpsession_setacceptsourceaddr(jrtp in_addr addr; if(inet_pton(AF_INET, ip.c_str(), &addr) >= 0) { - (*jrtplib_clog)<<"setting accept addr "<<ip<<":"<<port<<std::endl; + JRTPLIB_CLOG("setting accept addr "<<ip<<":"<<port); addr.s_addr = ntohl(addr.s_addr); if(port < 0 || port > 65535) retval = s->AddToAcceptList(addr.s_addr, true, 0); @@ -204,13 +223,7 @@ int jrtpsession_destroy(jrtpsession_t se { RTPSession* s = reinterpret_cast<RTPSession*>(sess); int retval(s->Destroy()); - if(jrtplib_clog) - { - (*jrtplib_clog)<<"good bye"<<std::endl; - jrtplib_clog->close(); - delete jrtplib_clog; - jrtplib_clog = NULL; - } + JRTPLIB_CLOG_CLOSE(); delete s; return retval; } @@ -218,30 +231,30 @@ int jrtpsession_destroy(jrtpsession_t se int jrtpsession_sendpacket(jrtpsession_t sess, void* data, int len) { RTPSession* s = reinterpret_cast<RTPSession*>(sess); - (*jrtplib_clog)<<"total data "<<len<<std::endl; + JRTPLIB_CLOG("total data "<<len); // int i=0; // for(i=0; i+MAXPACKETSIZE < len; i+=MAXPACKETSIZE) // { // checkerror(s->SendPacket((reinterpret_cast<char *>(data) + i), MAXPACKETSIZE)); // s->PollData(); -// (*jrtplib_clog)<<"sent "<<i+MAXPACKETSIZE<<" out of "<<len<<std::endl; +// JRTPLIB_CLOG("sent "<<i+MAXPACKETSIZE<<" out of "<<len); // } // if(i < len) // { // checkerror(s->SendPacket((reinterpret_cast<char *>(data) + i), len - i)); // s->PollData(); -// (*jrtplib_clog)<<"sent "<<(len - i) + i<<" out of "<<len<<std::endl; +// JRTPLIB_CLOG("sent "<<(len - i) + i<<" out of "<<len); // } checkerror(s->SendPacket(data, len)); s->PollData(); - (*jrtplib_clog)<<"sent data exit"<<std::endl; + JRTPLIB_CLOG("sent data exit"); return 0; } int jrtpsession_polldata(jrtpsession_t sess, unsigned char pt, int timeout, char* buffer, unsigned long maxlen) { - (*jrtplib_clog)<<"poll data entry\n"; + JRTPLIB_CLOG("poll data entry\n"); RTPSession* s = reinterpret_cast<RTPSession*>(sess); struct pollfd ufds[3]; @@ -261,13 +274,13 @@ int jrtpsession_polldata(jrtpsession_t s s->PollData(); if(s->GotoFirstSourceWithData() == false) { - (*jrtplib_clog)<<"polling data for "<<timeout<<std::endl; + JRTPLIB_CLOG("polling data for "<<timeout); retval = poll(ufds, 3, timeout); - (*jrtplib_clog)<<"woke up\n"; + JRTPLIB_CLOG("woke up\n"); } else { - (*jrtplib_clog)<<"no need to poll"<<std::endl; + JRTPLIB_CLOG("no need to poll"); retval=1; } s->PollData(); @@ -275,36 +288,36 @@ int jrtpsession_polldata(jrtpsession_t s if(retval > 0) { if(ufds[1].revents & POLLIN == POLLIN) - (*jrtplib_clog)<<"got something on rtp socket\n"; + JRTPLIB_CLOG("got something on rtp socket\n"); if(ufds[2].revents & POLLIN == POLLIN) - (*jrtplib_clog)<<"got something on rtcp socket\n"; + JRTPLIB_CLOG("got something on rtcp socket\n"); if(ufds[3].revents & POLLIN == POLLIN) - (*jrtplib_clog)<<"got something on send socket\n"; + JRTPLIB_CLOG("got something on send socket\n"); if(s->GotoFirstSourceWithData()) { - (*jrtplib_clog)<<"there is a source\n"; + JRTPLIB_CLOG("there is a source\n"); do { RTPPacket* packet = NULL; packet = s->GetNextPacket(); if(packet != NULL) { - (*jrtplib_clog)<<"its a packet\n"; + JRTPLIB_CLOG("its a packet\n"); if( (pt == packet->GetPayloadType()) && (packet->GetPayloadLength() > 0) ) { - (*jrtplib_clog)<<"for our payload type "<<pt<<std::endl; + JRTPLIB_CLOG("for our payload type "<<pt); gotdata = true; retval = packet->GetPayloadLength(); if(maxlen < static_cast<unsigned long>(retval)) { retval = -1; - (*jrtplib_clog)<<"packet is to big "<<retval<<std::endl; + JRTPLIB_CLOG("packet is to big "<<retval); } else { - (*jrtplib_clog)<<"recv data "<<retval<<std::endl; + JRTPLIB_CLOG("recv data "<<retval); memcpy(buffer, packet->GetPayload(), retval); } } @@ -313,7 +326,7 @@ int jrtpsession_polldata(jrtpsession_t s else { int len; - (*jrtplib_clog)<<"get next packet returned NULL"<<std::endl; + JRTPLIB_CLOG("get next packet returned NULL"); if(s->GetCurrentSourceInfo() != NULL) { s->GetCurrentSourceInfo()->FlushPackets(); @@ -325,7 +338,7 @@ int jrtpsession_polldata(jrtpsession_t s } } } - (*jrtplib_clog)<<"polldata exit "<<retval<<std::endl; + JRTPLIB_CLOG("polldata exit "<<retval); return retval; } |