From 2cdd77d1c9bbbda729b2b78bced80837e1227f79 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Wed, 1 Apr 2009 15:26:25 -0500 Subject: Added LLMediaBase::EDebugLevel and setDebugLevel stub. --- linden/indra/llmedia/llmediabase.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'linden') diff --git a/linden/indra/llmedia/llmediabase.h b/linden/indra/llmedia/llmediabase.h index b5b9420..bf54a22 100644 --- a/linden/indra/llmedia/llmediabase.h +++ b/linden/indra/llmedia/llmediabase.h @@ -61,6 +61,21 @@ class LLMediaBase // undoes everything init() didm called by the media manager when destroying a source virtual bool reset() = 0; + + /* Mirrors GStreamer debug levels. */ + enum EDebugLevel { + DEBUG_LEVEL_NONE = 0, + DEBUG_LEVEL_ERROR, + DEBUG_LEVEL_WARNING, + DEBUG_LEVEL_INFO, + DEBUG_LEVEL_DEBUG, + DEBUG_LEVEL_LOG, + DEBUG_LEVEL_COUNT, + }; + + /* Set the debug verbosity level. Only implemented for GStreamer. */ + virtual bool setDebugLevel( EDebugLevel level ) = 0; + // accessor for MIME type virtual bool setMimeType( const std::string mime_type ) = 0; virtual std::string getMimeType() const = 0; -- cgit v1.1 From 713001efd41390bbcb28d071771ffae1201bab94 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Wed, 1 Apr 2009 23:15:29 -0500 Subject: Added LLMediaImplCommon::setDebugLevel(). --- linden/indra/llmedia/llmediaimplcommon.cpp | 12 +++++++++++- linden/indra/llmedia/llmediaimplcommon.h | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'linden') diff --git a/linden/indra/llmedia/llmediaimplcommon.cpp b/linden/indra/llmedia/llmediaimplcommon.cpp index abb61e1..48b3973 100644 --- a/linden/indra/llmedia/llmediaimplcommon.cpp +++ b/linden/indra/llmedia/llmediaimplcommon.cpp @@ -66,7 +66,8 @@ LLMediaImplCommon::LLMediaImplCommon() : mCommand( LLMediaBase::COMMAND_NONE ), mStatus( LLMediaBase::STATUS_UNKNOWN ), mVolume( 0 ), - mLooping( false ) + mLooping( false ), + mDebugLevel( LLMediaBase::DEBUG_LEVEL_NONE ) { } @@ -92,6 +93,15 @@ bool LLMediaImplCommon::reset() //////////////////////////////////////////////////////////////////////////////// // virtual (derives from LLMediaBase) +bool LLMediaImplCommon::setDebugLevel( LLMediaBase::EDebugLevel level ) +{ + mDebugLevel = level; + + return true; +} + +//////////////////////////////////////////////////////////////////////////////// +// virtual (derives from LLMediaBase) bool LLMediaImplCommon::setMimeType( const std::string mime_type ) { mMimeType = mime_type; diff --git a/linden/indra/llmedia/llmediaimplcommon.h b/linden/indra/llmedia/llmediaimplcommon.h index aa6c4d5..8a726f1 100644 --- a/linden/indra/llmedia/llmediaimplcommon.h +++ b/linden/indra/llmedia/llmediaimplcommon.h @@ -54,6 +54,7 @@ class LLMediaImplCommon : // housekeeping virtual bool init(); virtual bool reset(); + virtual bool setDebugLevel( LLMediaBase::EDebugLevel level ); virtual bool setMimeType( const std::string url ); virtual std::string getMimeType() const; virtual std::string getMediaURL() const; @@ -156,6 +157,7 @@ class LLMediaImplCommon : LLMediaBase::ECommand mCommand; LLMediaBase::EStatus mStatus; bool mLooping; + LLMediaBase::EDebugLevel mDebugLevel; }; #endif // LLMEDIAIMPLCOMMON_H -- cgit v1.1 From e4792e0768162d07b45f8ed19002f7a13c3bebb4 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Wed, 1 Apr 2009 23:47:05 -0500 Subject: Implemented LLMediaImplGstreamer::setDebugLevel(). --- linden/indra/llmedia/llmediaimplgstreamer.cpp | 12 ++++++++++++ linden/indra/llmedia/llmediaimplgstreamer.h | 2 ++ 2 files changed, 14 insertions(+) (limited to 'linden') diff --git a/linden/indra/llmedia/llmediaimplgstreamer.cpp b/linden/indra/llmedia/llmediaimplgstreamer.cpp index 9a51b7f..82b1096 100644 --- a/linden/indra/llmedia/llmediaimplgstreamer.cpp +++ b/linden/indra/llmedia/llmediaimplgstreamer.cpp @@ -261,6 +261,18 @@ bool LLMediaImplGStreamer::closedown() } +bool LLMediaImplGStreamer::setDebugLevel( LLMediaBase::EDebugLevel level ) +{ + // Do parent class stuff. + LLMediaImplCommon::setDebugLevel(level); + + // Set GStreamer verbosity. + gst_debug_set_default_threshold( (GstDebugLevel)level ); + + return true; +} + + /////////////////////////////////////////////////////////////////////////////// // // Uncomment the line below to enable spammy debug data. diff --git a/linden/indra/llmedia/llmediaimplgstreamer.h b/linden/indra/llmedia/llmediaimplgstreamer.h index 2918416..282da08 100644 --- a/linden/indra/llmedia/llmediaimplgstreamer.h +++ b/linden/indra/llmedia/llmediaimplgstreamer.h @@ -69,6 +69,8 @@ class LLMediaImplGStreamer: // Sets GST_PLUGIN_PATH env var for GStreamer. static void set_gst_plugin_path(); + /* virtual */ bool setDebugLevel( LLMediaBase::EDebugLevel level ); + /* virtual */ std::string getVersion(); /* virtual */ bool navigateTo( const std::string url ); /* virtual */ bool updateMedia(); -- cgit v1.1 From ee0bef2d933c684a07c7cb02260f4a8ef768acab Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Sat, 28 Mar 2009 19:58:28 -0500 Subject: Added MediaDebugLevel setting in XML (does nothing yet). --- linden/indra/newview/app_settings/settings.xml | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'linden') diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml index 7405aad..1ecab2b 100644 --- a/linden/indra/newview/app_settings/settings.xml +++ b/linden/indra/newview/app_settings/settings.xml @@ -4659,6 +4659,17 @@ Value 0 + MediaDebugLevel + + Comment + How spammy media (GStreamer) debug output should be. (0-4) + Persist + 1 + Type + U32 + Value + 0 + MemoryLogFrequency Comment -- cgit v1.1 From c9ba230c987e27b1cabc208f0dd21cc6cf09e553 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Thu, 2 Apr 2009 01:05:17 -0500 Subject: Implemented handleMediaDebugLevelChanged hook. --- linden/indra/newview/llviewercontrol.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'linden') diff --git a/linden/indra/newview/llviewercontrol.cpp b/linden/indra/newview/llviewercontrol.cpp index 7a30b22..a8a3b16 100644 --- a/linden/indra/newview/llviewercontrol.cpp +++ b/linden/indra/newview/llviewercontrol.cpp @@ -70,6 +70,7 @@ #include "llvosurfacepatch.h" #include "llvowlsky.h" #include "llrender.h" +#include "llmediamanager.h" #ifdef TOGGLE_HACKED_GODLIKE_VIEWER BOOL gHackGodmode = FALSE; @@ -429,6 +430,22 @@ bool handleVoiceClientPrefsChanged(const LLSD& newvalue) return true; } +bool handleMediaDebugLevelChanged(const LLSD& newvalue) +{ + LLMediaManager *mgr = LLMediaManager::getInstance(); + if (mgr) + { + LLMediaBase *impl = + mgr->createSourceFromMimeType("http", "audio/mpeg"); + + if (impl) + { + impl->setDebugLevel( (LLMediaBase::EDebugLevel)newvalue.asInteger() ); + } + } + return true; +} + //////////////////////////////////////////////////////////////////////////// void settings_setup_listeners() @@ -556,6 +573,7 @@ void settings_setup_listeners() gSavedSettings.getControl("VoiceInputAudioDevice")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _1)); gSavedSettings.getControl("VoiceOutputAudioDevice")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _1)); gSavedSettings.getControl("LipSyncEnabled")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _1)); + gSavedSettings.getControl("MediaDebugLevel")->getSignal()->connect(boost::bind(&handleMediaDebugLevelChanged, _1)); } template <> eControlType get_control_type(const U32& in, LLSD& out) -- cgit v1.1 From 33e649ca1bca260de474842d30d3bf8178e61be4 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Thu, 2 Apr 2009 02:29:46 -0500 Subject: Implemented LLMediaImplGStreamer::gstreamer_log(). --- linden/indra/llmedia/llmediaimplgstreamer.cpp | 40 +++++++++++++++++++++++++++ linden/indra/llmedia/llmediaimplgstreamer.h | 15 ++++++++++ 2 files changed, 55 insertions(+) (limited to 'linden') diff --git a/linden/indra/llmedia/llmediaimplgstreamer.cpp b/linden/indra/llmedia/llmediaimplgstreamer.cpp index 82b1096..8cbfb60 100644 --- a/linden/indra/llmedia/llmediaimplgstreamer.cpp +++ b/linden/indra/llmedia/llmediaimplgstreamer.cpp @@ -255,6 +255,46 @@ void LLMediaImplGStreamer::set_gst_plugin_path() } +void LLMediaImplGStreamer::gstreamer_log(GstDebugCategory *category, + GstDebugLevel level, + const gchar *file, + const gchar *function, + gint line, + GObject *object, + GstDebugMessage *message, + gpointer data) +{ + std::stringstream log(std::stringstream::out); + + // Log format example: + // + // GST_ELEMENT_PADS: removing pad 'sink' (in gstelement.c:757:gst_element_remove_pad) + // + log << gst_debug_category_get_name( category ) << ": " + << gst_debug_message_get(message) << " " + << "(in " << file << ":" << line << ":" << function << ")"; + + switch( level ) + { + case GST_LEVEL_ERROR: + LL_ERRS("MediaImpl") << log.str() << LL_ENDL; + break; + case GST_LEVEL_WARNING: + LL_WARNS("MediaImpl") << log.str() << LL_ENDL; + break; + case GST_LEVEL_DEBUG: + LL_DEBUGS("MediaImpl") << log.str() << LL_ENDL; + break; + case GST_LEVEL_INFO: + LL_INFOS("MediaImpl") << log.str() << LL_ENDL; + break; + default: + // Do nothing. + break; + } +} + + bool LLMediaImplGStreamer::closedown() { return true; diff --git a/linden/indra/llmedia/llmediaimplgstreamer.h b/linden/indra/llmedia/llmediaimplgstreamer.h index 282da08..37eaf53 100644 --- a/linden/indra/llmedia/llmediaimplgstreamer.h +++ b/linden/indra/llmedia/llmediaimplgstreamer.h @@ -71,6 +71,21 @@ class LLMediaImplGStreamer: /* virtual */ bool setDebugLevel( LLMediaBase::EDebugLevel level ); + // Function given to GStreamer for handling debug messages + static void gstreamer_log(GstDebugCategory *category, + GstDebugLevel level, + const gchar *file, + const gchar *function, + gint line, + GObject *object, + GstDebugMessage *message, + gpointer data) +#if __GNUC__ + // recommended by the gstreamer docs + G_GNUC_NO_INSTRUMENT +#endif + ; + /* virtual */ std::string getVersion(); /* virtual */ bool navigateTo( const std::string url ); /* virtual */ bool updateMedia(); -- cgit v1.1 From 42670a609d842affb26bf1dd1ed6b69958655ea9 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Thu, 2 Apr 2009 03:12:02 -0500 Subject: Plugged in LLMediaImplGStreamer::gstreamer_log(). --- linden/indra/llmedia/llmediaimplgstreamer.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'linden') diff --git a/linden/indra/llmedia/llmediaimplgstreamer.cpp b/linden/indra/llmedia/llmediaimplgstreamer.cpp index 8cbfb60..532ec00 100644 --- a/linden/indra/llmedia/llmediaimplgstreamer.cpp +++ b/linden/indra/llmedia/llmediaimplgstreamer.cpp @@ -176,7 +176,11 @@ bool LLMediaImplGStreamer::startup (LLMediaManagerData* init_data) return false; } setlocale(LC_ALL, saved_locale.c_str() ); - + + // Set up logging facilities + gst_debug_remove_log_function( gst_debug_log_default ); + gst_debug_add_log_function( gstreamer_log, NULL ); + // Init our custom plugins - only really need do this once. gst_slvideo_init_class(); -- cgit v1.1 From bfde51e169465842e18231fef56f02f06c1b0620 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Thu, 2 Apr 2009 03:25:31 -0500 Subject: Apply saved MediaDebugLevel at media init time. --- linden/indra/newview/llviewermedia.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'linden') diff --git a/linden/indra/newview/llviewermedia.cpp b/linden/indra/newview/llviewermedia.cpp index e99c838..d8fcdcb 100644 --- a/linden/indra/newview/llviewermedia.cpp +++ b/linden/indra/newview/llviewermedia.cpp @@ -496,6 +496,13 @@ void LLViewerMedia::initClass() const LLMIMETypes::LLMIMEInfo& info = it->second; mm->addMimeTypeImplNameMap( mime_type, info.mImpl ); } + + LLMediaBase *impl = mm->createSourceFromMimeType("http", "audio/mpeg"); + if (impl) + { + U32 level = gSavedSettings.getU32("MediaDebugLevel"); + impl->setDebugLevel( (LLMediaBase::EDebugLevel)level ); + } } ////////////////////////////////////////////////////////////////////////////////////////// -- cgit v1.1