Commit 90dc7f5b authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

winegstreamer: Use WG_MAJOR_TYPE_UNKNOWN to mark a stream that should not be…

winegstreamer: Use WG_MAJOR_TYPE_UNKNOWN to mark a stream that should not be forced into a certain format. Instead of checking the enabled state. The reasoning here is that we would like to keep the stream enabled—that is, buffer samples instead of discarding them—even when the client is not yet reading samples from it, so that we can avoid wasting CPU power in decoding. Signed-off-by: 's avatarZebediah Figura <zfigura@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 159be446
......@@ -495,7 +495,7 @@ GstCaps *wg_format_to_caps(const struct wg_format *format)
switch (format->major_type)
{
case WG_MAJOR_TYPE_UNKNOWN:
return NULL;
return gst_caps_new_any();
case WG_MAJOR_TYPE_WMA:
return wg_format_to_caps_wma(format);
case WG_MAJOR_TYPE_H264:
......
......@@ -254,6 +254,7 @@ static NTSTATUS wg_parser_stream_disable(void *args)
pthread_mutex_lock(&parser->mutex);
stream->enabled = false;
stream->current_format.major_type = WG_MAJOR_TYPE_UNKNOWN;
pthread_mutex_unlock(&parser->mutex);
pthread_cond_signal(&stream->event_empty_cond);
return S_OK;
......@@ -601,12 +602,7 @@ static gboolean sink_query_cb(GstPad *pad, GstObject *parent, GstQuery *query)
gst_query_parse_caps(query, &filter);
pthread_mutex_lock(&parser->mutex);
if (stream->enabled)
caps = wg_format_to_caps(&stream->current_format);
else
caps = gst_caps_new_any();
caps = wg_format_to_caps(&stream->current_format);
pthread_mutex_unlock(&parser->mutex);
if (!caps)
......@@ -636,7 +632,7 @@ static gboolean sink_query_cb(GstPad *pad, GstObject *parent, GstQuery *query)
pthread_mutex_lock(&parser->mutex);
if (!stream->enabled)
if (stream->current_format.major_type == WG_MAJOR_TYPE_UNKNOWN)
{
pthread_mutex_unlock(&parser->mutex);
gst_query_set_accept_caps_result(query, TRUE);
......@@ -689,6 +685,7 @@ static struct wg_parser_stream *create_stream(struct wg_parser *parser)
gst_segment_init(&stream->segment, GST_FORMAT_UNDEFINED);
stream->parser = parser;
stream->current_format.major_type = WG_MAJOR_TYPE_UNKNOWN;
pthread_cond_init(&stream->event_cond, NULL);
pthread_cond_init(&stream->event_empty_cond, NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment