[asterisk-scf-commits] asterisk-scf/integration/media_rtp_pjmedia.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Tue Oct 5 15:09:02 CDT 2010


branch "master" has been updated
       via  a539d3c6966de76296bdcda3bd5de5e6eb4b478e (commit)
      from  2d4f25efbd402d1f97df4f9209830db24a63d4b2 (commit)

Summary of changes:
 .gitmodules                        |    3 +++
 CMakeLists.txt                     |    3 +++
 config/test_media_rtp_pjmedia.conf |    3 +++
 logger                             |    1 +
 slice                              |    2 +-
 src/CMakeLists.txt                 |    8 ++++++++
 src/MediaRTPpjmedia.cpp            |   29 +++++++++++++++++++++++++----
 src/RTPSource.cpp                  |   11 +++++++++--
 8 files changed, 53 insertions(+), 7 deletions(-)
 create mode 160000 logger


- Log -----------------------------------------------------------------
commit a539d3c6966de76296bdcda3bd5de5e6eb4b478e
Author: David M. Lee <dlee at digium.com>
Date:   Tue Oct 5 15:08:14 2010 -0500

    Logger integration

diff --git a/.gitmodules b/.gitmodules
index 841f83c..a628faf 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -4,3 +4,6 @@
 [submodule "slice"]
 	path = slice
 	url = ../../integration/slice
+[submodule "logger"]
+	path = logger
+	url = git at git.asterisk.org:asterisk-scf/integration/logger
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7bfde9c..d409693 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -32,6 +32,9 @@ if(NOT integrated_build STREQUAL "true")
    # Knock out slice definitions
    add_subdirectory(slice EXCLUDE_FROM_ALL)
 
+   # logger is integrated into our build
+   set(integrated_build true)
+   add_subdirectory(logger)
 endif()
 
 # Include the subdirectory information. This is separate so that
diff --git a/config/test_media_rtp_pjmedia.conf b/config/test_media_rtp_pjmedia.conf
index abb2ca9..c317d68 100644
--- a/config/test_media_rtp_pjmedia.conf
+++ b/config/test_media_rtp_pjmedia.conf
@@ -9,3 +9,6 @@ ServiceLocatorManagementProxy=LocatorServiceManagement:tcp -p 4422
 
 # A proxy to the service locator service
 ServiceLocatorProxy=LocatorService:tcp -p 4411
+LocatorService.Proxy=LocatorService:tcp -p 4411
+
+TopicManager.Proxy=HydraIceStorm/TopicManager:default -p 10000
diff --git a/logger b/logger
new file mode 160000
index 0000000..0cc0c02
--- /dev/null
+++ b/logger
@@ -0,0 +1 @@
+Subproject commit 0cc0c02a16e404b94d54c8cb6736dee14a671352
diff --git a/slice b/slice
index 14413db..0c62939 160000
--- a/slice
+++ b/slice
@@ -1 +1 @@
-Subproject commit 14413db47bfae3d1ff57d36e80cfe700d755ae0b
+Subproject commit 0c629393e2f05dc0ed43bcc6305880949df36289
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c4bb605..14cd228 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -16,7 +16,15 @@ hydra_component_add_file(media_rtp_pjmedia RTPSession.cpp)
 hydra_component_add_file(media_rtp_pjmedia RTPSource.cpp)
 hydra_component_add_file(media_rtp_pjmedia RTPSink.cpp)
 hydra_component_add_boost_libraries(media_rtp_pjmedia core thread)
+
+if(NOT logger_dir)
+   message(FATAL_ERROR "The logger directory could not be found ${logger_dir}")
+endif()
+include_directories(${logger_dir}/common)
+include_directories(${logger_dir}/client/src)
+
 hydra_component_build_icebox(media_rtp_pjmedia)
+target_link_libraries(media_rtp_pjmedia logging-client)
 pjproject_link(media_rtp_pjmedia pjlib)
 pjproject_link(media_rtp_pjmedia pjlib-util)
 pjproject_link(media_rtp_pjmedia pjmedia)
diff --git a/src/MediaRTPpjmedia.cpp b/src/MediaRTPpjmedia.cpp
index 6dd8ef1..0d9f211 100644
--- a/src/MediaRTPpjmedia.cpp
+++ b/src/MediaRTPpjmedia.cpp
@@ -18,6 +18,8 @@
 #include "Media/MediaIf.h"
 #include "Media/RTP/MediaRTPIf.h"
 #include "System/Component/ComponentServiceIf.h"
+#include "IceLogger.h"
+#include "logger.h"
 
 #include "RTPSession.h"
 
