From 3c3d483fc3ad3b6f31eeebe9377746295612e6ae Mon Sep 17 00:00:00 2001 From: mark Date: Thu, 8 Feb 2007 18:16:10 +0000 Subject: [PATCH] Ensure that we don't send multiple error messages in a row to the GUI, as this opens a dialog widget for each error. --- .../playlistExecutor/src/GstreamerPlayer.cxx | 18 +++++++++++++----- .../playlistExecutor/src/GstreamerPlayer.h | 5 +++++ 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/campcaster/src/modules/playlistExecutor/src/GstreamerPlayer.cxx b/campcaster/src/modules/playlistExecutor/src/GstreamerPlayer.cxx index 44efd956f..4fba5cbff 100644 --- a/campcaster/src/modules/playlistExecutor/src/GstreamerPlayer.cxx +++ b/campcaster/src/modules/playlistExecutor/src/GstreamerPlayer.cxx @@ -143,14 +143,21 @@ GstreamerPlayer :: errorHandler(GstElement * pipeline, gpointer self) throw () { + DEBUG_BLOCK + GstreamerPlayer* const player = (GstreamerPlayer*) self; - player->m_errorMessage.reset(new const Glib::ustring(error->message)); - std::cerr << "gstreamer error: " << error->message << std::endl; + // We make sure that we don't send multiple error messages in a row to the GUI + if (!player->m_errorWasRaised) { + player->m_errorMessage.reset(new const Glib::ustring(error->message)); + player->m_errorWasRaised = true; - // Important: We *must* use an idle function call here, so that the signal handler returns - // before fireOnStopEvent() is executed. - g_idle_add(fireOnStopEvent, self); + std::cerr << "gstreamer error: " << error->message << std::endl; + + // Important: We *must* use an idle function call here, so that the signal handler returns + // before fireOnStopEvent() is executed. + g_idle_add(fireOnStopEvent, self); + } } @@ -328,6 +335,7 @@ GstreamerPlayer :: open(const std::string fileUrl) debug() << "Timestamp: " << *TimeConversion::now() << endl; m_errorMessage.reset(); + m_errorWasRaised = false; std::string filePath; diff --git a/campcaster/src/modules/playlistExecutor/src/GstreamerPlayer.h b/campcaster/src/modules/playlistExecutor/src/GstreamerPlayer.h index d2a13a5c1..5bd18e647 100644 --- a/campcaster/src/modules/playlistExecutor/src/GstreamerPlayer.h +++ b/campcaster/src/modules/playlistExecutor/src/GstreamerPlayer.h @@ -155,6 +155,11 @@ class GstreamerPlayer : virtual public Configurable, */ Ptr::Ref m_errorMessage; + /** + * Flag that indicates that a GStreamer error had previously occured. + */ + bool m_errorWasRaised; + /** * The URL of the preloaded file. Empty if nothing is preloaded. */