~ubuntu-branches/ubuntu/wily/sflphone/wily

« back to all changes in this revision

Viewing changes to daemon/src/iax/iaxvoiplink.h

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2014-01-28 18:23:36 UTC
  • mfrom: (1.1.11)
  • mto: This revision was merged to the branch mainline in revision 24.
  • Revision ID: package-import@ubuntu.com-20140128182336-3xenud1kbnwmf3mz
* New upstream release 
  - Fixes "New Upstream Release" (Closes: #735846)
  - Fixes "Ringtone does not stop" (Closes: #727164)
  - Fixes "[sflphone-kde] crash on startup" (Closes: #718178)
  - Fixes "sflphone GUI crashes when call is hung up" (Closes: #736583)
* Build-Depends: ensure GnuTLS 2.6
  - libucommon-dev (>= 6.0.7-1.1), libccrtp-dev (>= 2.0.6-3)
  - Fixes "FTBFS Build-Depends libgnutls{26,28}-dev" (Closes: #722040)
* Fix "boost 1.49 is going away" unversioned Build-Depends: (Closes: #736746)
* Add Build-Depends: libsndfile-dev, nepomuk-core-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 *  Copyright (C) 2004-2012 Savoir-Faire Linux Inc.
 
2
 *  Copyright (C) 2004-2013 Savoir-Faire Linux Inc.
3
3
 *  Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
4
4
 *  Author: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com>
5
5
 *  Author: Yan Morin <yan.morin@savoirfairelinux.com>
36
36
#include "config.h"
37
37
#endif
38
38
 
39
 
#include <pthread.h>
 
39
#include <mutex>
40
40
#include "account.h"
41
41
#include "voiplink.h"
 
42
#include "audio/audiobuffer.h"
42
43
#include "audio/codecs/audiocodec.h" // for DEC_BUFFER_SIZE
43
44
#include "sfl_types.h"
44
45
#include "noncopyable.h"
191
192
#endif
192
193
        static void clearIaxCallMap();
193
194
        static void addIaxCall(IAXCall* call);
 
195
        // must be called while holding iaxCallMapMutex
194
196
        static IAXCall* getIaxCall(const std::string& id);
195
197
        static void removeIaxCall(const std::string &id);
196
198
 
204
206
    private:
205
207
        NON_COPYABLE(IAXVoIPLink);
206
208
 
 
209
        void handleAccept(iax_event* event, const std::string &id);
 
210
        void handleReject(const std::string &id);
 
211
        void handleRinging(const std::string &id);
 
212
        void handleAnswerTransfer(iax_event* event, const std::string &id);
 
213
        void handleBusy(const std::string &id);
 
214
        void handleMessage(iax_event* event, const std::string &id);
 
215
 
207
216
        /**
208
217
         * Contains a list of all IAX account
209
218
         */
210
219
        static AccountMap iaxAccountMap_;
211
220
 
212
 
        static pthread_mutex_t iaxCallMapMutex_;
 
221
        static std::mutex iaxCallMapMutex_;
213
222
        static IAXCallMap iaxCallMap_;
214
223
 
215
224
        /*
234
243
         * @param session an iax_session valid pointer
235
244
         * @return iaxcall or 0 if not found
236
245
         */
237
 
        IAXCall* iaxFindCallBySession(struct iax_session* session);
 
246
        std::string iaxFindCallIDBySession(struct iax_session* session);
238
247
 
239
248
        /**
240
249
         * Handle IAX Event for a call
241
250
         * @param event An iax_event pointer
242
251
         * @param call  An IAXCall pointer
243
252
         */
244
 
        void iaxHandleCallEvent(iax_event* event, IAXCall* call);
 
253
        void iaxHandleCallEvent(iax_event* event, const std::string &id);
245
254
 
246
255
        /**
247
256
         * Handle the VOICE events specifically
248
257
         * @param event The iax_event containing the IAX_EVENT_VOICE
249
258
         * @param call  The associated IAXCall
250
259
         */
251
 
        void iaxHandleVoiceEvent(iax_event* event, IAXCall* call);
 
260
        void iaxHandleVoiceEvent(iax_event* event, const std::string &id);
252
261
 
253
262
        /**
254
263
         * Handle IAX Registration Reply event
283
292
 
284
293
        /** Mutex for iax_ calls, since we're the only one dealing with the incorporated
285
294
         * iax_stuff inside this class. */
286
 
        pthread_mutex_t mutexIAX_;
 
295
        std::mutex mutexIAX_;
287
296
 
288
297
        /** encoder/decoder/resampler buffers */
289
 
        SFLDataFormat decData_[DEC_BUFFER_SIZE];
290
 
        SFLDataFormat resampledData_[DEC_BUFFER_SIZE * 4];
 
298
        AudioBuffer decData_;
 
299
        AudioBuffer resampledData_;
 
300
        //SFLAudioSample decData_[DEC_BUFFER_SIZE];
 
301
        //SFLAudioSample resampledData_[DEC_BUFFER_SIZE * 4];
291
302
        unsigned char encodedData_[DEC_BUFFER_SIZE];
292
303
 
293
304
        /** Sample rate converter object */