diff --git a/src/audio/audiortp.h b/src/audio/audiortp.h index f249201862c6e4908efe4ce1f1943b5cefdd0cec..8410fe9b35770871a94c7bd7ff179ea025dbe600 100644 --- a/src/audio/audiortp.h +++ b/src/audio/audiortp.h @@ -67,7 +67,7 @@ private: /** Buffer for 48000hz samples in conversion */ float32* _floatBuffer48000; - /** Buffer for 8000hz samples for mic conversion */ + /** Buffer for 8000Hz samples for mic conversion */ int16* _intBuffer8000; void initAudioRtpSession(void); @@ -87,9 +87,9 @@ public: void closeRtpSession (); private: - AudioRtpRTX* _RTXThread; + AudioRtpRTX* _RTXThread; bool _symmetric; - ost::Mutex _threadMutex; + ost::Mutex _threadMutex; }; #endif // __AUDIO_RTP_H__ diff --git a/src/audio/ringbuffer.cpp b/src/audio/ringbuffer.cpp index 0a80473b69bb1dc3482e9678dda5584dcdb89347..1a344ab26614e84ce05b50489a4a9e99f0edce6b 100644 --- a/src/audio/ringbuffer.cpp +++ b/src/audio/ringbuffer.cpp @@ -64,6 +64,7 @@ RingBuffer::debug() { // int RingBuffer::AvailForPut() const { + // Always keep 4 bytes safe (?) return (mBufferSize-4) - Len(); } @@ -84,19 +85,23 @@ RingBuffer::Put(void* buffer, int toCopy, unsigned short volume) { copied = 0; pos = mEnd; - //fprintf(stderr, "P"); + while(toCopy) { block = toCopy; - if (block > (mBufferSize - pos)) { // from current pos. to end of buffer + + // Wrap block around ring ? + if (block > (mBufferSize - pos)) { + // Fill in to the end of the buffer block = mBufferSize - pos; } - // put the data inside the buffer. - if (volume!=100) { - SFLDataFormat* start = (SFLDataFormat*)src; + // Gain adjustment (when Mic vol. is changed) + if (volume != 100) { + SFLDataFormat* start = (SFLDataFormat*) src; int nbSample = block / sizeof(SFLDataFormat); for (int i=0; i<nbSample; i++) { start[i] = start[i] * volume / 100; } } + // bcopy(src, dest, len) //fprintf(stderr, "has %d put %d\t", len, block); bcopy (src, mBuffer + pos, block); diff --git a/src/global.h b/src/global.h index 33ccacc939e8037925e4cc19b9e2e9340a2f3cdd..ea441eb8c18657a1634cce5ecdd603d2fbf5cb9b 100644 --- a/src/global.h +++ b/src/global.h @@ -44,7 +44,7 @@ typedef short int16; #ifdef SFLDEBUG #define _debug(...) fprintf(stderr, "[sfl-debug] " __VA_ARGS__) - #define _debugStart(...) fprintf(stderr, "[sfl-debug] " __VA_ARGS__) + #define _debugStart(...) fprintf(stderr, "[sfl-debug] " __VA_ARGS__) #define _debugMid(...) fprintf(stderr, __VA_ARGS__) #define _debugEnd(...) fprintf(stderr, __VA_ARGS__) #define _debugException(...) fprintf(stderr, "[sfl-excep] " __VA_ARGS__ "\n") diff --git a/src/sipvoiplink.cpp b/src/sipvoiplink.cpp index 81ec22db8d93f2feccd2c5e583070342527bb59e..d6d9106935edc39842af6e3aa031974168889e60 100644 --- a/src/sipvoiplink.cpp +++ b/src/sipvoiplink.cpp @@ -339,7 +339,7 @@ SIPVoIPLink::getEvent() case EXOSIP_SUBSCRIPTION_GLOBALFAILURE: /** 43 < announce a global failure */ case EXOSIP_SUBSCRIPTION_NOTIFY: /** 44 < announce new NOTIFY request */ case EXOSIP_SUBSCRIPTION_RELEASED: /** 45 < call context is cleared. */ - Manager::instance().displayError(" !EXOSIP Subscription resposne not implemented yet"); + Manager::instance().displayError(" !EXOSIP Subscription response not implemented yet."); break; case EXOSIP_IN_SUBSCRIPTION_NEW: /** 46 < announce new incoming SUBSCRIBE.*/ @@ -521,7 +521,7 @@ SIPVoIPLink::answer(const CallID& id) eXosip_lock(); int i = eXosip_call_build_answer(call->getTid(), SIP_OK, &answerMessage); if (i != 0) { - _debug("< SIP Building Error: send 400 Bad Request\n"); + _debug("< SIP Building Error: send 400 Bad Request\n"); eXosip_call_send_answer (call->getTid(), SIP_BAD_REQUEST, NULL); } else { // use exosip, bug locked diff --git a/src/sipvoiplink.h b/src/sipvoiplink.h index 65ebc4010d1010c51f0d7331eb1cd3471db0dbb3..3d8a3a7aab2f2cdf80f9123cdef3c17b19c5fb00 100644 --- a/src/sipvoiplink.h +++ b/src/sipvoiplink.h @@ -29,15 +29,16 @@ class EventThread; class SIPCall; /** - * Specific VoIPLink for SIP (SIP core for incoming and outcoming events) + * Specific VoIPLink for SIP (SIP core for incoming and outgoing events) * @author Yan Morin <yan.morin@gmail.com> */ + class SIPVoIPLink : public VoIPLink { public: - SIPVoIPLink(const AccountID& accountID); + SIPVoIPLink(const AccountID& accountID); - ~SIPVoIPLink(); + ~SIPVoIPLink(); /** try to initiate the eXosip engine/thread and set config */ bool init(void); @@ -63,11 +64,20 @@ public: // SIP Specific + /** If set to true, we check for a firewall * @param use true if we use STUN */ void setUseStun(bool use) { _useStun = use; } + + /** The name of the STUN server + * @param server Server FQDN/IP + */ void setStunServer(const std::string& server) { _stunServer = server; } + + /** Set the SIP proxy + * @param proxy Proxy FQDN/IP + */ void setProxy(const std::string& proxy) { _proxy = proxy; } void setUserPart(const std::string& userpart) { _userpart = userpart; } void setAuthName(const std::string& authname) { _authname = authname; } @@ -234,8 +244,10 @@ private: EventThread* _evThread; /** Tell if eXosip was stared (eXosip_init) */ bool _eXosipStarted; + /** Registration identifier, needed by unregister to build message */ int _eXosipRegID; + /** Number of voicemail */ int _nMsgVoicemail; @@ -244,17 +256,19 @@ private: /** Do we use stun? */ bool _useStun; + /** What is the stun server? */ std::string _stunServer; - /** Local Extern Address is the IP address seens by peers for SIP listener */ + /** Local Extern Address is the IP address seen by peers for SIP listener */ std::string _localExternAddress; - /** Local Extern Port is the port seens by peers for SIP listener */ + /** Local Extern Port is the port seen by peers for SIP listener */ unsigned int _localExternPort; /** SIP Proxy URL */ std::string _proxy; + /** SIP UserPart */ std::string _userpart;