Ensure that we don't send multiple error messages in a row to the GUI, as this opens a dialog widget for each error.
This commit is contained in:
parent
e2173a7112
commit
3c3d483fc3
2 changed files with 18 additions and 5 deletions
|
@ -143,14 +143,21 @@ GstreamerPlayer :: errorHandler(GstElement * pipeline,
|
||||||
gpointer self)
|
gpointer self)
|
||||||
throw ()
|
throw ()
|
||||||
{
|
{
|
||||||
|
DEBUG_BLOCK
|
||||||
|
|
||||||
GstreamerPlayer* const player = (GstreamerPlayer*) self;
|
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
|
std::cerr << "gstreamer error: " << error->message << std::endl;
|
||||||
// before fireOnStopEvent() is executed.
|
|
||||||
g_idle_add(fireOnStopEvent, self);
|
// 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;
|
debug() << "Timestamp: " << *TimeConversion::now() << endl;
|
||||||
|
|
||||||
m_errorMessage.reset();
|
m_errorMessage.reset();
|
||||||
|
m_errorWasRaised = false;
|
||||||
|
|
||||||
std::string filePath;
|
std::string filePath;
|
||||||
|
|
||||||
|
|
|
@ -155,6 +155,11 @@ class GstreamerPlayer : virtual public Configurable,
|
||||||
*/
|
*/
|
||||||
Ptr<const Glib::ustring>::Ref m_errorMessage;
|
Ptr<const Glib::ustring>::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.
|
* The URL of the preloaded file. Empty if nothing is preloaded.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue