ccRTP 2.1.2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
rtp.cpp
Go to the documentation of this file.
1 // Copyright (C) 2000-2005 Open Source Telecom Corporation.
2 // Copyright (C) 2006-2014 David Sugar, Tycho Softworks.
3 // Copyright (C) 2015 Cherokees of Idaho.
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 
19 #include <cc++/slog.h>
20 #include "server.h"
21 
22 using namespace std;
23 
24 #ifdef CCXX_NAMESPACES
25 namespace ost {
26 using namespace std;
27 #endif
28 
30 
32 {
33  next = first;
34  first = this;
35 }
36 
38 RTPSocket(keyrtp.getInterface(), keyrtp.getPort(), keythreads.priRTP())
39 {
40  rtp = this;
41  setSchedulingTimeout(keyrtp.getTimer());
42  setExpireTimeout(keyrtp.getExpire());
43  groups = 0;
44  unicast = false;
45  shutdown = false;
46 }
47 
48 void RTPAudio::exit(const char *reason)
49 {
50  shutdown = true;
51  dispatchBYE(reason);
52  sleep(500);
53  delete rtp;
54  rtp = NULL;
55 }
56 
58 {
59  RTPEvent *event = RTPEvent::first;
60 
61  slog(Slog::levelDebug) << "hello(" << src.getID() << ") ";
62  Participant* p = src.getParticipant();
63  slog() << p->getSDESItem(SDESItemTypeCNAME) << std::endl;
64 
65  while(event)
66  {
67  event->gotHello(src);
68  event = event->next;
69  }
70 }
71 
72 void RTPAudio::onGotGoodbye(const SyncSource &src, const string& reason)
73 {
74  RTPEvent *event = RTPEvent::first;
75 
76  slog(Slog::levelDebug) << "bye(" << src.getID() << ") ";
77  Participant* p = src.getParticipant();
78  slog() << p->getSDESItem(SDESItemTypeCNAME) << "; " << reason;
79  slog() << std::endl;
80 
81  while(event)
82  {
83  event->gotGoodbye(src, reason);
84  event = event->next;
85  }
86 }
87 
89 
90 #ifdef CCXX_NAMESPACES
91 }
92 #endif
bool unicast
Definition: phone.h:179
RTPAudio * rtp
Definition: rtp.cpp:88
KeyThreads keythreads
Definition: config.cpp:73
Synchronization source in an RTP session.
Definition: sources.h:192
Canonical end-point identifier.
Definition: rtcppkt.h:67
unsigned groups
Definition: phone.h:178
microtimeout_t getExpire(void)
Get packet expiration timer.
Definition: phone.h:66
KeyRTP keyrtp
Definition: config.cpp:75
size_t dispatchBYE(const std::string &str)
Definition: rtp.h:589
Process RTP Events for plugins and special purpose classes.
Definition: phone.h:149
A class of objects representing remote participants (RTP applications) in a multimedia session...
Definition: sources.h:124
RTPAudio()
Definition: rtp.cpp:37
Participant * getParticipant() const
Get the participant this synchronization source is asociated to.
Definition: sources.h:268
This is the base session stack that will maintain all network audio activity.
Definition: phone.h:175
static RTPEvent * first
Definition: phone.h:154
void onGotHello(const SyncSource &src)
Definition: rtp.cpp:57
This template class adds the threading aspect to the RTPSessionBase template in one of the many possi...
Definition: rtp.h:418
void exit(const char *reason)
Definition: rtp.cpp:48
uint32 getID() const
Definition: sources.h:257
void onGotGoodbye(const SyncSource &src, const std::string &reason)
Definition: rtp.cpp:72
microtimeout_t getTimer(void)
Get stack timer.
Definition: phone.h:60
bool shutdown
Definition: phone.h:180
RTPEvent()
Definition: rtp.cpp:31
const std::string & getSDESItem(SDESItemType type) const
Get the value of an SDES item.
Definition: sources.h:140