gst: avoid reporting error twice

First, make the error permanent by calling pw_stream_set_error()
and when this emits an error state again, report that to GStreamer.

Do the same in pipewiresink, which didn't even have the
pw_stream_set_error() call before, so the stream wasn't really going
into an error state at all.
This commit is contained in:
George Kiagiadakis 2023-11-08 18:12:59 +02:00 committed by Wim Taymans
parent 636a9c611d
commit a852b979b6
2 changed files with 14 additions and 5 deletions

View file

@ -532,8 +532,13 @@ on_state_changed (void *data, enum pw_stream_state old, enum pw_stream_state sta
pw_stream_trigger_process (pwsink->stream); pw_stream_trigger_process (pwsink->stream);
break; break;
case PW_STREAM_STATE_ERROR: case PW_STREAM_STATE_ERROR:
GST_ELEMENT_ERROR (pwsink, RESOURCE, FAILED, /* make the error permanent, if it is not already;
("stream error: %s", error), (NULL)); pw_stream_set_error() will recursively call us again */
if (pw_stream_get_state (pwsink->stream, NULL) != PW_STREAM_STATE_ERROR)
pw_stream_set_error (pwsink->stream, -EPIPE, "%s", error);
else
GST_ELEMENT_ERROR (pwsink, RESOURCE, FAILED,
("stream error: %s", error), (NULL));
break; break;
} }
pw_thread_loop_signal (pwsink->core->loop, FALSE); pw_thread_loop_signal (pwsink->core->loop, FALSE);

View file

@ -681,9 +681,13 @@ on_state_changed (void *data,
case PW_STREAM_STATE_STREAMING: case PW_STREAM_STATE_STREAMING:
break; break;
case PW_STREAM_STATE_ERROR: case PW_STREAM_STATE_ERROR:
pw_stream_set_error (pwsrc->stream, -EPIPE, "%s", error); /* make the error permanent, if it is not already;
GST_ELEMENT_ERROR (pwsrc, RESOURCE, FAILED, pw_stream_set_error() will recursively call us again */
("stream error: %s", error), (NULL)); if (pw_stream_get_state (pwsrc->stream, NULL) != PW_STREAM_STATE_ERROR)
pw_stream_set_error (pwsrc->stream, -EPIPE, "%s", error);
else
GST_ELEMENT_ERROR (pwsrc, RESOURCE, FAILED,
("stream error: %s", error), (NULL));
break; break;
} }
pw_thread_loop_signal (pwsrc->core->loop, FALSE); pw_thread_loop_signal (pwsrc->core->loop, FALSE);