[Opalvoip-svn] SF.net SVN: opalvoip:[24901] opal/branches/Luyten_A
Brought to you by:
csoutheren,
rjongbloed
From: <rjo...@us...> - 2010-11-22 06:38:54
|
Revision: 24901 http://opalvoip.svn.sourceforge.net/opalvoip/?rev=24901&view=rev Author: rjongbloed Date: 2010-11-22 06:38:46 +0000 (Mon, 22 Nov 2010) Log Message: ----------- Updates from trunk Modified Paths: -------------- opal/branches/Luyten_A/include/codec/opalplugin.h opal/branches/Luyten_A/include/codec/opalpluginmgr.h opal/branches/Luyten_A/include/h323/h323con.h opal/branches/Luyten_A/include/h323/h323pdu.h opal/branches/Luyten_A/include/h323/q931.h opal/branches/Luyten_A/include/opal/connection.h opal/branches/Luyten_A/include/opal/mediastrm.h opal/branches/Luyten_A/include/opal/opalmixer.h opal/branches/Luyten_A/include/opal/patch.h opal/branches/Luyten_A/samples/codectest/main.cxx opal/branches/Luyten_A/samples/opalcodecinfo/main.cxx opal/branches/Luyten_A/samples/openphone/main.cxx opal/branches/Luyten_A/src/codec/opalpluginmgr.cxx opal/branches/Luyten_A/src/h323/h323.cxx opal/branches/Luyten_A/src/h323/h323pdu.cxx opal/branches/Luyten_A/src/h323/h323rtp.cxx opal/branches/Luyten_A/src/h323/q931.cxx opal/branches/Luyten_A/src/opal/connection.cxx opal/branches/Luyten_A/src/opal/mediastrm.cxx opal/branches/Luyten_A/src/opal/opalmixer.cxx opal/branches/Luyten_A/src/opal/patch.cxx opal/branches/Luyten_A/src/opal/transcoders.cxx opal/branches/Luyten_A/version.h Property Changed: ---------------- opal/branches/Luyten_A/ Property changes on: opal/branches/Luyten_A ___________________________________________________________________ Modified: svn:mergeinfo - /opal/branches/Sirius_A:23371,23374,23549,23560,23770 /opal/branches/Sirius_B:24566,24579,24589,24594,24596,24601,24604,24635-24636,24639-24642,24644,24651,24653,24655-24656,24683,24685,24714-24717,24771,24777-24783,24842,24845 /opal/branches/autoconf:20594-21001 /opal/branches/csoutheren/LalandeBranch1:23412-23413,23415,23424,23510,23516,23553,23577,23607,23669,23724,23742-23744,23747-23748,23755,23758,23780,23788,23848,23850,23856 /opal/branches/rjongbloed/BarnardPlus:20584,20656,20749,20751,20756,20762,20786,20789,20814,20820,20829,20831,20841,20843,20923,20927,20938,22016-22017,22518,22582,22941 /opal/branches/v3_2:21143,21220,21227,21253,21455 /opal/branches/v3_4:21060,21062,21088,21092,21111,21113,21115,21119,21143,21148,21151-21152,21155,21158,21184,21188,21253,21265-21266,21283-21284,21298,21300,21303,21307,21309,21311,21327,21331,21333,21359,21367,21369,21488,21556,21564-21565,21568,21570,21620,21625,21631,21748,21751,21756,21759,21761,21767,21770,22246,23044,23140,23143,23286 /opal/branches/v3_6:22169,22178,22184,22186,22197,22204,22216,22251,22253,22255,22258,22260,22291,22296,22300,22306,22308,22313,22319,22336,22353,22358,22436,22447,22449,22497,22511,22517,22519-22521,22527,22536,22538,22589,22596,22599,22617,22620,22622,22630,22640,22655,22675,22682,22726-22728,22730,22733,22738,22745-22746,22800,22820-22821,22842,22844-22845,22851,22853,22889,22896,22902,22904,22906,22918,22924,22928,22946,22965,22967,22976,22978,22980,22982,22994,23028,23123,23125-23126,23128,23157,23165,23173,23175,23183,23294,23341,23465,23467,23474,23521,23829,24346,24809 /opal/branches/v3_8:24025,24027,24029,24036,24038,24040,24042,24048,24050,24058,24061,24068,24071,24074,24076,24080,24082,24086-24087,24092,24099,24101,24105,24107,24109,24111,24114,24116-24117,24120-24121,24125,24127,24130,24132,24134,24138,24140,24144,24146,24148,24150-24151,24154,24156,24158,24162,24170,24218,24245,24257,24261,24340,24362-24363,24365,24369,24373,24422,24440,24442,24447,24489,24504,24506,24532,24536,24545,24547,24552,24554,24614,24678,24687,24699,24705,24775,24833 /opal/trunk:24769-24850 /ptlib/branches/v2_8:24136 /ptlib/trunk:20820 + /opal/branches/Sirius_A:23371,23374,23549,23560,23770 /opal/branches/Sirius_B:24566,24579,24589,24594,24596,24601,24604,24635-24636,24639-24642,24644,24651,24653,24655-24656,24683,24685,24714-24717,24771,24777-24783,24842,24845,24858 /opal/branches/autoconf:20594-21001 /opal/branches/csoutheren/LalandeBranch1:23412-23413,23415,23424,23510,23516,23553,23577,23607,23669,23724,23742-23744,23747-23748,23755,23758,23780,23788,23848,23850,23856 /opal/branches/rjongbloed/BarnardPlus:20584,20656,20749,20751,20756,20762,20786,20789,20814,20820,20829,20831,20841,20843,20923,20927,20938,22016-22017,22518,22582,22941 /opal/branches/v3_2:21143,21220,21227,21253,21455 /opal/branches/v3_4:21060,21062,21088,21092,21111,21113,21115,21119,21143,21148,21151-21152,21155,21158,21184,21188,21253,21265-21266,21283-21284,21298,21300,21303,21307,21309,21311,21327,21331,21333,21359,21367,21369,21488,21556,21564-21565,21568,21570,21620,21625,21631,21748,21751,21756,21759,21761,21767,21770,22246,23044,23140,23143,23286 /opal/branches/v3_6:22169,22178,22184,22186,22197,22204,22216,22251,22253,22255,22258,22260,22291,22296,22300,22306,22308,22313,22319,22336,22353,22358,22436,22447,22449,22497,22511,22517,22519-22521,22527,22536,22538,22589,22596,22599,22617,22620,22622,22630,22640,22655,22675,22682,22726-22728,22730,22733,22738,22745-22746,22800,22820-22821,22842,22844-22845,22851,22853,22889,22896,22902,22904,22906,22918,22924,22928,22946,22965,22967,22976,22978,22980,22982,22994,23028,23123,23125-23126,23128,23157,23165,23173,23175,23183,23294,23341,23465,23467,23474,23521,23829,24346,24809 /opal/branches/v3_8:24025,24027,24029,24036,24038,24040,24042,24048,24050,24058,24061,24068,24071,24074,24076,24080,24082,24086-24087,24092,24099,24101,24105,24107,24109,24111,24114,24116-24117,24120-24121,24125,24127,24130,24132,24134,24138,24140,24144,24146,24148,24150-24151,24154,24156,24158,24162,24170,24218,24245,24257,24261,24340,24362-24363,24365,24369,24373,24422,24440,24442,24447,24489,24504,24506,24532,24536,24545,24547,24552,24554,24614,24678,24687,24699,24705,24775,24833,24861 /opal/trunk:24769-24900 /ptlib/branches/v2_8:24136 /ptlib/trunk:20820 Modified: opal/branches/Luyten_A/include/codec/opalplugin.h =================================================================== --- opal/branches/Luyten_A/include/codec/opalplugin.h 2010-11-22 03:17:23 UTC (rev 24900) +++ opal/branches/Luyten_A/include/codec/opalplugin.h 2010-11-22 06:38:46 UTC (rev 24901) @@ -72,12 +72,15 @@ #endif #define PWLIB_PLUGIN_API_VERSION 1 -#define PLUGIN_CODEC_VERSION 1 // initial version +#define PLUGIN_CODEC_VERSION_FIRST 1 // initial version #define PLUGIN_CODEC_VERSION_WIDEBAND 2 // added wideband #define PLUGIN_CODEC_VERSION_VIDEO 3 // added video #define PLUGIN_CODEC_VERSION_FAX 4 // added fax #define PLUGIN_CODEC_VERSION_OPTIONS 5 // added options handling +#define PLUGIN_CODEC_VERSION_INTERSECT 6 // added media option intersection merge functionality +#define PLUGIN_CODEC_VERSION PLUGIN_CODEC_VERSION_INTERSECT // Always latest version + #define PLUGIN_CODEC_API_VER_FN PWLibPlugin_GetAPIVersion #define PLUGIN_CODEC_API_VER_FN_STR "PWLibPlugin_GetAPIVersion" Modified: opal/branches/Luyten_A/include/codec/opalpluginmgr.h =================================================================== --- opal/branches/Luyten_A/include/codec/opalpluginmgr.h 2010-11-22 03:17:23 UTC (rev 24900) +++ opal/branches/Luyten_A/include/codec/opalpluginmgr.h 2010-11-22 06:38:46 UTC (rev 24901) @@ -325,7 +325,7 @@ bool DecodeFrames(const RTP_DataFrame & src, RTP_DataFrameList & dstList); RTP_DataFrame * m_bufferRTP; - PTimeInterval m_lastVideoPictureLoss; + PSimpleTimer m_videoPictureLossTimer; #if PTRACING unsigned m_consecutiveIntraFrames; Modified: opal/branches/Luyten_A/include/h323/h323con.h =================================================================== --- opal/branches/Luyten_A/include/h323/h323con.h 2010-11-22 03:17:23 UTC (rev 24900) +++ opal/branches/Luyten_A/include/h323/h323con.h 2010-11-22 06:38:46 UTC (rev 24901) @@ -114,6 +114,11 @@ #endif +/**OpalConnection::StringOption key to an . Default true. + */ +#define OPAL_OPT_Q931_BEARER_CAPS "Q931-Bearer-Caps" + + /////////////////////////////////////////////////////////////////////////////// /**This class represents a particular H323 connection between two endpoints. Modified: opal/branches/Luyten_A/include/h323/h323pdu.h =================================================================== --- opal/branches/Luyten_A/include/h323/h323pdu.h 2010-11-22 03:17:23 UTC (rev 24900) +++ opal/branches/Luyten_A/include/h323/h323pdu.h 2010-11-22 06:38:46 UTC (rev 24901) @@ -513,10 +513,6 @@ PString H323GetRTPPacketization( const H245_RTPPayloadType & rtpPacketization ); -bool H323GetRTPPacketization( - OpalMediaFormat & mediaFormat, - const H245_RTPPayloadType & rtpPacketization -); PString H323GetCapabilityIdentifier( const H245_CapabilityIdentifier & capId Modified: opal/branches/Luyten_A/include/h323/q931.h =================================================================== --- opal/branches/Luyten_A/include/h323/q931.h 2010-11-22 03:17:23 UTC (rev 24900) +++ opal/branches/Luyten_A/include/h323/q931.h 2010-11-22 06:38:46 UTC (rev 24901) @@ -154,6 +154,9 @@ unsigned codingStandard = 0, ///< 0 = ITU-T standardized coding unsigned userInfoLayer1 = 5 ///< 5 = Recommendations H.221 and H.242 ); + void SetBearerCapabilities( + const PString & caps ///< String of comma separated integers or hex for all cap bytes + ); PBoolean GetBearerCapabilities( InformationTransferCapability & capability, ///< Bearer cability enum Modified: opal/branches/Luyten_A/include/opal/connection.h =================================================================== --- opal/branches/Luyten_A/include/opal/connection.h 2010-11-22 03:17:23 UTC (rev 24900) +++ opal/branches/Luyten_A/include/opal/connection.h 2010-11-22 06:38:46 UTC (rev 24901) @@ -1794,6 +1794,7 @@ #if OPAL_AEC OpalEchoCanceler * echoCanceler; #endif + OpalMediaFormat m_filterMediaFormat; MediaAddressesDict mediaTransportAddresses; PSafeList<OpalMediaStream> mediaStreams; @@ -1812,12 +1813,12 @@ PNotifier m_dtmfDetectNotifier; PDECLARE_NOTIFIER(RTP_DataFrame, OpalConnection, OnDetectInBandDTMF); - bool m_sendInBandDTMF; - bool m_installedInBandDTMF; - PDTMFEncoder m_inBandDTMF; - PINDEX m_emittedInBandDTMF; - PMutex m_inBandMutex; - PNotifier m_dtmfSendNotifier; + bool m_sendInBandDTMF; + OpalMediaFormat m_dtmfSendFormat; + PBYTEArray m_inBandDTMF; + PINDEX m_emittedInBandDTMF; + PMutex m_inBandMutex; + PNotifier m_dtmfSendNotifier; PDECLARE_NOTIFIER(RTP_DataFrame, OpalConnection, OnSendInBandDTMF); #endif Modified: opal/branches/Luyten_A/include/opal/mediastrm.h =================================================================== --- opal/branches/Luyten_A/include/opal/mediastrm.h 2010-11-22 03:17:23 UTC (rev 24900) +++ opal/branches/Luyten_A/include/opal/mediastrm.h 2010-11-22 06:38:46 UTC (rev 24901) @@ -311,10 +311,12 @@ virtual PBoolean RequiresPatchThread() const; // For backward compatibility /**Enable jitter buffer for the media stream. + Returns true if a jitter buffer is enabled/disabled. Returns false if + no jitter buffer exists for the media stream. - The default behaviour does nothing. + The default behaviour does nothing and returns false. */ - virtual void EnableJitterBuffer(bool enab = true) const; + virtual bool EnableJitterBuffer(bool enab = true) const; //@} /**@name Member variable access */ @@ -609,10 +611,13 @@ virtual PBoolean RequiresPatchThread() const; /**Enable jitter buffer for the media stream. + Returns true if a jitter buffer is enabled/disabled. Returns false if + no jitter buffer exists for the media stream. - The default behaviour does nothing. + The default behaviour sets the RTP_Session jitter buffer size according + to the connection parameters, then returns true. */ - virtual void EnableJitterBuffer(bool enab = true) const; + virtual bool EnableJitterBuffer(bool enab = true) const; /**Set the patch thread that is using this stream. */ Modified: opal/branches/Luyten_A/include/opal/opalmixer.h =================================================================== --- opal/branches/Luyten_A/include/opal/opalmixer.h 2010-11-22 03:17:23 UTC (rev 24900) +++ opal/branches/Luyten_A/include/opal/opalmixer.h 2010-11-22 06:38:46 UTC (rev 24901) @@ -928,6 +928,15 @@ then threading is from the mixer class. */ virtual PBoolean RequiresPatchThread() const; + + /**Enable jitter buffer for the media stream. + Returns true if a jitter buffer is enabled/disabled. Returns false if + no jitter buffer exists for the media stream. + + The default behaviour sets the mixer jitter buffer size according + to the connection parameters, then returns true. + */ + virtual bool EnableJitterBuffer(bool enab = true) const; //@} /**@name Member variable access */ @@ -1020,6 +1029,18 @@ OpalConnection * connection = NULL ///< Just deleted connection ); + /**Sets the size of the jitter buffer to be used by the specified stream + in this mixer. A mixer defaults to not having any jitter buffer enabled. + + If either jitter delay parameter is zero, it destroys the jitter buffer + attached to this mixer. + */ + bool SetJitterBufferSize( + const OpalBaseMixer::Key_T & key, ///< key for mixer stream + unsigned minJitterDelay, ///< Minimum jitter buffer delay in RTP timestamp units + unsigned maxJitterDelay ///< Maximum jitter buffer delay in RTP timestamp units + ) { return m_audioMixer.SetJitterBufferSize(key, minJitterDelay, maxJitterDelay); } + /**Write data to mixer. */ bool WriteAudio( Modified: opal/branches/Luyten_A/include/opal/patch.h =================================================================== --- opal/branches/Luyten_A/include/opal/patch.h 2010-11-22 03:17:23 UTC (rev 24900) +++ opal/branches/Luyten_A/include/opal/patch.h 2010-11-22 06:38:46 UTC (rev 24901) @@ -248,7 +248,8 @@ /**Called from the associated patch thread */ virtual void Main(); bool DispatchFrame(RTP_DataFrame & frame); - + bool EnableJitterBuffer(); + OpalMediaStream & source; class Sink : public PObject { Modified: opal/branches/Luyten_A/samples/codectest/main.cxx =================================================================== --- opal/branches/Luyten_A/samples/codectest/main.cxx 2010-11-22 03:17:23 UTC (rev 24900) +++ opal/branches/Luyten_A/samples/codectest/main.cxx 2010-11-22 06:38:46 UTC (rev 24901) @@ -121,7 +121,7 @@ PluginCodec_GetCodecFunction getCodecs; if (plugin.GetFunction(PLUGIN_CODEC_GET_CODEC_FN_STR, (PDynaLink::Function &)getCodecs)) { unsigned count = 0; - PluginCodec_Definition * codecs = (*getCodecs)(&count, PLUGIN_CODEC_VERSION_OPTIONS); + PluginCodec_Definition * codecs = (*getCodecs)(&count, PLUGIN_CODEC_VERSION); while (count > 0) { PString name(codecs->descr); if (codecNames.GetStringsIndex(name) == P_MAX_INDEX) Modified: opal/branches/Luyten_A/samples/opalcodecinfo/main.cxx =================================================================== --- opal/branches/Luyten_A/samples/opalcodecinfo/main.cxx 2010-11-22 03:17:23 UTC (rev 24900) +++ opal/branches/Luyten_A/samples/opalcodecinfo/main.cxx 2010-11-22 06:38:46 UTC (rev 24901) @@ -384,7 +384,7 @@ return; } unsigned int count; - PluginCodec_Definition * codecs = (*getCodecs)(&count, PLUGIN_CODEC_VERSION_OPTIONS); + PluginCodec_Definition * codecs = (*getCodecs)(&count, PLUGIN_CODEC_VERSION); if (codecs == NULL || count == 0) { cout << "error: " << name << " does not define any codecs for this version of the plugin API" << endl; return; Modified: opal/branches/Luyten_A/samples/openphone/main.cxx =================================================================== --- opal/branches/Luyten_A/samples/openphone/main.cxx 2010-11-22 03:17:23 UTC (rev 24900) +++ opal/branches/Luyten_A/samples/openphone/main.cxx 2010-11-22 06:38:46 UTC (rev 24901) @@ -2177,6 +2177,8 @@ PwxString title = m_activeCall->IsNetworkOriginated() ? m_activeCall->GetPartyA() : m_activeCall->GetPartyB(); m_tabs->AddPage(new InCallPanel(*this, token, m_tabs), title, true); } + else + RemoveCallOnHold(token); } } @@ -5763,7 +5765,6 @@ { m_Hold = FindWindowByNameAs<wxButton>(this, wxT("Hold")); m_Conference = FindWindowByNameAs<wxButton>(this, wxT("Conference")); - m_Conference->Enable(!m_manager.m_callsOnHold.empty()); m_SpeakerHandset = FindWindowByNameAs<wxButton>(this, wxT("SpeakerHandset")); m_SpeakerMute = FindWindowByNameAs<wxCheckBox>(this, wxT("SpeakerMute")); m_MicrophoneMute = FindWindowByNameAs<wxCheckBox>(this, wxT("MicrophoneMute")); @@ -5772,6 +5773,8 @@ m_vuSpeaker = FindWindowByNameAs<wxGauge>(this, wxT("SpeakerGauge")); m_vuMicrophone = FindWindowByNameAs<wxGauge>(this, wxT("MicrophoneGauge")); + OnHoldChanged(false); + m_vuTimer.Start(250); m_pages[RxAudio].Init(this, RxAudio, OpalMediaType::Audio(), true ); @@ -5839,9 +5842,15 @@ void InCallPanel::OnHoldChanged(bool onHold) { + PSafePtr<OpalCall> call = m_manager.FindCallWithLock(m_token, PSafeReadOnly); + if (PAssertNULL(call) == NULL) + return; + + bool notConferenced = call->GetConnectionAs<OpalMixerConnection>() == NULL; + m_Hold->SetLabel(onHold ? wxT("Retrieve") : wxT("Hold")); - m_Hold->Enable(true); - m_Conference->Enable(!onHold && !m_manager.m_callsOnHold.empty()); + m_Hold->Enable(notConferenced); + m_Conference->Enable(!onHold && !m_manager.m_callsOnHold.empty() && notConferenced); } @@ -5875,8 +5884,11 @@ void InCallPanel::OnConference(wxCommandEvent & /*event*/) { - if (m_manager.m_activeCall != NULL && m_token == m_manager.m_activeCall->GetToken()) + if (m_manager.m_activeCall != NULL && m_token == m_manager.m_activeCall->GetToken()) { m_manager.AddToConference(*m_manager.m_callsOnHold.front().m_call); + m_Conference->Enable(false); + m_Hold->Enable(false); + } } Modified: opal/branches/Luyten_A/src/codec/opalpluginmgr.cxx =================================================================== --- opal/branches/Luyten_A/src/codec/opalpluginmgr.cxx 2010-11-22 03:17:23 UTC (rev 24900) +++ opal/branches/Luyten_A/src/codec/opalpluginmgr.cxx 2010-11-22 06:38:46 UTC (rev 24901) @@ -852,7 +852,6 @@ : OpalVideoTranscoder(codecDefn->sourceFormat, codecDefn->destFormat) , OpalPluginTranscoder(codecDefn, isEncoder) , m_bufferRTP(NULL) - , m_lastVideoPictureLoss(0) #if PTRACING , m_consecutiveIntraFrames(0) #endif @@ -1021,14 +1020,13 @@ } if ((flags & PluginCodec_ReturnCoderRequestIFrame) != 0) { - PTimeInterval tick = PTimer::Tick(); // Don't send lots of consecutive OpalVideoPictureLoss commands - if (tick - m_lastVideoPictureLoss < 2000) + if (m_videoPictureLossTimer.IsRunning()) PTRACE(4, "OpalPlugin\tCould not decode frame, but a recent OpalVideoPictureLoss was sent."); else { - m_lastVideoPictureLoss = PTimer::Tick(); - NotifyCommand(OpalVideoPictureLoss(src.GetSequenceNumber(), src.GetTimestamp())); PTRACE(3, "OpalPlugin\tCould not decode frame, sending OpalVideoPictureLoss in hope of an I-Frame."); + NotifyCommand(OpalVideoPictureLoss(src.GetSequenceNumber(), src.GetTimestamp())); + m_videoPictureLossTimer.SetInterval(0, 2); } } @@ -1057,7 +1055,7 @@ if ((flags & PluginCodec_ReturnCoderIFrame) != 0) { m_keyFrames++; - PTRACE(5, "OpalPlugin\tVideo decoder returned I-frame"); + PTRACE(5, "OpalPlugin\tVideo decoder returned I-Frame"); } } } @@ -1345,7 +1343,7 @@ } unsigned int count; - PluginCodec_Definition * codecs = (*getCodecs)(&count, PLUGIN_CODEC_VERSION_OPTIONS); + PluginCodec_Definition * codecs = (*getCodecs)(&count, PLUGIN_CODEC_VERSION); if (codecs == NULL || count == 0) { PTRACE(1, "OpalPlugin\tPlugin Codec DLL " << dll.GetName() << " contains no codec definitions"); return; @@ -1394,7 +1392,7 @@ PluginCodec_GetCodecFunction getCodecFn) { unsigned int count; - PluginCodec_Definition * codecs = (*getCodecFn)(&count, PLUGIN_CODEC_VERSION_OPTIONS); + PluginCodec_Definition * codecs = (*getCodecFn)(&count, PLUGIN_CODEC_VERSION); if (codecs == NULL || count == 0) { PTRACE(1, "OpalPlugin\tStatic codec " << name << " contains no codec definitions"); return; Modified: opal/branches/Luyten_A/src/h323/h323.cxx =================================================================== --- opal/branches/Luyten_A/src/h323/h323.cxx 2010-11-22 03:17:23 UTC (rev 24900) +++ opal/branches/Luyten_A/src/h323/h323.cxx 2010-11-22 06:38:46 UTC (rev 24901) @@ -1973,16 +1973,15 @@ } // Search the capability set and see if we have video capability - PBoolean hasVideoOrData = PFalse; + const char * bearerCaps = "Speech,1"; // TransferSpeech, 1 x 64k bearer for (PINDEX i = 0; i < localCapabilities.GetSize(); i++) { if (!PIsDescendant(&localCapabilities[i], H323AudioCapability) && !PIsDescendant(&localCapabilities[i], H323_UserInputCapability)) { - hasVideoOrData = PTrue; + bearerCaps = "Digital,6"; // Unrestricted digital, 384 kbps (6 bearers) break; } } - if (hasVideoOrData) - setupPDU.GetQ931().SetBearerCapabilities(Q931::TransferUnrestrictedDigital, 6); + setupPDU.GetQ931().SetBearerCapabilities(m_stringOptions(OPAL_OPT_Q931_BEARER_CAPS, bearerCaps)); if (!OnSendSignalSetup(setupPDU)) return EndedByNoAccept; Modified: opal/branches/Luyten_A/src/h323/h323pdu.cxx =================================================================== --- opal/branches/Luyten_A/src/h323/h323pdu.cxx 2010-11-22 03:17:23 UTC (rev 24900) +++ opal/branches/Luyten_A/src/h323/h323pdu.cxx 2010-11-22 06:38:46 UTC (rev 24901) @@ -460,18 +460,6 @@ } -bool H323GetRTPPacketization(OpalMediaFormat & mediaFormat, const H245_RTPPayloadType & rtpPacketization) -{ - PString mediaPacketization = H323GetRTPPacketization(rtpPacketization); - if (mediaPacketization.IsEmpty()) - return false; - - mediaFormat.SetOptionString(OpalMediaFormat::MediaPacketizationsOption(), mediaPacketization); - mediaFormat.SetOptionString(OpalMediaFormat::MediaPacketizationOption(), mediaPacketization.Left(mediaPacketization.Find(','))); - return true; -} - - PString H323GetCapabilityIdentifier(const H245_CapabilityIdentifier & capId) { switch (capId.GetTag()) { Modified: opal/branches/Luyten_A/src/h323/h323rtp.cxx =================================================================== --- opal/branches/Luyten_A/src/h323/h323rtp.cxx 2010-11-22 03:17:23 UTC (rev 24900) +++ opal/branches/Luyten_A/src/h323/h323rtp.cxx 2010-11-22 06:38:46 UTC (rev 24901) @@ -177,11 +177,17 @@ if (param.HasOptionalField(H245_H2250LogicalChannelParameters::e_dynamicRTPPayloadType)) channel.SetDynamicRTPPayloadType(param.m_dynamicRTPPayloadType); + PString mediaPacketization; if (param.HasOptionalField(H245_H2250LogicalChannelParameters::e_mediaPacketization) && - param.m_mediaPacketization.GetTag() == H245_H2250LogicalChannelParameters_mediaPacketization::e_rtpPayloadType) { - OpalMediaFormat mediaFormat = channel.GetMediaStream()->GetMediaFormat(); - if (H323GetRTPPacketization(mediaFormat, param.m_mediaPacketization)) - channel.GetMediaStream()->UpdateMediaFormat(mediaFormat); + param.m_mediaPacketization.GetTag() == H245_H2250LogicalChannelParameters_mediaPacketization::e_rtpPayloadType) + mediaPacketization = H323GetRTPPacketization(param.m_mediaPacketization); + + OpalMediaFormat mediaFormat = channel.GetMediaStream()->GetMediaFormat(); + if (mediaFormat.GetOptionString(OpalMediaFormat::MediaPacketizationsOption()) != mediaPacketization || + mediaFormat.GetOptionString(OpalMediaFormat::MediaPacketizationOption()) != mediaPacketization) { + mediaFormat.SetOptionString(OpalMediaFormat::MediaPacketizationsOption(), mediaPacketization); + mediaFormat.SetOptionString(OpalMediaFormat::MediaPacketizationOption(), mediaPacketization); + channel.GetMediaStream()->UpdateMediaFormat(mediaFormat); } if (ok) Modified: opal/branches/Luyten_A/src/h323/q931.cxx =================================================================== --- opal/branches/Luyten_A/src/h323/q931.cxx 2010-11-22 03:17:23 UTC (rev 24900) +++ opal/branches/Luyten_A/src/h323/q931.cxx 2010-11-22 06:38:46 UTC (rev 24901) @@ -572,6 +572,46 @@ } +void Q931::SetBearerCapabilities(const PString & str) +{ + InformationTransferCapability capability = TransferSpeech; + unsigned transferRate = 1; // 64kbps + unsigned codingStandard = 0; // ITU-T standardized coding + unsigned userInfoLayer1 = 5; // Recommendations H.221 and H.242 + + if (str.FindSpan("0123456789ABCDEFabcdef") == P_MAX_INDEX) { + PINDEX byteCount = str.GetLength()/2; + if (byteCount >= 2) { + PBYTEArray data(byteCount); + for (PINDEX i = 0; i < byteCount; ++i) + data[i] = (BYTE)str.Mid(i*2, 2).AsUnsigned(16); + SetIE(BearerCapabilityIE, data); + return; + } + } + + PStringArray caps = str.Tokenise(','); + switch (caps.GetSize()) { + default : + userInfoLayer1 = caps[3].AsUnsigned(); + case 3 : + codingStandard = caps[2].AsUnsigned(); + case 2 : + transferRate = caps[1].AsUnsigned(); + case 1 : + if (caps[0] *= "speech") + capability = TransferSpeech; + else if (caps[0] *= "digital") + capability = TransferUnrestrictedDigital; + else + capability = (Q931::InformationTransferCapability)caps[0].AsUnsigned(); + case 0 : + break; + } + SetBearerCapabilities(capability, transferRate, codingStandard, userInfoLayer1); +} + + void Q931::SetBearerCapabilities(InformationTransferCapability capability, unsigned transferRate, unsigned codingStandard, Modified: opal/branches/Luyten_A/src/opal/connection.cxx =================================================================== --- opal/branches/Luyten_A/src/opal/connection.cxx 2010-11-22 03:17:23 UTC (rev 24900) +++ opal/branches/Luyten_A/src/opal/connection.cxx 2010-11-22 06:38:46 UTC (rev 24901) @@ -47,6 +47,7 @@ #include <codec/silencedetect.h> #include <codec/echocancel.h> #include <codec/rfc2833.h> +#include <codec/g711codec.h> #include <codec/vidcodec.h> #include <rtp/rtp.h> #include <t120/t120proto.h> @@ -229,7 +230,6 @@ #endif , m_dtmfDetectNotifier(PCREATE_NOTIFIER(OnDetectInBandDTMF)) , m_sendInBandDTMF(true) - , m_installedInBandDTMF(false) , m_emittedInBandDTMF(0) #endif , m_dtmfSendNotifier(PCREATE_NOTIFIER(OnSendInBandDTMF)) @@ -878,22 +878,24 @@ OnStopRecording(patch); #endif - if (silenceDetector != NULL && patch->RemoveFilter(silenceDetector->GetReceiveHandler(), OpalPCM16)) { + if (silenceDetector != NULL && patch->RemoveFilter(silenceDetector->GetReceiveHandler(), m_filterMediaFormat)) { PTRACE(4, "OpalCon\tRemoved silence detect filter on connection " << *this << ", patch " << patch); } #if OPAL_AEC - if (echoCanceler && patch->RemoveFilter(stream.IsSource() ? echoCanceler->GetReceiveHandler() - : echoCanceler->GetSendHandler(), OpalPCM16)) { + if (echoCanceler != NULL && patch->RemoveFilter(stream.IsSource() ? echoCanceler->GetReceiveHandler() + : echoCanceler->GetSendHandler(), m_filterMediaFormat)) { PTRACE(4, "OpalCon\tRemoved echo canceler filter on connection " << *this << ", patch " << patch); } #endif #if OPAL_PTLIB_DTMF - if (patch->RemoveFilter(m_dtmfDetectNotifier, OPAL_PCM16)) { + if (patch->RemoveFilter(m_dtmfDetectNotifier, OpalPCM16)) { PTRACE(4, "OpalCon\tRemoved detect DTMF filter on connection " << *this << ", patch " << patch); } - patch->RemoveFilter(m_dtmfSendNotifier, OPAL_PCM16); + if (!m_dtmfSendFormat.IsEmpty() && patch->RemoveFilter(m_dtmfSendNotifier, m_dtmfSendFormat)) { + PTRACE(4, "OpalCon\tRemoved DTMF send filter on connection " << *this << ", patch " << patch); + } #endif } @@ -918,7 +920,7 @@ return; } - patch->AddFilter(m_recordAudioNotifier, OPAL_PCM16); + patch->AddFilter(m_recordAudioNotifier, OpalPCM16); #if OPAL_VIDEO patch->AddFilter(m_recordVideoNotifier, OPAL_YUV420P); #endif @@ -934,7 +936,7 @@ ownerCall.OnStopRecording(MakeRecordingKey(*patch)); - patch->RemoveFilter(m_recordAudioNotifier, OPAL_PCM16); + patch->RemoveFilter(m_recordAudioNotifier, OpalPCM16); #if OPAL_VIDEO patch->RemoveFilter(m_recordVideoNotifier, OPAL_YUV420P); #endif @@ -949,35 +951,52 @@ patch.SetCommandNotifier(PCREATE_NOTIFIER(OnMediaCommand), !isSource); OpalMediaFormat mediaFormat = patch.GetSource().GetMediaFormat(); - if (mediaFormat.GetEncodingName()[0] != '\0') + if (mediaFormat.IsTransportable()) mediaFormat = patch.GetSink()->GetMediaFormat(); if (mediaFormat.GetMediaType() == OpalMediaType::Audio()) { - if (isSource && silenceDetector != NULL) { - silenceDetector->SetParameters(endpoint.GetManager().GetSilenceDetectParams(), mediaFormat.GetClockRate()); - patch.AddFilter(silenceDetector->GetReceiveHandler(), mediaFormat); - PTRACE(4, "OpalCon\tRemoved silence detect filter on connection " << *this << ", patch " << patch); - } + if (!mediaFormat.IsTransportable()) { + m_filterMediaFormat = mediaFormat; + + if (isSource && silenceDetector != NULL) { + silenceDetector->SetParameters(endpoint.GetManager().GetSilenceDetectParams(), mediaFormat.GetClockRate()); + patch.AddFilter(silenceDetector->GetReceiveHandler(), mediaFormat); + PTRACE(4, "OpalCon\tAdded silence detect filter on connection " << *this << ", patch " << patch); + } + #if OPAL_AEC - if (echoCanceler) { - echoCanceler->SetParameters(endpoint.GetManager().GetEchoCancelParams()); - echoCanceler->SetClockRate(mediaFormat.GetClockRate()); - patch.AddFilter(isSource ? echoCanceler->GetReceiveHandler() - : echoCanceler->GetSendHandler(), mediaFormat); - PTRACE(4, "OpalCon\tAdded echo canceler filter on connection " << *this << ", patch " << patch); + if (echoCanceler) { + echoCanceler->SetParameters(endpoint.GetManager().GetEchoCancelParams()); + echoCanceler->SetClockRate(mediaFormat.GetClockRate()); + patch.AddFilter(isSource ? echoCanceler->GetReceiveHandler() + : echoCanceler->GetSendHandler(), mediaFormat); + PTRACE(4, "OpalCon\tAdded echo canceler filter on connection " << *this << ", patch " << patch); + } +#endif } -#endif #if OPAL_PTLIB_DTMF if (m_detectInBandDTMF && isSource) { - patch.AddFilter(m_dtmfDetectNotifier, mediaFormat); - PTRACE(4, "OpalCon\tAdded detect DTMF filter on connection " << *this << ", patch " << patch); + if (mediaFormat != OpalPCM16) + PTRACE(3, "OpalCon\tCould not add detect DTMF filter for " << mediaFormat + << " on connection " << *this << ", patch " << patch); + else { + patch.AddFilter(m_dtmfDetectNotifier, OpalPCM16); + PTRACE(4, "OpalCon\tAdded detect DTMF filter on connection " << *this << ", patch " << patch); + } } if (m_sendInBandDTMF && !isSource) { - m_installedInBandDTMF = true; - patch.AddFilter(m_dtmfSendNotifier, mediaFormat); - PTRACE(4, "OpalCon\tAdded send DTMF filter on connection " << *this << ", patch " << patch); + if (mediaFormat != OpalPCM16 && + mediaFormat != OpalG711_ULAW_64K && + mediaFormat != OpalG711_ALAW_64K) + PTRACE(3, "OpalCon\tCould not add send DTMF filter for " << mediaFormat + << " on connection " << *this << ", patch " << patch); + else { + m_dtmfSendFormat = mediaFormat; + patch.AddFilter(m_dtmfSendNotifier, mediaFormat); + PTRACE(4, "OpalCon\tAdded send DTMF filter on connection " << *this << ", patch " << patch); + } } #endif } @@ -1127,7 +1146,7 @@ stream->ExecuteCommand(OpalVideoUpdatePicture()); else stream->ExecuteCommand(OpalVideoPictureLoss()); - PTRACE(3, "OpalCon\tUpdate video picture (I-frame) requested in video stream " << *stream); + PTRACE(3, "OpalCon\tUpdate video picture (I-Frame) requested in video stream " << *stream); return true; } @@ -1236,15 +1255,41 @@ #if OPAL_PTLIB_DTMF PBoolean OpalConnection::SendUserInputTone(char tone, unsigned duration) { - if (!m_installedInBandDTMF) + if (m_dtmfSendFormat.IsEmpty()) return false; if (duration <= 0) duration = PDTMFEncoder::DefaultToneLen; PTRACE(3, "OPAL\tSending in-band DTMF tone '" << tone << "', duration=" << duration); + + PDTMFEncoder dtmfSamples; + dtmfSamples.AddTone(tone, duration); + PINDEX size = dtmfSamples.GetSize(); + m_inBandMutex.Wait(); - m_inBandDTMF.AddTone(tone, duration); + + switch (m_dtmfSendFormat.GetPayloadType()) { + case RTP_DataFrame::PCMU : + if (m_inBandDTMF.SetSize(size)) { + for (PINDEX i = 0; i < size; ++i) + m_inBandDTMF[i] = (BYTE)Opal_PCM_G711_uLaw::ConvertSample(dtmfSamples[i]); + } + break; + + case RTP_DataFrame::PCMA : + if (m_inBandDTMF.SetSize(size)) { + for (PINDEX i = 0; i < size; ++i) + m_inBandDTMF[i] = (BYTE)Opal_PCM_G711_ALaw::ConvertSample(dtmfSamples[i]); + } + break; + + default : + size *= sizeof(short); + if (m_inBandDTMF.SetSize(size)) + memcpy(m_inBandDTMF.GetPointer(), dtmfSamples, size); + } + m_inBandMutex.Signal(); return true; @@ -1332,15 +1377,15 @@ // Can't do the usual LockReadWrite() as deadlocks m_inBandMutex.Wait(); - PINDEX bytes = (m_inBandDTMF.GetSize() - m_emittedInBandDTMF)*sizeof(short); + PINDEX bytes = m_inBandDTMF.GetSize() - m_emittedInBandDTMF; if (bytes > frame.GetPayloadSize()) bytes = frame.GetPayloadSize(); memcpy(frame.GetPayloadPtr(), &m_inBandDTMF[m_emittedInBandDTMF], bytes); - m_emittedInBandDTMF += bytes/sizeof(short); + m_emittedInBandDTMF += bytes; if (m_emittedInBandDTMF >= m_inBandDTMF.GetSize()) { - PTRACE(4, "OPAL\tSent in-band DTMF tone, " << m_inBandDTMF.GetSize() << " samples"); + PTRACE(4, "OPAL\tSent in-band DTMF tone, " << m_inBandDTMF.GetSize() << " bytes"); m_inBandDTMF.SetSize(0); m_emittedInBandDTMF = 0; } Modified: opal/branches/Luyten_A/src/opal/mediastrm.cxx =================================================================== --- opal/branches/Luyten_A/src/opal/mediastrm.cxx 2010-11-22 03:17:23 UTC (rev 24900) +++ opal/branches/Luyten_A/src/opal/mediastrm.cxx 2010-11-22 06:38:46 UTC (rev 24901) @@ -148,9 +148,6 @@ if (!LockReadWrite()) return; - if (mediaPatch != NULL) - mediaPatch->SetCommandNotifier(notifier, IsSink()); - commandNotifier = notifier; UnlockReadWrite(); @@ -424,8 +421,9 @@ } -void OpalMediaStream::EnableJitterBuffer(bool) const +bool OpalMediaStream::EnableJitterBuffer(bool) const { + return false; } @@ -740,8 +738,11 @@ } -void OpalRTPMediaStream::EnableJitterBuffer(bool enab) const +bool OpalRTPMediaStream::EnableJitterBuffer(bool enab) const { + if (IsSink()) + return false; + unsigned minJitter, maxJitter; if (enab && mediaFormat.NeedsJitterBuffer()) { minJitter = minAudioJitterDelay*mediaFormat.GetTimeUnits(); @@ -753,6 +754,7 @@ rtpSession.SetJitterBufferSize(minJitter, maxJitter, mediaFormat.GetTimeUnits(), connection.GetEndPoint().GetManager().GetMaxRtpPacketSize()); + return true; } Modified: opal/branches/Luyten_A/src/opal/opalmixer.cxx =================================================================== --- opal/branches/Luyten_A/src/opal/opalmixer.cxx 2010-11-22 03:17:23 UTC (rev 24900) +++ opal/branches/Luyten_A/src/opal/opalmixer.cxx 2010-11-22 06:38:46 UTC (rev 24901) @@ -1064,6 +1064,26 @@ } +bool OpalMixerMediaStream::EnableJitterBuffer(bool enab) const +{ + if (IsSource()) + return false; + + unsigned minJitter, maxJitter; + + if (enab) { + minJitter = connection.GetMinAudioJitterDelay(); + maxJitter = connection.GetMaxAudioJitterDelay(); + } + else { + minJitter = 0; + maxJitter = 0; + } + + return m_node->SetJitterBufferSize(GetID(), minJitter, maxJitter); +} + + /////////////////////////////////////////////////////////////////////////////// OpalMixerNode::OpalMixerNode(OpalMixerNodeManager & manager, @@ -1206,10 +1226,6 @@ if (stream->IsSink()) return m_audioMixer.AddStream(stream->GetID()); - OpalConnection & connection = stream->GetConnection(); - m_audioMixer.SetJitterBufferSize(stream->GetID(), - connection.GetMinAudioJitterDelay(), - connection.GetMaxAudioJitterDelay()); m_audioMixer.m_outputStreams.Append(stream); return true; } Modified: opal/branches/Luyten_A/src/opal/patch.cxx =================================================================== --- opal/branches/Luyten_A/src/opal/patch.cxx 2010-11-22 03:17:23 UTC (rev 24900) +++ opal/branches/Luyten_A/src/opal/patch.cxx 2010-11-22 06:38:46 UTC (rev 24901) @@ -190,6 +190,7 @@ source.SetDataSize(packetSize, packetTime); sinkStream->SetDataSize(packetSize, packetTime); PTRACE(3, "Patch\tAdded direct media stream sink " << *sinkStream); + EnableJitterBuffer(); return true; } @@ -258,6 +259,7 @@ } source.SetDataSize(sink->primaryCodec->GetOptimalDataFrameSize(true), destinationFormat.GetFrameTime()); + EnableJitterBuffer(); return true; } @@ -515,17 +517,29 @@ if (source.IsSynchronous()) return false; + return EnableJitterBuffer(); +} + + +bool OpalMediaPatch::EnableJitterBuffer() +{ PReadWaitAndSignal mutex(inUse); - if (m_bypassToPatch == NULL) { - for (PList<Sink>::iterator s = sinks.begin(); s != sinks.end(); ++s) { - if (s->stream->IsSynchronous()) { - source.EnableJitterBuffer(); - return false; - } + bool enab = m_bypassToPatch == NULL; + + PList<Sink>::iterator s; + for (s = sinks.begin(); s != sinks.end(); ++s) { + if (s->stream->EnableJitterBuffer(enab)) { + source.EnableJitterBuffer(false); + return false; } } - + + for (s = sinks.begin(); s != sinks.end(); ++s) { + if (s->stream->IsSynchronous() && source.EnableJitterBuffer(enab)) + return false; + } + return true; } @@ -622,11 +636,11 @@ if (m_videoDecoder) source.ExecuteCommand(OpalVideoUpdatePicture()); else - source.EnableJitterBuffer(m_bypassToPatch == NULL); + EnableJitterBuffer(); m_bypassActive = m_bypassToPatch != NULL && !m_videoDecoder; #else - source.EnableJitterBuffer(m_bypassToPatch == NULL); + EnableJitterBuffer(); m_bypassActive = m_bypassToPatch != NULL; #endif Modified: opal/branches/Luyten_A/src/opal/transcoders.cxx =================================================================== --- opal/branches/Luyten_A/src/opal/transcoders.cxx 2010-11-22 03:17:23 UTC (rev 24900) +++ opal/branches/Luyten_A/src/opal/transcoders.cxx 2010-11-22 06:38:46 UTC (rev 24901) @@ -111,6 +111,8 @@ { if (commandNotifier != PNotifier()) commandNotifier(const_cast<OpalMediaCommand &>(command), m_sessionID); + else + PTRACE(4, "Opal\tNo command notifier available for transcoder " << this); } Modified: opal/branches/Luyten_A/version.h =================================================================== --- opal/branches/Luyten_A/version.h 2010-11-22 03:17:23 UTC (rev 24900) +++ opal/branches/Luyten_A/version.h 2010-11-22 06:38:46 UTC (rev 24901) @@ -37,7 +37,7 @@ #define MAJOR_VERSION 3 #define MINOR_VERSION 9 #define BUILD_TYPE BetaCode -#define BUILD_NUMBER 0 +#define BUILD_NUMBER 1 #endif // _OPAL_VERSION_H This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |