Ignore "IDirectSoundBuffer_GetStatus The operation completed successfully"

Fixes #557
This commit is contained in:
Jonas Kvinge 2020-10-13 00:49:34 +02:00
parent 0fd61945c7
commit 4a53d4f043
3 changed files with 18 additions and 10 deletions

View File

@ -509,7 +509,7 @@ void GstEngine::HandlePipelineError(const int pipeline_id, const QString &messag
if (!current_pipeline_.get() || current_pipeline_->id() != pipeline_id) return; if (!current_pipeline_.get() || current_pipeline_->id() != pipeline_id) return;
qLog(Error) << "Gstreamer error:" << domain << error_code << message; qLog(Error) << "GStreamer error:" << domain << error_code << message;
current_pipeline_.reset(); current_pipeline_.reset();
BufferingFinished(); BufferingFinished();

View File

@ -868,32 +868,40 @@ void GstEnginePipeline::ErrorMessageReceived(GstMessage *msg) {
gchar *debugs = nullptr; gchar *debugs = nullptr;
gst_message_parse_error(msg, &error, &debugs); gst_message_parse_error(msg, &error, &debugs);
GQuark domain = error->domain;
int code = error->code;
QString message = QString::fromLocal8Bit(error->message); QString message = QString::fromLocal8Bit(error->message);
QString debugstr = QString::fromLocal8Bit(debugs); QString debugstr = QString::fromLocal8Bit(debugs);
int domain = error->domain;
int code = error->code;
g_error_free(error); g_error_free(error);
g_free(debugs); g_free(debugs);
if (state() == GST_STATE_PLAYING && pipeline_is_initialised_ && next_uri_set_ && (domain == static_cast<int>(GST_RESOURCE_ERROR) || domain == static_cast<int>(GST_STREAM_ERROR))) { if (state() == GST_STATE_PLAYING && pipeline_is_initialised_ && next_uri_set_ && (domain == GST_RESOURCE_ERROR || domain == GST_STREAM_ERROR)) {
// A track is still playing and the next uri is not playable. We ignore the error here so it can play until the end. // A track is still playing and the next uri is not playable. We ignore the error here so it can play until the end.
// But there is no message send to the bus when the current track finishes, we have to add an EOS ourself. // But there is no message send to the bus when the current track finishes, we have to add an EOS ourself.
qLog(Debug) << "Ignoring error when loading next track"; qLog(Info) << "Ignoring error when loading next track";
GstPad *sinkpad = gst_element_get_static_pad(audiobin_, "sink"); GstPad *sinkpad = gst_element_get_static_pad(audiobin_, "sink");
gst_pad_send_event(sinkpad, gst_event_new_eos()); gst_pad_send_event(sinkpad, gst_event_new_eos());
gst_object_unref(sinkpad); gst_object_unref(sinkpad);
return; return;
} }
qLog(Error) << __FUNCTION__ << "ID:" << id() << "Domain:" << domain << "Code:" << code << "Error:" << message;
qLog(Error) << __FUNCTION__ << "ID:" << id() << "Domain:" << domain << "Code:" << code << "Debug:" << debugstr;
if (!redirect_url_.isEmpty() && debugstr.contains("A redirect message was posted on the bus and should have been handled by the application.")) { if (!redirect_url_.isEmpty() && debugstr.contains("A redirect message was posted on the bus and should have been handled by the application.")) {
// mmssrc posts a message on the bus *and* makes an error message when it wants to do a redirect. // mmssrc posts a message on the bus *and* makes an error message when it wants to do a redirect.
// We handle the message, but now we have to ignore the error too. // We handle the message, but now we have to ignore the error too.
return; return;
} }
qLog(Error) << __FUNCTION__ << id() << debugstr; #ifdef Q_OS_WIN
// Ignore non-error received for directsoundsink: "IDirectSoundBuffer_GetStatus The operation completed successfully"
if (code == GST_RESOURCE_ERROR_OPEN_WRITE && message.contains("IDirectSoundBuffer_GetStatus The operation completed successfully.")) {
return;
}
#endif
emit Error(id(), message, domain, code); emit Error(id(), message, static_cast<int>(domain), code);
} }

View File

@ -122,11 +122,11 @@ class GstEnginePipeline : public QObject {
void SetVolumeModifier(qreal mod); void SetVolumeModifier(qreal mod);
signals: signals:
void EndOfStreamReached(const int pipeline_id, const bool has_next_track); void EndOfStreamReached(int pipeline_id, bool has_next_track);
void MetadataFound(const int pipeline_id, const Engine::SimpleMetaBundle &bundle); void MetadataFound(int pipeline_id, const Engine::SimpleMetaBundle &bundle);
// This indicates an error, delegated from GStreamer, in the pipeline. // This indicates an error, delegated from GStreamer, in the pipeline.
// The message, domain and error_code are related to GStreamer's GError. // The message, domain and error_code are related to GStreamer's GError.
void Error(const int pipeline_id, const QString &message, const int domain, const int error_code); void Error(int pipeline_id, QString message, int domain, int error_code);
void FaderFinished(); void FaderFinished();
void BufferingStarted(); void BufferingStarted();