mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-01-28 22:04:43 -08:00
141 lines
4.5 KiB
Diff
141 lines
4.5 KiB
Diff
From b1c93d216b7319beeb1588c427408809cd0f66ff Mon Sep 17 00:00:00 2001
|
|
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
|
Date: Sun, 19 Sep 2021 13:08:04 +1000
|
|
Subject: [PATCH 11/12] Revert "winegstreamer: Properly clean up from failure
|
|
in wg_parser_connect()."
|
|
|
|
This reverts commit 721b1eb2ebe5c3eaab8ac3fb1e4f4648cbee5b4d.
|
|
---
|
|
dlls/winegstreamer/wg_parser.c | 76 ++++++++++------------------------
|
|
1 file changed, 23 insertions(+), 53 deletions(-)
|
|
|
|
diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c
|
|
index e12cb08776b..80cc08ea0a5 100644
|
|
--- a/dlls/winegstreamer/wg_parser.c
|
|
+++ b/dlls/winegstreamer/wg_parser.c
|
|
@@ -1041,30 +1041,6 @@ static struct wg_parser_stream *create_stream(struct wg_parser *parser)
|
|
return stream;
|
|
}
|
|
|
|
-static void free_stream(struct wg_parser_stream *stream)
|
|
-{
|
|
- if (stream->their_src)
|
|
- {
|
|
- if (stream->post_sink)
|
|
- {
|
|
- gst_pad_unlink(stream->their_src, stream->post_sink);
|
|
- gst_pad_unlink(stream->post_src, stream->my_sink);
|
|
- gst_object_unref(stream->post_src);
|
|
- gst_object_unref(stream->post_sink);
|
|
- stream->post_src = stream->post_sink = NULL;
|
|
- }
|
|
- else
|
|
- gst_pad_unlink(stream->their_src, stream->my_sink);
|
|
- gst_object_unref(stream->their_src);
|
|
- }
|
|
- gst_object_unref(stream->my_sink);
|
|
-
|
|
- pthread_cond_destroy(&stream->event_cond);
|
|
- pthread_cond_destroy(&stream->event_empty_cond);
|
|
-
|
|
- free(stream);
|
|
-}
|
|
-
|
|
static void pad_added_cb(GstElement *element, GstPad *pad, gpointer user)
|
|
{
|
|
struct wg_parser *parser = user;
|
|
@@ -1551,14 +1527,14 @@ static HRESULT CDECL wg_parser_connect(struct wg_parser *parser, uint64_t file_s
|
|
parser->error = false;
|
|
|
|
if (!parser->init_gst(parser))
|
|
- goto out;
|
|
+ return E_FAIL;
|
|
|
|
gst_element_set_state(parser->container, GST_STATE_PAUSED);
|
|
ret = gst_element_get_state(parser->container, NULL, NULL, -1);
|
|
if (ret == GST_STATE_CHANGE_FAILURE)
|
|
{
|
|
GST_ERROR("Failed to play stream.\n");
|
|
- goto out;
|
|
+ return E_FAIL;
|
|
}
|
|
|
|
pthread_mutex_lock(&parser->mutex);
|
|
@@ -1568,7 +1544,7 @@ static HRESULT CDECL wg_parser_connect(struct wg_parser *parser, uint64_t file_s
|
|
if (parser->error)
|
|
{
|
|
pthread_mutex_unlock(&parser->mutex);
|
|
- goto out;
|
|
+ return E_FAIL;
|
|
}
|
|
|
|
for (i = 0; i < parser->stream_count; ++i)
|
|
@@ -1608,7 +1584,7 @@ static HRESULT CDECL wg_parser_connect(struct wg_parser *parser, uint64_t file_s
|
|
if (parser->error)
|
|
{
|
|
pthread_mutex_unlock(&parser->mutex);
|
|
- goto out;
|
|
+ return E_FAIL;
|
|
}
|
|
if (gst_pad_query_duration(stream->their_src, GST_FORMAT_TIME, &duration))
|
|
{
|
|
@@ -1645,36 +1621,30 @@ static HRESULT CDECL wg_parser_connect(struct wg_parser *parser, uint64_t file_s
|
|
|
|
parser->next_offset = 0;
|
|
return S_OK;
|
|
+}
|
|
|
|
-out:
|
|
- if (parser->container)
|
|
- gst_element_set_state(parser->container, GST_STATE_NULL);
|
|
- if (parser->their_sink)
|
|
- {
|
|
- gst_pad_unlink(parser->my_src, parser->their_sink);
|
|
- gst_object_unref(parser->their_sink);
|
|
- parser->my_src = parser->their_sink = NULL;
|
|
- }
|
|
-
|
|
- for (i = 0; i < parser->stream_count; ++i)
|
|
- free_stream(parser->streams[i]);
|
|
- parser->stream_count = 0;
|
|
- free(parser->streams);
|
|
- parser->streams = NULL;
|
|
-
|
|
- if (parser->container)
|
|
+static void free_stream(struct wg_parser_stream *stream)
|
|
+{
|
|
+ if (stream->their_src)
|
|
{
|
|
- gst_element_set_bus(parser->container, NULL);
|
|
- gst_object_unref(parser->container);
|
|
- parser->container = NULL;
|
|
+ if (stream->post_sink)
|
|
+ {
|
|
+ gst_pad_unlink(stream->their_src, stream->post_sink);
|
|
+ gst_pad_unlink(stream->post_src, stream->my_sink);
|
|
+ gst_object_unref(stream->post_src);
|
|
+ gst_object_unref(stream->post_sink);
|
|
+ stream->post_src = stream->post_sink = NULL;
|
|
+ }
|
|
+ else
|
|
+ gst_pad_unlink(stream->their_src, stream->my_sink);
|
|
+ gst_object_unref(stream->their_src);
|
|
}
|
|
+ gst_object_unref(stream->my_sink);
|
|
|
|
- pthread_mutex_lock(&parser->mutex);
|
|
- parser->sink_connected = false;
|
|
- pthread_mutex_unlock(&parser->mutex);
|
|
- pthread_cond_signal(&parser->read_cond);
|
|
+ pthread_cond_destroy(&stream->event_cond);
|
|
+ pthread_cond_destroy(&stream->event_empty_cond);
|
|
|
|
- return E_FAIL;
|
|
+ free(stream);
|
|
}
|
|
|
|
static void CDECL wg_parser_disconnect(struct wg_parser *parser)
|
|
--
|
|
2.33.0
|
|
|