ccRTP 2.1.2: rtp.cpp Source File

ccRTP 2.1.2
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 
29 RTPEvent *RTPEvent::first = NULL;
30 
31  RTPEvent::RTPEvent()
32 {
33  next = first;
34  first = this;
35 }
36 
37  RTPAudio::RTPAudio() :
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 
57  void RTPAudio::onGotHello(const SyncSource &src)
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 
88  RTPAudio *rtp;
89 
90 #ifdef CCXX_NAMESPACES
91 }
92 #endif
RTPAudio::unicast
bool unicast
Definition: phone.h:179
rtp
RTPAudio * rtp
Definition: rtp.cpp:88
keythreads
KeyThreads keythreads
Definition: config.cpp:73
SyncSource
Synchronization source in an RTP session.
Definition: sources.h:192
SDESItemTypeCNAME
Canonical end-point identifier.
Definition: rtcppkt.h:67
RTPAudio::groups
unsigned groups
Definition: phone.h:178
KeyRTP::getExpire
microtimeout_t getExpire(void)
Get packet expiration timer.
Definition: phone.h:66
keyrtp
KeyRTP keyrtp
Definition: config.cpp:75
SingleThreadRTPSession::dispatchBYE
size_t dispatchBYE(const std::string &str)
Definition: rtp.h:589
RTPEvent
Process RTP Events for plugins and special purpose classes.
Definition: phone.h:149
Participant
A class of objects representing remote participants (RTP applications) in a multimedia session...
Definition: sources.h:124
RTPAudio::RTPAudio
RTPAudio()
Definition: rtp.cpp:37
SyncSource::getParticipant
Participant * getParticipant() const
Get the participant this synchronization source is asociated to.
Definition: sources.h:268
RTPAudio
This is the base session stack that will maintain all network audio activity.
Definition: phone.h:175
RTPEvent::first
static RTPEvent * first
Definition: phone.h:154
RTPAudio::onGotHello
void onGotHello(const SyncSource &src)
Definition: rtp.cpp:57
SingleThreadRTPSession
This template class adds the threading aspect to the RTPSessionBase template in one of the many possi...
Definition: rtp.h:418
RTPAudio::exit
void exit(const char *reason)
Definition: rtp.cpp:48
SyncSource::getID
uint32 getID() const
Definition: sources.h:257
RTPAudio::onGotGoodbye
void onGotGoodbye(const SyncSource &src, const std::string &reason)
Definition: rtp.cpp:72
KeyRTP::getTimer
microtimeout_t getTimer(void)
Get stack timer.
Definition: phone.h:60
RTPAudio::shutdown
bool shutdown
Definition: phone.h:180
RTPEvent::RTPEvent
RTPEvent()
Definition: rtp.cpp:31
Participant::getSDESItem
const std::string & getSDESItem(SDESItemType type) const
Get the value of an SDES item.
Definition: sources.h:140

Generated on Dec 15, 2017 for ccrtp-2.1.2 (*.h and *.cpp) and libzrtpcpp-2.3.4 (*.h), by   doxygen 1.8.6

AltStyle によって変換されたページ (->オリジナル) /