Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages | Examples

rtp.cpp

Go to the documentation of this file.
00001 // Copyright (C) 2000-2002 Open Source Telecom Corporation.
00002 //
00003 // This program is free software; you can redistribute it and/or modify
00004 // it under the terms of the GNU General Public License as published by
00005 // the Free Software Foundation; either version 2 of the License, or
00006 // (at your option) any later version.
00007 //
00008 // This program is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 // GNU General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU General Public License
00014 // along with this program; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00016 
00017 #include <cc++/slog.h>
00018 #include "server.h"
00019 
00020 #ifdef  CCXX_NAMESPACES
00021 namespace ost {
00022 using namespace std;
00023 #endif
00024 
00025 RTPEvent *RTPEvent::first = NULL;
00026 
00027 RTPEvent::RTPEvent()
00028 {
00029         next = first;
00030         first = this;
00031 }
00032 
00033 RTPAudio::RTPAudio() :
00034 RTPSocket(keyrtp.getInterface(), keyrtp.getPort(), keythreads.priRTP())
00035 {
00036         rtp = this;
00037         setSchedulingTimeout(keyrtp.getTimer());
00038         setExpireTimeout(keyrtp.getExpire());
00039         groups = 0;
00040         unicast = false;
00041         shutdown = false;
00042 }
00043 
00044 void RTPAudio::exit(const char *reason)
00045 {
00046         shutdown = true;
00047         dispatchBYE(reason);
00048         sleep(500);
00049         delete rtp;
00050         rtp = NULL;
00051 }
00052 
00053 void RTPAudio::onGotHello(const SyncSource &src)
00054 {
00055         RTPEvent *event = RTPEvent::first;
00056 
00057         slog(Slog::levelDebug) << "hello(" << src.getID() << ") ";
00058         Participant* p = src.getParticipant();
00059         slog() << p->getSDESItem(SDESItemTypeCNAME) << std::endl;
00060 
00061         while(event)
00062         {
00063                 event->gotHello(src);
00064                 event = event->next;
00065         }
00066 }
00067 
00068 void RTPAudio::onGotGoodbye(const SyncSource &src, const string& reason)
00069 {
00070         RTPEvent *event = RTPEvent::first;
00071 
00072         slog(Slog::levelDebug) << "bye(" << src.getID() << ") ";
00073         Participant* p = src.getParticipant();
00074         slog() << p->getSDESItem(SDESItemTypeCNAME) << "; " << reason;
00075         slog() << std::endl;
00076 
00077         while(event)
00078         {
00079                 event->gotGoodbye(src, reason);
00080                 event = event->next;
00081         }
00082 }
00083         
00084 RTPAudio *rtp;
00085 
00086 #ifdef  CCXX_NAMESPACES
00087 };
00088 #endif

© sourcejam.com 2005-2008