@@ -26,6 +28,12 @@ using namespace AsteriskSCF::Core::Discovery::V1;
 using namespace AsteriskSCF::Media::V1;
 using namespace AsteriskSCF::Media::RTP::V1;
 using namespace AsteriskSCF::System::Component::V1;
+using namespace AsteriskSCF::System::Logging;
+
+namespace
+{
+Logger &lg = getLoggerFactory().getLogger("AsteriskSCF.MediaRTP");
+}
 
 /**
  * Implementation of the RTPMediaService interface as defined in MediaRTPIf.ice
@@ -73,6 +81,11 @@ private:
 	Ice::ObjectAdapterPtr mAdapter;
 
 	/**
+	 * The object adapter for the Logger.
+	 */
+	Ice::ObjectAdapterPtr mLoggerAdapter;
+
+	/**
 	 * A proxy to the service locator manager for the RTP media service.
 	 */
 	ServiceManagementPrx mServiceManagement;
@@ -211,21 +224,29 @@ RTPSessionPrx RTPMediaServiceImpl::allocate(const FormatSeq& formats, const Ice:
  */
 void MediaRTPpjmediaApp::start(const std::string& name, const Ice::CommunicatorPtr& communicator, const Ice::StringSeq& args)
 {
+	// we need a logger before we're ready to build the real communicator.
+	// use the one we're provided to create the IceLogger.
+	mLoggerAdapter = communicator->createObjectAdapter(
+		"MediaRTPpjmediaAdapter");
+	ConfiguredIceLoggerPtr iceLogger = createIceLogger(mLoggerAdapter);
+	getLoggerFactory().setLogOutput(iceLogger->getLogger());
+	mLoggerAdapter->activate();
+
 	/* Initialize pjlib as pjmedia will be using it */
 	pj_status_t status = pj_init();
 	if (status != PJ_SUCCESS)
 	{
-		cerr << "PJ library initialization failed." << endl;
+		lg(Error) << "PJ library initialization failed.";
 		return;
 	}
 
 	if ((status = pjlib_util_init()) != PJ_SUCCESS)
 	{
-		cerr << "PJ Utility library initialization failed." << endl;
+		lg(Error) << "PJ Utility library initialization failed.";
 		return;
 	}
 
-	cout << "Initializing pjmedia rtp component" << endl;
+	lg(Info) << "Initializing pjmedia rtp component" << endl;
 
 	Ice::InitializationData id;
 	id.threadHook = new pjlibHook();
@@ -241,7 +262,7 @@ void MediaRTPpjmediaApp::start(const std::string& name, const Ice::CommunicatorP
 
 	mAdapter->activate();
 
-	cout << "Activated pjmedia rtp component media service." << endl;
+	lg(Info) << "Activated pjmedia rtp component media service." << endl;
 
 	ServiceLocatorManagementPrx management = ServiceLocatorManagementPrx::checkedCast(mCommunicator->propertyToProxy("ServiceLocatorManagementProxy"));
 
diff --git a/src/RTPSource.cpp b/src/RTPSource.cpp
index 1f9eddf..132d944 100644
--- a/src/RTPSource.cpp
+++ b/src/RTPSource.cpp
@@ -16,11 +16,18 @@
 
 #include "RTPSession.h"
 #include "RTPSource.h"
+#include "logger.h"
 
 using namespace std;
 using namespace AsteriskSCF::Core::Discovery::V1;
 using namespace AsteriskSCF::Media::V1;
 using namespace AsteriskSCF::Media::RTP::V1;
+using namespace AsteriskSCF::System::Logging;
+
+namespace
+{
+Logger &lg = getLoggerFactory().getLogger("AsteriskSCF.MediaRTP");
+}
 
 /**
  * Private implementation details for the StreamSourceRTPImpl class.
@@ -134,7 +141,7 @@ static void receiveRTP(void *userdata, void *packet, pj_ssize_t size)
 	/* Ensure that no errors occurred when reading this packet in */
 	if (size < 0)
 	{
-		cerr << "[ERROR] We attempted to read data from an RTP session but failed." << endl;
+		lg(Error) << "We attempted to read data from an RTP session but failed.";
 		return;
 	}
 
@@ -146,7 +153,7 @@ static void receiveRTP(void *userdata, void *packet, pj_ssize_t size)
 
 	if (status != PJ_SUCCESS)
 	{
-		cerr << "[ERROR] We read an RTP packet of size " << size << " in but failed to decode it." << endl;
+		lg(Error) << "We read an RTP packet of size " << size << " in but failed to decode it.";
 		return;
 	}
 

-----------------------------------------------------------------------


-- 
asterisk-scf/integration/media_rtp_pjmedia.git



More information about the asterisk-scf-commits mailing list