From ce59c5152880c4c1fee493a5d39d1f5129f05b01 Mon Sep 17 00:00:00 2001 From: BabbleBones Date: Wed, 27 Mar 2024 14:36:50 -0400 Subject: [PATCH] update rtsp --- patches/protonprep-valve-staging.sh | 59 +++--- ...-not-create-a-read-thread-for-uridec.patch | 43 ++++ ...eamer-Ignore-an-assert-in-wg_parser.patch} | 20 +- ...Fixate-caps-in-autoplug_continue_cb.patch} | 8 +- ...e-wg_parser-report-the-exact-suppor.patch} | 25 +-- ...-more-RTSP-based-URI-schemes-to-GSt.patch} | 6 +- ...-a-clock-for-the-wg_parser-pipeline.patch} | 8 +- ...-base-time-on-wg_parser-bin-while-c.patch} | 12 +- ...t-pipeline-into-PLAYING-state-before.patch | 32 +++ ...nvert-buffer-presentation-timestamps.patch | 93 +++++++++ ...-Adjust-buffer-timestamps-after-seek.patch | 61 ++++++ ...rder-parser-initialization-code-a-b.patch} | 14 +- ...mporarily-put-pipeline-into-PLAYING-.patch | 41 ---- ...nvert-buffer-presentation-timestamps.patch | 49 ----- ...away-with-the-per-stream-condvars-a.patch} | 42 ++-- ...not-fail-caps-negotiation-when-ther.patch} | 83 ++++---- ...ne-Do-not-send-MF_MEDIA_ENGINE_EVENT.patch | 49 +++++ ...015-Marker-commit-do-not-put-into-MR.patch | 22 +++ ...t-for-samples-in-a-dedicated-work-q.patch} | 12 +- ...-not-send-MF_MEDIA_ENGINE_EVENT_ERRO.patch | 34 ---- ...-a-resampler-to-wg_parser-for-raw-a.patch} | 8 +- ...-a-videoscale-element-to-wg_parser-.patch} | 10 +- ...er-Implement-buffering-in-wg_parser.patch} | 26 +-- ...-not-put-pipeline-back-into-PAUSED-s.patch | 33 ---- ...s-all-uridecodebin-output-streams-t.patch} | 16 +- ...edule-stored-timers-for-the-origina.patch} | 4 +- ...ng-samples-only-at-the-PTS-of-the-f.patch} | 6 +- ...er-Discard-buffers-with-negative-PTS.patch | 102 ---------- ...K-Pretend-that-we-have-a-discontinu.patch} | 8 +- ...mer-HACK-Pretend-that-we-have-a-dis.patch} | 8 +- ...ession-pretend-that-we-have-a-disco.patch} | 4 +- ...-Adjust-buffer-timestamps-after-seek.patch | 52 ----- ...-pthread_cond_broadcast-instead-of-.patch} | 26 +-- ...a-session-discard-samples-with-nega.patch} | 4 +- ...mer-Factor-out-multiqueue-creation-.patch} | 10 +- ...0029-winegstreamer-GST_LOG-GST_DEBUG.patch | 40 ++-- ...gnal-flow-error-when-parser-is-in-er.patch | 37 ++++ ...amer-Implement-buffering-in-wg_parse.patch | 187 ++++++++++++++++++ ...amer-Tighten-buffering-limits-and-th.patch | 32 +++ 39 files changed, 790 insertions(+), 536 deletions(-) create mode 100644 patches/wine-gst/0001-winegstreamer-Do-not-create-a-read-thread-for-uridec.patch rename patches/wine-gst/{0022-winegstreamer-Ignore-assert-in-wg_parser.patch => 0002-winegstreamer-Ignore-an-assert-in-wg_parser.patch} (54%) rename patches/wine-gst/{0028-winegstreamer-Fixate-caps-in-autoplug_continue_cb.patch => 0003-winegstreamer-Fixate-caps-in-autoplug_continue_cb.patch} (74%) rename patches/wine-gst/{0013-winegstreamer-Make-wg_parser-report-the-exact-suppor.patch => 0004-winegstreamer-Make-wg_parser-report-the-exact-suppor.patch} (75%) rename patches/wine-gst/{0006-winegstreamer-Add-more-RTSP-based-formats-to-GStream.patch => 0005-winegstreamer-Add-more-RTSP-based-URI-schemes-to-GSt.patch} (92%) rename patches/wine-gst/{0008-winegstreamer-Set-a-clock-for-the-wg_parser-pipeline.patch => 0006-winegstreamer-Set-a-clock-for-the-wg_parser-pipeline.patch} (78%) rename patches/wine-gst/{0009-winegstreamer-Set-base-time-on-wg_parser-bin-while-c.patch => 0007-winegstreamer-Set-base-time-on-wg_parser-bin-while-c.patch} (78%) create mode 100644 patches/wine-gst/0008-winegstreamer-Put-pipeline-into-PLAYING-state-before.patch create mode 100644 patches/wine-gst/0009-winegstreamer-Convert-buffer-presentation-timestamps.patch create mode 100644 patches/wine-gst/0010-winegstreamer-Adjust-buffer-timestamps-after-seek.patch rename patches/wine-gst/{0010-winegstreamer-Reorder-parser-initialization-code-a-b.patch => 0011-winegstreamer-Reorder-parser-initialization-code-a-b.patch} (88%) delete mode 100644 patches/wine-gst/0011-winegstreamer-Temporarily-put-pipeline-into-PLAYING-.patch delete mode 100644 patches/wine-gst/0012-winegstreamer-Convert-buffer-presentation-timestamps.patch rename patches/wine-gst/{0004-winegstreamer-Do-away-with-the-per-stream-condvars-a.patch => 0012-winegstreamer-Do-away-with-the-per-stream-condvars-a.patch} (78%) rename patches/wine-gst/{0027-winegstreamer-Do-not-fail-caps-negotiation-when-ther.patch => 0013-winegstreamer-Do-not-fail-caps-negotiation-when-ther.patch} (65%) create mode 100644 patches/wine-gst/0014-HACK-mfmediaengine-Do-not-send-MF_MEDIA_ENGINE_EVENT.patch create mode 100644 patches/wine-gst/0015-Marker-commit-do-not-put-into-MR.patch rename patches/wine-gst/{0001-winegstreamer-Wait-for-samples-in-a-dedicated-work-q.patch => 0016-winegstreamer-Wait-for-samples-in-a-dedicated-work-q.patch} (94%) delete mode 100644 patches/wine-gst/0017-mfmediaengine-Do-not-send-MF_MEDIA_ENGINE_EVENT_ERRO.patch rename patches/wine-gst/{0002-winegstreamer-Add-a-resampler-to-wg_parser-for-raw-a.patch => 0017-winegstreamer-Add-a-resampler-to-wg_parser-for-raw-a.patch} (80%) rename patches/wine-gst/{0003-winegstreamer-Add-a-videoscale-element-to-wg_parser-.patch => 0018-winegstreamer-Add-a-videoscale-element-to-wg_parser-.patch} (83%) rename patches/wine-gst/{0005-winegstreamer-Implement-buffering-in-wg_parser.patch => 0019-winegstreamer-Implement-buffering-in-wg_parser.patch} (89%) delete mode 100644 patches/wine-gst/0020-winegstreamer-Do-not-put-pipeline-back-into-PAUSED-s.patch rename patches/wine-gst/{0007-winegstreamer-Pass-all-uridecodebin-output-streams-t.patch => 0020-winegstreamer-Pass-all-uridecodebin-output-streams-t.patch} (91%) rename patches/wine-gst/{0014-winegstreamer-Schedule-stored-timers-for-the-origina.patch => 0021-winegstreamer-Schedule-stored-timers-for-the-origina.patch} (95%) rename patches/wine-gst/{0015-winegstreamer-Start-forwarding-samples-only-at-the-P.patch => 0022-mf-Start-forwarding-samples-only-at-the-PTS-of-the-f.patch} (98%) delete mode 100644 patches/wine-gst/0023-winegstreamer-Discard-buffers-with-negative-PTS.patch rename patches/wine-gst/{0016-winegstreamer-HACK-Pretend-that-we-have-a-discontinu.patch => 0023-winegstreamer-HACK-Pretend-that-we-have-a-discontinu.patch} (94%) rename patches/wine-gst/{0018-Revert-winegstreamer-HACK-Pretend-that-we-have-a-dis.patch => 0024-Revert-winegstreamer-HACK-Pretend-that-we-have-a-dis.patch} (94%) rename patches/wine-gst/{0019-mf-In-the-media-session-pretend-that-we-have-a-disco.patch => 0025-mf-In-the-media-session-pretend-that-we-have-a-disco.patch} (96%) delete mode 100644 patches/wine-gst/0025-winegstreamer-Adjust-buffer-timestamps-after-seek.patch rename patches/wine-gst/{0021-winegstreamer-Use-pthread_cond_broadcast-instead-of-.patch => 0026-winegstreamer-Use-pthread_cond_broadcast-instead-of-.patch} (75%) rename patches/wine-gst/{0024-SQUASH-mf-In-media-session-discard-samples-with-nega.patch => 0027-SQUASH-mf-In-media-session-discard-samples-with-nega.patch} (86%) rename patches/wine-gst/{0026-SQUASH-winegstreamer-Factor-out-multiqueue-creation-.patch => 0028-SQUASH-winegstreamer-Factor-out-multiqueue-creation-.patch} (88%) create mode 100644 patches/wine-gst/0030-winegstreamer-Signal-flow-error-when-parser-is-in-er.patch create mode 100644 patches/wine-gst/0031-Revert-winegstreamer-Implement-buffering-in-wg_parse.patch create mode 100644 patches/wine-gst/0032-SQUASH-winegstreamer-Tighten-buffering-limits-and-th.patch diff --git a/patches/protonprep-valve-staging.sh b/patches/protonprep-valve-staging.sh index a93c9db52..abdb738c3 100755 --- a/patches/protonprep-valve-staging.sh +++ b/patches/protonprep-valve-staging.sh @@ -288,35 +288,38 @@ patch -Np1 < ../patches/proton/47-proton-fshack-AMD-FSR-complete.patch echo "WINE: RTSP patch" - patch -Np1 < ../patches/wine-gst/0001-winegstreamer-Wait-for-samples-in-a-dedicated-work-q.patch - patch -Np1 < ../patches/wine-gst/0002-winegstreamer-Add-a-resampler-to-wg_parser-for-raw-a.patch - patch -Np1 < ../patches/wine-gst/0003-winegstreamer-Add-a-videoscale-element-to-wg_parser-.patch - patch -Np1 < ../patches/wine-gst/0004-winegstreamer-Do-away-with-the-per-stream-condvars-a.patch - patch -Np1 < ../patches/wine-gst/0005-winegstreamer-Implement-buffering-in-wg_parser.patch - patch -Np1 < ../patches/wine-gst/0006-winegstreamer-Add-more-RTSP-based-formats-to-GStream.patch - patch -Np1 < ../patches/wine-gst/0007-winegstreamer-Pass-all-uridecodebin-output-streams-t.patch - patch -Np1 < ../patches/wine-gst/0008-winegstreamer-Set-a-clock-for-the-wg_parser-pipeline.patch - patch -Np1 < ../patches/wine-gst/0009-winegstreamer-Set-base-time-on-wg_parser-bin-while-c.patch - patch -Np1 < ../patches/wine-gst/0010-winegstreamer-Reorder-parser-initialization-code-a-b.patch - patch -Np1 < ../patches/wine-gst/0011-winegstreamer-Temporarily-put-pipeline-into-PLAYING-.patch - patch -Np1 < ../patches/wine-gst/0012-winegstreamer-Convert-buffer-presentation-timestamps.patch - patch -Np1 < ../patches/wine-gst/0013-winegstreamer-Make-wg_parser-report-the-exact-suppor.patch - patch -Np1 < ../patches/wine-gst/0014-winegstreamer-Schedule-stored-timers-for-the-origina.patch - patch -Np1 < ../patches/wine-gst/0015-winegstreamer-Start-forwarding-samples-only-at-the-P.patch - patch -Np1 < ../patches/wine-gst/0016-winegstreamer-HACK-Pretend-that-we-have-a-discontinu.patch - patch -Np1 < ../patches/wine-gst/0017-mfmediaengine-Do-not-send-MF_MEDIA_ENGINE_EVENT_ERRO.patch - patch -Np1 < ../patches/wine-gst/0018-Revert-winegstreamer-HACK-Pretend-that-we-have-a-dis.patch - patch -Np1 < ../patches/wine-gst/0019-mf-In-the-media-session-pretend-that-we-have-a-disco.patch - patch -Np1 < ../patches/wine-gst/0020-winegstreamer-Do-not-put-pipeline-back-into-PAUSED-s.patch - patch -Np1 < ../patches/wine-gst/0021-winegstreamer-Use-pthread_cond_broadcast-instead-of-.patch - patch -Np1 < ../patches/wine-gst/0022-winegstreamer-Ignore-assert-in-wg_parser.patch - patch -Np1 < ../patches/wine-gst/0023-winegstreamer-Discard-buffers-with-negative-PTS.patch - patch -Np1 < ../patches/wine-gst/0024-SQUASH-mf-In-media-session-discard-samples-with-nega.patch - patch -Np1 < ../patches/wine-gst/0025-winegstreamer-Adjust-buffer-timestamps-after-seek.patch - patch -Np1 < ../patches/wine-gst/0026-SQUASH-winegstreamer-Factor-out-multiqueue-creation-.patch - patch -Np1 < ../patches/wine-gst/0027-winegstreamer-Do-not-fail-caps-negotiation-when-ther.patch - patch -Np1 < ../patches/wine-gst/0028-winegstreamer-Fixate-caps-in-autoplug_continue_cb.patch + patch -Np1 < ../patches/wine-gst/0001-winegstreamer-Do-not-create-a-read-thread-for-uridec.patch + patch -Np1 < ../patches/wine-gst/0002-winegstreamer-Ignore-an-assert-in-wg_parser.patch + patch -Np1 < ../patches/wine-gst/0003-winegstreamer-Fixate-caps-in-autoplug_continue_cb.patch + patch -Np1 < ../patches/wine-gst/0004-winegstreamer-Make-wg_parser-report-the-exact-suppor.patch + patch -Np1 < ../patches/wine-gst/0005-winegstreamer-Add-more-RTSP-based-URI-schemes-to-GSt.patch + patch -Np1 < ../patches/wine-gst/0006-winegstreamer-Set-a-clock-for-the-wg_parser-pipeline.patch + patch -Np1 < ../patches/wine-gst/0007-winegstreamer-Set-base-time-on-wg_parser-bin-while-c.patch + patch -Np1 < ../patches/wine-gst/0008-winegstreamer-Put-pipeline-into-PLAYING-state-before.patch + patch -Np1 < ../patches/wine-gst/0009-winegstreamer-Convert-buffer-presentation-timestamps.patch + patch -Np1 < ../patches/wine-gst/0010-winegstreamer-Adjust-buffer-timestamps-after-seek.patch + patch -Np1 < ../patches/wine-gst/0011-winegstreamer-Reorder-parser-initialization-code-a-b.patch + patch -Np1 < ../patches/wine-gst/0012-winegstreamer-Do-away-with-the-per-stream-condvars-a.patch + patch -Np1 < ../patches/wine-gst/0013-winegstreamer-Do-not-fail-caps-negotiation-when-ther.patch + patch -Np1 < ../patches/wine-gst/0014-HACK-mfmediaengine-Do-not-send-MF_MEDIA_ENGINE_EVENT.patch + patch -Np1 < ../patches/wine-gst/0015-Marker-commit-do-not-put-into-MR.patch + patch -Np1 < ../patches/wine-gst/0016-winegstreamer-Wait-for-samples-in-a-dedicated-work-q.patch + patch -Np1 < ../patches/wine-gst/0017-winegstreamer-Add-a-resampler-to-wg_parser-for-raw-a.patch + patch -Np1 < ../patches/wine-gst/0018-winegstreamer-Add-a-videoscale-element-to-wg_parser-.patch + patch -Np1 < ../patches/wine-gst/0019-winegstreamer-Implement-buffering-in-wg_parser.patch + patch -Np1 < ../patches/wine-gst/0020-winegstreamer-Pass-all-uridecodebin-output-streams-t.patch + patch -Np1 < ../patches/wine-gst/0021-winegstreamer-Schedule-stored-timers-for-the-origina.patch + patch -Np1 < ../patches/wine-gst/0022-mf-Start-forwarding-samples-only-at-the-PTS-of-the-f.patch + patch -Np1 < ../patches/wine-gst/0023-winegstreamer-HACK-Pretend-that-we-have-a-discontinu.patch + patch -Np1 < ../patches/wine-gst/0024-Revert-winegstreamer-HACK-Pretend-that-we-have-a-dis.patch + patch -Np1 < ../patches/wine-gst/0025-mf-In-the-media-session-pretend-that-we-have-a-disco.patch + patch -Np1 < ../patches/wine-gst/0026-winegstreamer-Use-pthread_cond_broadcast-instead-of-.patch + patch -Np1 < ../patches/wine-gst/0027-SQUASH-mf-In-media-session-discard-samples-with-nega.patch + patch -Np1 < ../patches/wine-gst/0028-SQUASH-winegstreamer-Factor-out-multiqueue-creation-.patch patch -Np1 < ../patches/wine-gst/0029-winegstreamer-GST_LOG-GST_DEBUG.patch + patch -Np1 < ../patches/wine-gst/0030-winegstreamer-Signal-flow-error-when-parser-is-in-er.patch + patch -Np1 < ../patches/wine-gst/0031-Revert-winegstreamer-Implement-buffering-in-wg_parse.patch + patch -Np1 < ../patches/wine-gst/0032-SQUASH-winegstreamer-Tighten-buffering-limits-and-th.patch #echo "WINE: -Nvidia Reflex- Support VK_NV_low_latency2" #patch -Np1 < ../patches/proton/83-nv_low_latency_wine.patch diff --git a/patches/wine-gst/0001-winegstreamer-Do-not-create-a-read-thread-for-uridec.patch b/patches/wine-gst/0001-winegstreamer-Do-not-create-a-read-thread-for-uridec.patch new file mode 100644 index 000000000..eb94b660f --- /dev/null +++ b/patches/wine-gst/0001-winegstreamer-Do-not-create-a-read-thread-for-uridec.patch @@ -0,0 +1,43 @@ +From 294c85000c51d7562eef31175487a096ac87179a Mon Sep 17 00:00:00 2001 +From: Torge Matthies +Date: Mon, 25 Mar 2024 09:19:18 +0100 +Subject: [PATCH 01/32] winegstreamer: Do not create a read thread for + uridecodebin-based media sources. + +--- + dlls/winegstreamer/media_source.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c +index 83ab880f8ef..6d58d51045a 100644 +--- a/dlls/winegstreamer/media_source.c ++++ b/dlls/winegstreamer/media_source.c +@@ -1614,9 +1614,12 @@ static HRESULT WINAPI media_source_Shutdown(IMFMediaSource *iface) + + wg_parser_disconnect(source->wg_parser); + +- source->read_thread_shutdown = true; +- WaitForSingleObject(source->read_thread, INFINITE); +- CloseHandle(source->read_thread); ++ if (source->read_thread) ++ { ++ source->read_thread_shutdown = true; ++ WaitForSingleObject(source->read_thread, INFINITE); ++ CloseHandle(source->read_thread); ++ } + + IMFMediaEventQueue_Shutdown(source->event_queue); + IMFByteStream_Close(source->byte_stream); +@@ -1711,7 +1714,8 @@ static HRESULT media_source_create(struct object_context *context, IMFMediaSourc + } + object->wg_parser = parser; + +- object->read_thread = CreateThread(NULL, 0, read_thread, object, 0, NULL); ++ if (context->type != WG_PARSER_URIDECODEBIN) ++ object->read_thread = CreateThread(NULL, 0, read_thread, object, 0, NULL); + + object->state = SOURCE_OPENING; + +-- +2.44.0 + diff --git a/patches/wine-gst/0022-winegstreamer-Ignore-assert-in-wg_parser.patch b/patches/wine-gst/0002-winegstreamer-Ignore-an-assert-in-wg_parser.patch similarity index 54% rename from patches/wine-gst/0022-winegstreamer-Ignore-assert-in-wg_parser.patch rename to patches/wine-gst/0002-winegstreamer-Ignore-an-assert-in-wg_parser.patch index 9d7be9344..6aa73a287 100644 --- a/patches/wine-gst/0022-winegstreamer-Ignore-assert-in-wg_parser.patch +++ b/patches/wine-gst/0002-winegstreamer-Ignore-an-assert-in-wg_parser.patch @@ -1,22 +1,20 @@ -From 566e91a7df1968c79786fb94d67ddd1b466f8640 Mon Sep 17 00:00:00 2001 +From d7061741bdb93e8d06ba60102d33bd01cb797b27 Mon Sep 17 00:00:00 2001 From: Torge Matthies Date: Tue, 19 Mar 2024 04:06:37 +0100 -Subject: [PATCH 22/29] winegstreamer: Ignore assert in wg_parser. +Subject: [PATCH 02/32] winegstreamer: Ignore an assert in wg_parser. -I don't know why this gets hit but it does. - -EDIT: I think this gets hit when a wg_parser receives GST_EVENT_FLUSH_START between the wg_parser_stream_get_buffer -function return and the wg_parser_stream_release_buffer call. In this case the NULL buffer can be ignored, it does no -harm and there is no memory leak from this. +This gets hit when a wg_parser receives GST_EVENT_FLUSH_START between the wg_parser_stream_get_buffer function return +and the wg_parser_stream_release_buffer call. In this case the NULL buffer can be ignored, it does no harm and there +is no memory leak from this. --- dlls/winegstreamer/wg_parser.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c -index c8f173df6ac..5c75776f523 100644 +index 2d00f4247e0..8f45f49b012 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c -@@ -422,11 +422,12 @@ static NTSTATUS wg_parser_stream_release_buffer(void *args) +@@ -409,11 +409,12 @@ static NTSTATUS wg_parser_stream_release_buffer(void *args) pthread_mutex_lock(&parser->mutex); @@ -32,8 +30,8 @@ index c8f173df6ac..5c75776f523 100644 + stream->buffer = NULL; + } - if (stream->buffer_queue && stream->buffer_queue_length) - { + pthread_mutex_unlock(&parser->mutex); + pthread_cond_signal(&stream->event_empty_cond); -- 2.44.0 diff --git a/patches/wine-gst/0028-winegstreamer-Fixate-caps-in-autoplug_continue_cb.patch b/patches/wine-gst/0003-winegstreamer-Fixate-caps-in-autoplug_continue_cb.patch similarity index 74% rename from patches/wine-gst/0028-winegstreamer-Fixate-caps-in-autoplug_continue_cb.patch rename to patches/wine-gst/0003-winegstreamer-Fixate-caps-in-autoplug_continue_cb.patch index 56b96d083..d1c78d9a3 100644 --- a/patches/wine-gst/0028-winegstreamer-Fixate-caps-in-autoplug_continue_cb.patch +++ b/patches/wine-gst/0003-winegstreamer-Fixate-caps-in-autoplug_continue_cb.patch @@ -1,7 +1,7 @@ -From 8352bf2c8624c3015d54169868b6df6ef6a87484 Mon Sep 17 00:00:00 2001 +From dd85cdadb0ab69640e5d3116774ca9d7b090dbfd Mon Sep 17 00:00:00 2001 From: Torge Matthies Date: Tue, 19 Mar 2024 10:19:09 +0100 -Subject: [PATCH 28/29] winegstreamer: Fixate caps in autoplug_continue_cb. +Subject: [PATCH 03/32] winegstreamer: Fixate caps in autoplug_continue_cb. Not strictly necessary but avoids an assert in gstreamer code. --- @@ -9,10 +9,10 @@ Not strictly necessary but avoids an assert in gstreamer code. 1 file changed, 2 insertions(+) diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c -index 4c4ee4bcc2a..3bee51ed518 100644 +index 8f45f49b012..20009d6f269 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c -@@ -577,7 +577,9 @@ static gboolean autoplug_continue_cb(GstElement * decodebin, GstPad *pad, GstCap +@@ -527,7 +527,9 @@ static gboolean autoplug_continue_cb(GstElement * decodebin, GstPad *pad, GstCap { struct wg_format format; diff --git a/patches/wine-gst/0013-winegstreamer-Make-wg_parser-report-the-exact-suppor.patch b/patches/wine-gst/0004-winegstreamer-Make-wg_parser-report-the-exact-suppor.patch similarity index 75% rename from patches/wine-gst/0013-winegstreamer-Make-wg_parser-report-the-exact-suppor.patch rename to patches/wine-gst/0004-winegstreamer-Make-wg_parser-report-the-exact-suppor.patch index f6c3a7316..7d6da24de 100644 --- a/patches/wine-gst/0013-winegstreamer-Make-wg_parser-report-the-exact-suppor.patch +++ b/patches/wine-gst/0004-winegstreamer-Make-wg_parser-report-the-exact-suppor.patch @@ -1,39 +1,34 @@ -From c61856ab6b81f6f654ec0fe2a194fa87c5b75f5f Mon Sep 17 00:00:00 2001 +From e27afb77ed05d69fa8515a1e821e1341c1a04b42 Mon Sep 17 00:00:00 2001 From: Torge Matthies Date: Tue, 20 Feb 2024 23:17:28 +0100 -Subject: [PATCH 13/29] winegstreamer: Make wg_parser report the exact +Subject: [PATCH 04/32] winegstreamer: Make wg_parser report the exact supported formats to gstreamer instead of just ANY. --- - dlls/winegstreamer/wg_parser.c | 47 +++++++++++++++++++++++++++++++++- - 1 file changed, 46 insertions(+), 1 deletion(-) + dlls/winegstreamer/wg_parser.c | 42 +++++++++++++++++++++++++++++++++- + 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c -index 9cabc0d899b..962cc136173 100644 +index 20009d6f269..1d3314c582e 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c -@@ -935,6 +935,48 @@ static GstFlowReturn sink_chain_cb(GstPad *pad, GstObject *parent, GstBuffer *bu +@@ -835,6 +835,43 @@ static GstFlowReturn sink_chain_cb(GstPad *pad, GstObject *parent, GstBuffer *bu return GST_FLOW_OK; } +static GstCaps *get_supported_formats(void) +{ -+ static const GstAudioChannelPosition dummy_positions[] = -+ { -+ GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, -+ GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, -+ }; + GstCaps *caps = gst_caps_new_empty(), *temp; + GstAudioInfo ainfo; + GstVideoInfo vinfo; + gsize i; + + /* video/x-raw */ -+ gst_video_info_set_format(&vinfo, WG_VIDEO_FORMAT_BGRA, 1920, 1080); ++ gst_video_info_set_format(&vinfo, GST_VIDEO_FORMAT_BGRA, 1, 1); + temp = gst_video_info_to_caps(&vinfo); + for (i = 0; i < gst_caps_get_size(temp); ++i) + gst_structure_remove_fields(gst_caps_get_structure(temp, i), -+ "format", "width", "height", "framerate", NULL); ++ "format", "width", "height", "framerate", "colorimetry", NULL); + gst_caps_append(caps, temp); + /* other formats */ + gst_caps_append(caps, gst_caps_new_empty_simple("video/x-cinepak")); @@ -43,7 +38,7 @@ index 9cabc0d899b..962cc136173 100644 + gst_caps_append(caps, gst_caps_new_empty_simple("video/x-indeo")); + + /* audio/x-raw */ -+ gst_audio_info_set_format(&ainfo, GST_AUDIO_FORMAT_S16LE, 48000, 2, dummy_positions); ++ gst_audio_info_set_format(&ainfo, GST_AUDIO_FORMAT_S16LE, 1, 1, NULL); + temp = gst_audio_info_to_caps(&ainfo); + for (i = 0; i < gst_caps_get_size(temp); ++i) + gst_structure_remove_fields(gst_caps_get_structure(temp, i), @@ -61,7 +56,7 @@ index 9cabc0d899b..962cc136173 100644 static gboolean sink_query_cb(GstPad *pad, GstObject *parent, GstQuery *query) { struct wg_parser_stream *stream = gst_pad_get_element_private(pad); -@@ -952,7 +994,10 @@ static gboolean sink_query_cb(GstPad *pad, GstObject *parent, GstQuery *query) +@@ -852,7 +889,10 @@ static gboolean sink_query_cb(GstPad *pad, GstObject *parent, GstQuery *query) gst_query_parse_caps(query, &filter); pthread_mutex_lock(&parser->mutex); diff --git a/patches/wine-gst/0006-winegstreamer-Add-more-RTSP-based-formats-to-GStream.patch b/patches/wine-gst/0005-winegstreamer-Add-more-RTSP-based-URI-schemes-to-GSt.patch similarity index 92% rename from patches/wine-gst/0006-winegstreamer-Add-more-RTSP-based-formats-to-GStream.patch rename to patches/wine-gst/0005-winegstreamer-Add-more-RTSP-based-URI-schemes-to-GSt.patch index a864a1030..c96e425d2 100644 --- a/patches/wine-gst/0006-winegstreamer-Add-more-RTSP-based-formats-to-GStream.patch +++ b/patches/wine-gst/0005-winegstreamer-Add-more-RTSP-based-URI-schemes-to-GSt.patch @@ -1,8 +1,8 @@ -From d241727d56653caaa71b24243132ef8f21857e76 Mon Sep 17 00:00:00 2001 +From 71789e7d80746468414cb14c18e9b885b11fc157 Mon Sep 17 00:00:00 2001 From: Torge Matthies Date: Wed, 31 Jan 2024 17:42:54 +0100 -Subject: [PATCH 06/29] winegstreamer: Add more RTSP-based formats to GStreamer - scheme handler. +Subject: [PATCH 05/32] winegstreamer: Add more RTSP-based URI schemes to + GStreamer scheme handler. --- dlls/winegstreamer/winegstreamer.rgs | 32 ++++++++++++++++++++++++++++ diff --git a/patches/wine-gst/0008-winegstreamer-Set-a-clock-for-the-wg_parser-pipeline.patch b/patches/wine-gst/0006-winegstreamer-Set-a-clock-for-the-wg_parser-pipeline.patch similarity index 78% rename from patches/wine-gst/0008-winegstreamer-Set-a-clock-for-the-wg_parser-pipeline.patch rename to patches/wine-gst/0006-winegstreamer-Set-a-clock-for-the-wg_parser-pipeline.patch index ea2b506a2..7edf1fea0 100644 --- a/patches/wine-gst/0008-winegstreamer-Set-a-clock-for-the-wg_parser-pipeline.patch +++ b/patches/wine-gst/0006-winegstreamer-Set-a-clock-for-the-wg_parser-pipeline.patch @@ -1,7 +1,7 @@ -From 3acfeb18e113122b20b6d6a7eb527a3037f01a72 Mon Sep 17 00:00:00 2001 +From f674a8869be9b25f33d507a81fc13c85a6b38046 Mon Sep 17 00:00:00 2001 From: Torge Matthies Date: Wed, 31 Jan 2024 17:42:55 +0100 -Subject: [PATCH 08/29] winegstreamer: Set a clock for the wg_parser pipeline. +Subject: [PATCH 06/32] winegstreamer: Set a clock for the wg_parser pipeline. Some elements under uridecodebin (e.g. the RTSP demuxer) require a valid clock to function properly. GstPipeline does this so let's do this too. @@ -10,10 +10,10 @@ GstPipeline does this so let's do this too. 1 file changed, 2 insertions(+) diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c -index 854597c73eb..696c24d0059 100644 +index 1d3314c582e..f4ec803f14f 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c -@@ -2015,6 +2015,8 @@ static NTSTATUS wg_parser_connect(void *args) +@@ -1872,6 +1872,8 @@ static NTSTATUS wg_parser_connect(void *args) gst_pad_set_event_function(parser->my_src, src_event_cb); gst_pad_set_element_private(parser->my_src, parser); diff --git a/patches/wine-gst/0009-winegstreamer-Set-base-time-on-wg_parser-bin-while-c.patch b/patches/wine-gst/0007-winegstreamer-Set-base-time-on-wg_parser-bin-while-c.patch similarity index 78% rename from patches/wine-gst/0009-winegstreamer-Set-base-time-on-wg_parser-bin-while-c.patch rename to patches/wine-gst/0007-winegstreamer-Set-base-time-on-wg_parser-bin-while-c.patch index 7e39302e7..e160ebb6b 100644 --- a/patches/wine-gst/0009-winegstreamer-Set-base-time-on-wg_parser-bin-while-c.patch +++ b/patches/wine-gst/0007-winegstreamer-Set-base-time-on-wg_parser-bin-while-c.patch @@ -1,7 +1,7 @@ -From 3aaef1bb825952738a1bc3b4b4dea77abd75c8b4 Mon Sep 17 00:00:00 2001 +From 5126ef2fd83557b3a6a0886d577809607ebae4e9 Mon Sep 17 00:00:00 2001 From: Torge Matthies Date: Wed, 31 Jan 2024 17:42:55 +0100 -Subject: [PATCH 09/29] winegstreamer: Set base time on wg_parser bin while +Subject: [PATCH 07/32] winegstreamer: Set base time on wg_parser bin while connecting. --- @@ -9,10 +9,10 @@ Subject: [PATCH 09/29] winegstreamer: Set base time on wg_parser bin while 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c -index 696c24d0059..886f3420119 100644 +index f4ec803f14f..f2570211ffd 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c -@@ -1980,6 +1980,7 @@ static NTSTATUS wg_parser_connect(void *args) +@@ -1837,6 +1837,7 @@ static NTSTATUS wg_parser_connect(void *args) const struct wg_parser_connect_params *params = args; struct wg_parser *parser = get_parser(params->parser); const WCHAR *uri = params->uri; @@ -20,7 +20,7 @@ index 696c24d0059..886f3420119 100644 unsigned int i; int ret; -@@ -2015,7 +2016,8 @@ static NTSTATUS wg_parser_connect(void *args) +@@ -1872,7 +1873,8 @@ static NTSTATUS wg_parser_connect(void *args) gst_pad_set_event_function(parser->my_src, src_event_cb); gst_pad_set_element_private(parser->my_src, parser); @@ -30,7 +30,7 @@ index 696c24d0059..886f3420119 100644 parser->start_offset = parser->next_offset = parser->stop_offset = 0; parser->next_pull_offset = 0; -@@ -2024,6 +2026,7 @@ static NTSTATUS wg_parser_connect(void *args) +@@ -1881,6 +1883,7 @@ static NTSTATUS wg_parser_connect(void *args) if (!parser->init_gst(parser)) goto out; diff --git a/patches/wine-gst/0008-winegstreamer-Put-pipeline-into-PLAYING-state-before.patch b/patches/wine-gst/0008-winegstreamer-Put-pipeline-into-PLAYING-state-before.patch new file mode 100644 index 000000000..68484b41f --- /dev/null +++ b/patches/wine-gst/0008-winegstreamer-Put-pipeline-into-PLAYING-state-before.patch @@ -0,0 +1,32 @@ +From 4731071325d686ecf35913f071f74081803d082c Mon Sep 17 00:00:00 2001 +From: Torge Matthies +Date: Wed, 31 Jan 2024 17:42:55 +0100 +Subject: [PATCH 08/32] winegstreamer: Put pipeline into PLAYING state before + waiting for the no-more-pads callback. + +Some elements (e.g. uridecodebin with an RTSP URI) won't send no-more-pads in READY/PAUSED state. +--- + dlls/winegstreamer/wg_parser.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c +index f2570211ffd..f77330a1410 100644 +--- a/dlls/winegstreamer/wg_parser.c ++++ b/dlls/winegstreamer/wg_parser.c +@@ -1901,6 +1901,13 @@ static NTSTATUS wg_parser_connect(void *args) + + pthread_mutex_lock(&parser->mutex); + ++ if (parser->uri) ++ { ++ gst_element_set_state(parser->container, GST_STATE_PLAYING); ++ ret = gst_element_get_state(parser->container, NULL, NULL, -1); ++ if (ret == GST_STATE_CHANGE_FAILURE) ++ goto out; ++ } + while (!parser_no_more_pads(parser) && !parser->error) + pthread_cond_wait(&parser->init_cond, &parser->mutex); + if (parser->error) +-- +2.44.0 + diff --git a/patches/wine-gst/0009-winegstreamer-Convert-buffer-presentation-timestamps.patch b/patches/wine-gst/0009-winegstreamer-Convert-buffer-presentation-timestamps.patch new file mode 100644 index 000000000..2131d44f2 --- /dev/null +++ b/patches/wine-gst/0009-winegstreamer-Convert-buffer-presentation-timestamps.patch @@ -0,0 +1,93 @@ +From 0644a83cbadc98076e10db562158f11350d3d60e Mon Sep 17 00:00:00 2001 +From: Torge Matthies +Date: Wed, 31 Jan 2024 17:42:55 +0100 +Subject: [PATCH 09/32] winegstreamer: Convert buffer presentation timestamps + into running time. + +--- + dlls/winegstreamer/wg_parser.c | 46 +++++++++++++++++++++++----------- + 1 file changed, 31 insertions(+), 15 deletions(-) + +diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c +index f77330a1410..b53bc29950f 100644 +--- a/dlls/winegstreamer/wg_parser.c ++++ b/dlls/winegstreamer/wg_parser.c +@@ -306,6 +306,18 @@ static GstBuffer *wait_parser_stream_buffer(struct wg_parser *parser, struct wg_ + return buffer; + } + ++static void release_buffer(struct wg_parser *parser, struct wg_parser_stream *stream) ++{ ++ if (stream->buffer) ++ { ++ gst_buffer_unmap(stream->buffer, &stream->map_info); ++ gst_buffer_unref(stream->buffer); ++ stream->buffer = NULL; ++ } ++ ++ pthread_cond_signal(&stream->event_empty_cond); ++} ++ + static NTSTATUS wg_parser_stream_get_buffer(void *args) + { + const struct wg_parser_stream_get_buffer_params *params = args; +@@ -317,6 +329,7 @@ static NTSTATUS wg_parser_stream_get_buffer(void *args) + + pthread_mutex_lock(&parser->mutex); + ++retry: + if (stream) + buffer = wait_parser_stream_buffer(parser, stream); + else +@@ -359,13 +372,24 @@ static NTSTATUS wg_parser_stream_get_buffer(void *args) + return S_FALSE; + } + +- /* FIXME: Should we use gst_segment_to_stream_time_full()? Under what +- * circumstances is the stream time not equal to the buffer PTS? Note +- * that this will need modification to wg_parser_stream_notify_qos() as +- * well. */ +- + if ((wg_buffer->has_pts = GST_BUFFER_PTS_IS_VALID(buffer))) +- wg_buffer->pts = GST_BUFFER_PTS(buffer) / 100; ++ { ++ if (stream->segment.format != GST_FORMAT_TIME) ++ { ++ /* Some types of streams (e.g. HLS) don't provide a segment. Assume that these start their PTS at zero. */ ++ wg_buffer->pts = GST_BUFFER_PTS(buffer) / 100; ++ } ++ else ++ { ++ guint64 stream_time = gst_segment_to_running_time(&stream->segment, GST_FORMAT_TIME, GST_BUFFER_PTS(buffer)); ++ if (stream_time == -1) ++ { ++ release_buffer(parser, stream); ++ goto retry; ++ } ++ wg_buffer->pts = stream_time / 100; ++ } ++ } + if ((wg_buffer->has_duration = GST_BUFFER_DURATION_IS_VALID(buffer))) + wg_buffer->duration = GST_BUFFER_DURATION(buffer) / 100; + wg_buffer->discontinuity = GST_BUFFER_FLAG_IS_SET(buffer, GST_BUFFER_FLAG_DISCONT); +@@ -408,16 +432,8 @@ static NTSTATUS wg_parser_stream_release_buffer(void *args) + struct wg_parser *parser = stream->parser; + + pthread_mutex_lock(&parser->mutex); +- +- if (stream->buffer) +- { +- gst_buffer_unmap(stream->buffer, &stream->map_info); +- gst_buffer_unref(stream->buffer); +- stream->buffer = NULL; +- } +- ++ release_buffer(parser, stream); + pthread_mutex_unlock(&parser->mutex); +- pthread_cond_signal(&stream->event_empty_cond); + + return S_OK; + } +-- +2.44.0 + diff --git a/patches/wine-gst/0010-winegstreamer-Adjust-buffer-timestamps-after-seek.patch b/patches/wine-gst/0010-winegstreamer-Adjust-buffer-timestamps-after-seek.patch new file mode 100644 index 000000000..42dc09925 --- /dev/null +++ b/patches/wine-gst/0010-winegstreamer-Adjust-buffer-timestamps-after-seek.patch @@ -0,0 +1,61 @@ +From 976954da9442340ffc64b76c59698bc4cb7c8eaa Mon Sep 17 00:00:00 2001 +From: Torge Matthies +Date: Tue, 19 Mar 2024 05:11:11 +0100 +Subject: [PATCH 10/32] winegstreamer: Adjust buffer timestamps after seek. + +--- + dlls/winegstreamer/wg_parser.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c +index b53bc29950f..3472da32fe8 100644 +--- a/dlls/winegstreamer/wg_parser.c ++++ b/dlls/winegstreamer/wg_parser.c +@@ -132,6 +132,8 @@ struct wg_parser_stream + gchar *tags[WG_PARSER_TAG_COUNT]; + gchar *stream_id; + int seq_id; ++ ++ guint64 seek_pos; + }; + + static struct wg_parser *get_parser(wg_parser_t parser) +@@ -377,7 +379,7 @@ retry: + if (stream->segment.format != GST_FORMAT_TIME) + { + /* Some types of streams (e.g. HLS) don't provide a segment. Assume that these start their PTS at zero. */ +- wg_buffer->pts = GST_BUFFER_PTS(buffer) / 100; ++ wg_buffer->pts = (GST_BUFFER_PTS(buffer) + stream->seek_pos) / 100; + } + else + { +@@ -387,7 +389,7 @@ retry: + release_buffer(parser, stream); + goto retry; + } +- wg_buffer->pts = stream_time / 100; ++ wg_buffer->pts = (stream_time + stream->seek_pos) / 100; + } + } + if ((wg_buffer->has_duration = GST_BUFFER_DURATION_IS_VALID(buffer))) +@@ -471,7 +473,7 @@ static NTSTATUS wg_parser_stream_seek(void *args) + const struct wg_parser_stream_seek_params *params = args; + DWORD start_flags = params->start_flags; + DWORD stop_flags = params->stop_flags; +- const struct wg_parser_stream *stream; ++ struct wg_parser_stream *stream; + GstSeekFlags flags = 0; + + stream = get_stream(params->stream); +@@ -492,6 +494,8 @@ static NTSTATUS wg_parser_stream_seek(void *args) + flags, start_type, params->start_pos * 100, stop_type, + params->stop_pos == stream->duration ? -1 : params->stop_pos * 100))) + GST_ERROR("Failed to seek."); ++ else ++ stream->seek_pos = params->start_pos * 100; + + return S_OK; + } +-- +2.44.0 + diff --git a/patches/wine-gst/0010-winegstreamer-Reorder-parser-initialization-code-a-b.patch b/patches/wine-gst/0011-winegstreamer-Reorder-parser-initialization-code-a-b.patch similarity index 88% rename from patches/wine-gst/0010-winegstreamer-Reorder-parser-initialization-code-a-b.patch rename to patches/wine-gst/0011-winegstreamer-Reorder-parser-initialization-code-a-b.patch index 4d2965e9b..3282df87f 100644 --- a/patches/wine-gst/0010-winegstreamer-Reorder-parser-initialization-code-a-b.patch +++ b/patches/wine-gst/0011-winegstreamer-Reorder-parser-initialization-code-a-b.patch @@ -1,7 +1,7 @@ -From 7ded786aa7e788d394fcd8b760769a51f5099ef7 Mon Sep 17 00:00:00 2001 +From 105e51bc119c4d0b243c65fe927b72fc06adeb1b Mon Sep 17 00:00:00 2001 From: Torge Matthies Date: Wed, 31 Jan 2024 17:42:55 +0100 -Subject: [PATCH 10/29] winegstreamer: Reorder parser initialization code a bit +Subject: [PATCH 11/32] winegstreamer: Reorder parser initialization code a bit to prevent race conditions. --- @@ -9,10 +9,10 @@ Subject: [PATCH 10/29] winegstreamer: Reorder parser initialization code a bit 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c -index 886f3420119..6a13b41238f 100644 +index 3472da32fe8..9bbc7e44144 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c -@@ -2233,7 +2233,10 @@ static BOOL decodebin_parser_init_gst(struct wg_parser *parser) +@@ -2119,7 +2119,10 @@ static BOOL decodebin_parser_init_gst(struct wg_parser *parser) gst_bin_add(GST_BIN(parser->container), element); parser->decodebin = element; @@ -24,7 +24,7 @@ index 886f3420119..6a13b41238f 100644 g_signal_connect(element, "pad-added", G_CALLBACK(pad_added_cb), parser); g_signal_connect(element, "pad-removed", G_CALLBACK(pad_removed_cb), parser); g_signal_connect(element, "autoplug-continue", G_CALLBACK(autoplug_continue_cb), parser); -@@ -2241,10 +2244,7 @@ static BOOL decodebin_parser_init_gst(struct wg_parser *parser) +@@ -2127,10 +2130,7 @@ static BOOL decodebin_parser_init_gst(struct wg_parser *parser) g_signal_connect(element, "autoplug-sort", G_CALLBACK(autoplug_sort_cb), parser); g_signal_connect(element, "no-more-pads", G_CALLBACK(no_more_pads_cb), parser); g_signal_connect(element, "deep-element-added", G_CALLBACK(deep_element_added_cb), parser); @@ -36,7 +36,7 @@ index 886f3420119..6a13b41238f 100644 if (!link_src_to_element(parser->my_src, element)) return FALSE; -@@ -2273,16 +2273,16 @@ static BOOL uridecodebin_parser_init_gst(struct wg_parser *parser) +@@ -2148,16 +2148,16 @@ static BOOL uridecodebin_parser_init_gst(struct wg_parser *parser) gst_bin_add(GST_BIN(parser->container), element); parser->decodebin = element; @@ -58,7 +58,7 @@ index 886f3420119..6a13b41238f 100644 return TRUE; } -@@ -2296,14 +2296,14 @@ static BOOL avi_parser_init_gst(struct wg_parser *parser) +@@ -2171,14 +2171,14 @@ static BOOL avi_parser_init_gst(struct wg_parser *parser) gst_bin_add(GST_BIN(parser->container), element); diff --git a/patches/wine-gst/0011-winegstreamer-Temporarily-put-pipeline-into-PLAYING-.patch b/patches/wine-gst/0011-winegstreamer-Temporarily-put-pipeline-into-PLAYING-.patch deleted file mode 100644 index 7fbeb4cff..000000000 --- a/patches/wine-gst/0011-winegstreamer-Temporarily-put-pipeline-into-PLAYING-.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 3627b36edeefb34cd92c1c9414f2810a3181537b Mon Sep 17 00:00:00 2001 -From: Torge Matthies -Date: Wed, 31 Jan 2024 17:42:55 +0100 -Subject: [PATCH 11/29] winegstreamer: Temporarily put pipeline into PLAYING - state while waiting for the no-more-pads callback. - -Some elements (RTSP) won't send no-more-pads in READY/PAUSED state. ---- - dlls/winegstreamer/wg_parser.c | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - -diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c -index 6a13b41238f..aee34f965f5 100644 ---- a/dlls/winegstreamer/wg_parser.c -+++ b/dlls/winegstreamer/wg_parser.c -@@ -2044,8 +2044,22 @@ static NTSTATUS wg_parser_connect(void *args) - - pthread_mutex_lock(&parser->mutex); - -+ if (parser->uri) -+ { -+ gst_element_set_state(parser->container, GST_STATE_PLAYING); -+ ret = gst_element_get_state(parser->container, NULL, NULL, -1); -+ if (ret == GST_STATE_CHANGE_FAILURE) -+ goto out; -+ } - while (!parser_no_more_pads(parser) && !parser->error) - pthread_cond_wait(&parser->init_cond, &parser->mutex); -+ if (parser->uri) -+ { -+ 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) -+ goto out; -+ } - if (parser->error) - { - if (!parser->use_mediaconv && parser->init_gst == decodebin_parser_init_gst) --- -2.44.0 - diff --git a/patches/wine-gst/0012-winegstreamer-Convert-buffer-presentation-timestamps.patch b/patches/wine-gst/0012-winegstreamer-Convert-buffer-presentation-timestamps.patch deleted file mode 100644 index 35f46c829..000000000 --- a/patches/wine-gst/0012-winegstreamer-Convert-buffer-presentation-timestamps.patch +++ /dev/null @@ -1,49 +0,0 @@ -From c5b60220062f7cd165a778867a75a1f664acb868 Mon Sep 17 00:00:00 2001 -From: Torge Matthies -Date: Wed, 31 Jan 2024 17:42:55 +0100 -Subject: [PATCH 12/29] winegstreamer: Convert buffer presentation timestamps - into running time. - ---- - dlls/winegstreamer/wg_parser.c | 24 ++++++++++++++++++------ - 1 file changed, 18 insertions(+), 6 deletions(-) - -diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c -index aee34f965f5..9cabc0d899b 100644 ---- a/dlls/winegstreamer/wg_parser.c -+++ b/dlls/winegstreamer/wg_parser.c -@@ -360,13 +360,25 @@ static NTSTATUS wg_parser_stream_get_buffer(void *args) - return S_FALSE; - } - -- /* FIXME: Should we use gst_segment_to_stream_time_full()? Under what -- * circumstances is the stream time not equal to the buffer PTS? Note -- * that this will need modification to wg_parser_stream_notify_qos() as -- * well. */ -- - if ((wg_buffer->has_pts = GST_BUFFER_PTS_IS_VALID(buffer))) -- wg_buffer->pts = GST_BUFFER_PTS(buffer) / 100; -+ { -+ if (stream->segment.format != GST_FORMAT_TIME) -+ wg_buffer->pts = GST_BUFFER_PTS(buffer) / 100; -+ else -+ { -+ guint64 stream_time = 0; -+ gint ret = gst_segment_to_running_time_full(&stream->segment, GST_FORMAT_TIME, GST_BUFFER_PTS(buffer), &stream_time); -+ if (!ret) -+ { -+ pthread_mutex_unlock(&parser->mutex); -+ return S_FALSE; -+ } -+ if (ret < 0) -+ wg_buffer->pts = -(gint64)stream_time / 100; -+ else -+ wg_buffer->pts = stream_time / 100; -+ } -+ } - if ((wg_buffer->has_duration = GST_BUFFER_DURATION_IS_VALID(buffer))) - wg_buffer->duration = GST_BUFFER_DURATION(buffer) / 100; - wg_buffer->discontinuity = GST_BUFFER_FLAG_IS_SET(buffer, GST_BUFFER_FLAG_DISCONT); --- -2.44.0 - diff --git a/patches/wine-gst/0004-winegstreamer-Do-away-with-the-per-stream-condvars-a.patch b/patches/wine-gst/0012-winegstreamer-Do-away-with-the-per-stream-condvars-a.patch similarity index 78% rename from patches/wine-gst/0004-winegstreamer-Do-away-with-the-per-stream-condvars-a.patch rename to patches/wine-gst/0012-winegstreamer-Do-away-with-the-per-stream-condvars-a.patch index 5b69f318d..936301d19 100644 --- a/patches/wine-gst/0004-winegstreamer-Do-away-with-the-per-stream-condvars-a.patch +++ b/patches/wine-gst/0012-winegstreamer-Do-away-with-the-per-stream-condvars-a.patch @@ -1,16 +1,15 @@ -From 5f9a9819520658bedbcd543ff1cdfaab98f44be2 Mon Sep 17 00:00:00 2001 +From 450b20ddc177f5dc598a2242d190bd4b42870bf6 Mon Sep 17 00:00:00 2001 From: Torge Matthies Date: Wed, 31 Jan 2024 17:42:54 +0100 -Subject: [PATCH 04/29] winegstreamer: Do away with the per-stream condvars and +Subject: [PATCH 12/32] winegstreamer: Do away with the per-stream condvars and use one parser-wide condvar instead. -This is required because the next commit checks conditions on all streams. --- - dlls/winegstreamer/wg_parser.c | 27 ++++++++++----------------- - 1 file changed, 10 insertions(+), 17 deletions(-) + dlls/winegstreamer/wg_parser.c | 28 +++++++++++----------------- + 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c -index 2bc1acb22ce..823cdfd9f54 100644 +index 9bbc7e44144..d0b29fa0161 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c @@ -90,6 +90,7 @@ struct wg_parser @@ -29,7 +28,7 @@ index 2bc1acb22ce..823cdfd9f54 100644 GstBuffer *buffer; GstMapInfo map_info; -@@ -288,8 +288,7 @@ static NTSTATUS wg_parser_stream_disable(void *args) +@@ -290,8 +290,7 @@ static NTSTATUS wg_parser_stream_disable(void *args) stream->enabled = false; stream->current_format.major_type = WG_MAJOR_TYPE_UNKNOWN; pthread_mutex_unlock(&parser->mutex); @@ -39,7 +38,7 @@ index 2bc1acb22ce..823cdfd9f54 100644 return S_OK; } -@@ -301,7 +300,7 @@ static GstBuffer *wait_parser_stream_buffer(struct wg_parser *parser, struct wg_ +@@ -303,7 +302,7 @@ static GstBuffer *wait_parser_stream_buffer(struct wg_parser *parser, struct wg_ * must return the buffer. */ while (stream->enabled && !(buffer = stream->buffer) && !stream->eos) @@ -48,16 +47,16 @@ index 2bc1acb22ce..823cdfd9f54 100644 return buffer; } -@@ -416,7 +415,7 @@ static NTSTATUS wg_parser_stream_release_buffer(void *args) - stream->buffer = NULL; +@@ -317,7 +316,7 @@ static void release_buffer(struct wg_parser *parser, struct wg_parser_stream *st + stream->buffer = NULL; + } - pthread_mutex_unlock(&parser->mutex); - pthread_cond_signal(&stream->event_empty_cond); + pthread_cond_signal(&parser->stream_event_cond); - - return S_OK; } -@@ -703,7 +702,7 @@ static gboolean sink_event_cb(GstPad *pad, GstObject *parent, GstEvent *event) + + static NTSTATUS wg_parser_stream_get_buffer(void *args) +@@ -726,7 +725,7 @@ static gboolean sink_event_cb(GstPad *pad, GstObject *parent, GstEvent *event) pthread_mutex_lock(&parser->mutex); stream->eos = true; if (stream->enabled) @@ -66,7 +65,7 @@ index 2bc1acb22ce..823cdfd9f54 100644 else pthread_cond_signal(&parser->init_cond); pthread_mutex_unlock(&parser->mutex); -@@ -715,7 +714,7 @@ static gboolean sink_event_cb(GstPad *pad, GstObject *parent, GstEvent *event) +@@ -738,7 +737,7 @@ static gboolean sink_event_cb(GstPad *pad, GstObject *parent, GstEvent *event) if (stream->enabled) { stream->flushing = true; @@ -75,7 +74,7 @@ index 2bc1acb22ce..823cdfd9f54 100644 if (stream->buffer) { -@@ -793,7 +792,7 @@ static GstFlowReturn sink_chain_cb(GstPad *pad, GstObject *parent, GstBuffer *bu +@@ -816,7 +815,7 @@ static GstFlowReturn sink_chain_cb(GstPad *pad, GstObject *parent, GstBuffer *bu * implementing a queue object here. */ while (stream->enabled && !stream->flushing && stream->buffer) @@ -84,7 +83,7 @@ index 2bc1acb22ce..823cdfd9f54 100644 if (!stream->enabled) { -@@ -822,7 +821,7 @@ static GstFlowReturn sink_chain_cb(GstPad *pad, GstObject *parent, GstBuffer *bu +@@ -845,7 +844,7 @@ static GstFlowReturn sink_chain_cb(GstPad *pad, GstObject *parent, GstBuffer *bu stream->buffer = buffer; pthread_mutex_unlock(&parser->mutex); @@ -93,16 +92,17 @@ index 2bc1acb22ce..823cdfd9f54 100644 /* The chain callback is given a reference to the buffer. Transfer that * reference to the stream object, which will release it in -@@ -926,8 +925,6 @@ static struct wg_parser_stream *create_stream(struct wg_parser *parser, char *id +@@ -989,8 +988,7 @@ static struct wg_parser_stream *create_stream(struct wg_parser *parser, char *id stream->number = parser->stream_count; stream->no_more_pads = true; stream->current_format.major_type = WG_MAJOR_TYPE_UNKNOWN; - pthread_cond_init(&stream->event_cond, NULL); - pthread_cond_init(&stream->event_empty_cond, NULL); ++ stream->next_format.major_type = WG_MAJOR_TYPE_UNKNOWN; sprintf(pad_name, "qz_sink_%u", parser->stream_count); stream->my_sink = gst_pad_new(pad_name, GST_PAD_SINK); -@@ -959,9 +956,6 @@ static void free_stream(struct wg_parser_stream *stream) +@@ -1022,9 +1020,6 @@ static void free_stream(struct wg_parser_stream *stream) stream->buffer = NULL; } @@ -112,7 +112,7 @@ index 2bc1acb22ce..823cdfd9f54 100644 for (i = 0; i < ARRAY_SIZE(stream->tags); ++i) { if (stream->tags[i]) -@@ -2007,10 +2001,8 @@ static NTSTATUS wg_parser_disconnect(void *args) +@@ -2070,10 +2065,8 @@ static NTSTATUS wg_parser_disconnect(void *args) /* Unblock all of our streams. */ pthread_mutex_lock(&parser->mutex); for (i = 0; i < parser->stream_count; ++i) @@ -124,7 +124,7 @@ index 2bc1acb22ce..823cdfd9f54 100644 pthread_mutex_unlock(&parser->mutex); gst_element_set_state(parser->container, GST_STATE_NULL); -@@ -2184,6 +2176,7 @@ static NTSTATUS wg_parser_create(void *args) +@@ -2247,6 +2240,7 @@ static NTSTATUS wg_parser_create(void *args) pthread_cond_init(&parser->init_cond, NULL); pthread_cond_init(&parser->read_cond, NULL); pthread_cond_init(&parser->read_done_cond, NULL); diff --git a/patches/wine-gst/0027-winegstreamer-Do-not-fail-caps-negotiation-when-ther.patch b/patches/wine-gst/0013-winegstreamer-Do-not-fail-caps-negotiation-when-ther.patch similarity index 65% rename from patches/wine-gst/0027-winegstreamer-Do-not-fail-caps-negotiation-when-ther.patch rename to patches/wine-gst/0013-winegstreamer-Do-not-fail-caps-negotiation-when-ther.patch index 1034b8742..12bd76515 100644 --- a/patches/wine-gst/0027-winegstreamer-Do-not-fail-caps-negotiation-when-ther.patch +++ b/patches/wine-gst/0013-winegstreamer-Do-not-fail-caps-negotiation-when-ther.patch @@ -1,7 +1,7 @@ -From 8a3c021891ac5fb79b9b092163661517d8d5e37e Mon Sep 17 00:00:00 2001 +From bfb6aa55618b9649aef9f2166d7bf8fc8b1863bd Mon Sep 17 00:00:00 2001 From: Torge Matthies Date: Tue, 19 Mar 2024 10:09:59 +0100 -Subject: [PATCH 27/29] winegstreamer: Do not fail caps negotiation when +Subject: [PATCH 13/32] winegstreamer: Do not fail caps negotiation when there's a concurrent reconfigure. If wg_parser_stream_enable is called between the time our sink's GST_QUERY_CAPS returns and the time our sink gets the @@ -14,14 +14,14 @@ correct caps have been negotiated (signalled by a GST_EVENT_CAPS). Also try to omit the reconfigure event in some cases. --- - dlls/winegstreamer/wg_parser.c | 45 +++++++++++++++++++++++++++++----- - 1 file changed, 39 insertions(+), 6 deletions(-) + dlls/winegstreamer/wg_parser.c | 58 +++++++++++++++++++++++++++++++--- + 1 file changed, 53 insertions(+), 5 deletions(-) diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c -index f5722486fb3..4c4ee4bcc2a 100644 +index d0b29fa0161..69c28b347cd 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c -@@ -123,7 +123,7 @@ struct wg_parser_stream +@@ -121,7 +121,7 @@ struct wg_parser_stream GstPad *my_sink; GstElement *flip, *decodebin; GstSegment segment; @@ -30,7 +30,7 @@ index f5722486fb3..4c4ee4bcc2a 100644 GstBuffer *buffer; GstMapInfo map_info; -@@ -264,10 +264,20 @@ static NTSTATUS wg_parser_stream_enable(void *args) +@@ -262,10 +262,27 @@ static NTSTATUS wg_parser_stream_enable(void *args) struct wg_parser_stream *stream = get_stream(params->stream); const struct wg_format *format = params->format; struct wg_parser *parser = stream->parser; @@ -39,10 +39,17 @@ index f5722486fb3..4c4ee4bcc2a 100644 pthread_mutex_lock(&parser->mutex); - stream->current_format = *format; -+ while (stream->next_format.major_type != WG_MAJOR_TYPE_UNKNOWN) ++ while (stream->next_format.major_type != WG_MAJOR_TYPE_UNKNOWN && !parser->error) + pthread_cond_wait(&parser->stream_event_cond, &parser->mutex); + -+ if (!wg_format_compare(&stream->current_format, format) && !(stream->has_caps && wg_format_compare(&stream->preferred_format, format))) ++ if (parser->error) ++ { ++ pthread_mutex_unlock(&parser->mutex); ++ return E_FAIL; ++ } ++ ++ if (!wg_format_compare(&stream->current_format, format) ++ && !(stream->has_caps && wg_format_compare(&stream->preferred_format, format))) + { + stream->next_format = *format; + need_reconf = TRUE; @@ -52,7 +59,7 @@ index f5722486fb3..4c4ee4bcc2a 100644 stream->enabled = true; pthread_mutex_unlock(&parser->mutex); -@@ -277,9 +287,11 @@ static NTSTATUS wg_parser_stream_enable(void *args) +@@ -275,9 +292,11 @@ static NTSTATUS wg_parser_stream_enable(void *args) bool flip = (params->flags & STREAM_ENABLE_FLAG_FLIP_RGB) && (format->u.video.height < 0); gst_util_set_object_arg(G_OBJECT(stream->flip), "method", flip ? "vertical-flip" : "none"); @@ -65,20 +72,20 @@ index f5722486fb3..4c4ee4bcc2a 100644 return S_OK; } -@@ -291,6 +303,7 @@ static NTSTATUS wg_parser_stream_disable(void *args) +@@ -289,6 +308,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; + stream->next_format.major_type = WG_MAJOR_TYPE_UNKNOWN; pthread_mutex_unlock(&parser->mutex); - pthread_cond_broadcast(&parser->stream_event_cond); + pthread_cond_signal(&parser->stream_event_cond); return S_OK; -@@ -802,6 +815,13 @@ static gboolean sink_event_cb(GstPad *pad, GstObject *parent, GstEvent *event) +@@ -777,6 +797,13 @@ static gboolean sink_event_cb(GstPad *pad, GstObject *parent, GstEvent *event) pthread_mutex_lock(&parser->mutex); wg_format_from_caps(&stream->preferred_format, caps); stream->has_caps = true; + if (stream->next_format.major_type != WG_MAJOR_TYPE_UNKNOWN -+ && wg_format_compare(&stream->preferred_format, &stream->next_format)) ++ && wg_format_compare(&stream->preferred_format, &stream->next_format)) + { + stream->current_format = stream->next_format; + stream->next_format.major_type = WG_MAJOR_TYPE_UNKNOWN; @@ -87,7 +94,7 @@ index f5722486fb3..4c4ee4bcc2a 100644 pthread_mutex_unlock(&parser->mutex); pthread_cond_signal(&parser->init_cond); break; -@@ -864,6 +884,14 @@ static GstFlowReturn sink_chain_cb(GstPad *pad, GstObject *parent, GstBuffer *bu +@@ -805,6 +832,14 @@ static GstFlowReturn sink_chain_cb(GstPad *pad, GstObject *parent, GstBuffer *bu pthread_mutex_lock(&parser->mutex); @@ -102,28 +109,26 @@ index f5722486fb3..4c4ee4bcc2a 100644 if (!stream->has_buffer) { stream->has_buffer = true; -@@ -1006,7 +1034,9 @@ static gboolean sink_query_cb(GstPad *pad, GstObject *parent, GstQuery *query) +@@ -908,7 +943,17 @@ static gboolean sink_query_cb(GstPad *pad, GstObject *parent, GstQuery *query) gst_query_parse_caps(query, &filter); pthread_mutex_lock(&parser->mutex); - if (stream->current_format.major_type != WG_MAJOR_TYPE_UNKNOWN) + if (stream->next_format.major_type != WG_MAJOR_TYPE_UNKNOWN) ++ { + caps = wg_format_to_caps(&stream->next_format); ++ if (caps && stream->current_format.major_type != WG_MAJOR_TYPE_UNKNOWN) ++ { ++ temp = wg_format_to_caps(&stream->current_format); ++ if (temp) ++ gst_caps_append(caps, temp); ++ } ++ } + else if (stream->current_format.major_type != WG_MAJOR_TYPE_UNKNOWN) caps = wg_format_to_caps(&stream->current_format); else caps = get_supported_formats(); -@@ -1042,7 +1072,8 @@ static gboolean sink_query_cb(GstPad *pad, GstObject *parent, GstQuery *query) - - pthread_mutex_lock(&parser->mutex); - -- if (stream->current_format.major_type == WG_MAJOR_TYPE_UNKNOWN) -+ if (stream->current_format.major_type == WG_MAJOR_TYPE_UNKNOWN && -+ stream->next_format.major_type == WG_MAJOR_TYPE_UNKNOWN) - { - pthread_mutex_unlock(&parser->mutex); - gst_query_set_accept_caps_result(query, TRUE); -@@ -1051,7 +1082,8 @@ static gboolean sink_query_cb(GstPad *pad, GstObject *parent, GstQuery *query) +@@ -953,7 +998,8 @@ static gboolean sink_query_cb(GstPad *pad, GstObject *parent, GstQuery *query) gst_query_parse_accept_caps(query, &caps); wg_format_from_caps(&format, caps); @@ -133,14 +138,22 @@ index f5722486fb3..4c4ee4bcc2a 100644 pthread_mutex_unlock(&parser->mutex); -@@ -1086,6 +1118,7 @@ static struct wg_parser_stream *create_stream(struct wg_parser *parser, char *id - stream->number = parser->stream_count; - stream->no_more_pads = true; - stream->current_format.major_type = WG_MAJOR_TYPE_UNKNOWN; -+ stream->next_format.major_type = WG_MAJOR_TYPE_UNKNOWN; - - sprintf(pad_name, "qz_sink_%u", parser->stream_count); - stream->my_sink = gst_pad_new(pad_name, GST_PAD_SINK); +@@ -1637,6 +1683,7 @@ static GstBusSyncReply bus_handler_cb(GstBus *bus, GstMessage *msg, gpointer use + parser->error = true; + pthread_mutex_unlock(&parser->mutex); + pthread_cond_signal(&parser->init_cond); ++ pthread_cond_signal(&parser->stream_event_cond); + break; + + case GST_MESSAGE_WARNING: +@@ -1667,6 +1714,7 @@ static GstBusSyncReply bus_handler_cb(GstBus *bus, GstMessage *msg, gpointer use + GST_WARNING("Autoplugged element failed to initialise, trying again with protonvideoconvert."); + parser->error = true; + pthread_cond_signal(&parser->init_cond); ++ pthread_cond_signal(&parser->stream_event_cond); + } + pthread_mutex_unlock(&parser->mutex); + } -- 2.44.0 diff --git a/patches/wine-gst/0014-HACK-mfmediaengine-Do-not-send-MF_MEDIA_ENGINE_EVENT.patch b/patches/wine-gst/0014-HACK-mfmediaengine-Do-not-send-MF_MEDIA_ENGINE_EVENT.patch new file mode 100644 index 000000000..ae16fcf4e --- /dev/null +++ b/patches/wine-gst/0014-HACK-mfmediaengine-Do-not-send-MF_MEDIA_ENGINE_EVENT.patch @@ -0,0 +1,49 @@ +From 989b5e5169bd07a1d82383612280f696ff5933fc Mon Sep 17 00:00:00 2001 +From: Torge Matthies +Date: Sat, 2 Mar 2024 21:19:25 +0100 +Subject: [PATCH 14/32] [HACK] mfmediaengine: Do not send + MF_MEDIA_ENGINE_EVENT_ERROR. + +Breaks AVPro Video (used by VRChat) when a IMFMediaEngine::GetError call inside the event handler doesn't return an +IMFMediaError instance because the source is already shut down. The event handler code tries to call a function on the +non-existant IMFMediaError instance, which segfaults. + +This should be fixed properly. In the meantime, this hack works around the problem. +--- + dlls/mfmediaengine/main.c | 20 +++++++++++++++----- + 1 file changed, 15 insertions(+), 5 deletions(-) + +diff --git a/dlls/mfmediaengine/main.c b/dlls/mfmediaengine/main.c +index 3e05626f238..e462a918f96 100644 +--- a/dlls/mfmediaengine/main.c ++++ b/dlls/mfmediaengine/main.c +@@ -1397,11 +1397,21 @@ static HRESULT WINAPI media_engine_load_handler_Invoke(IMFAsyncCallback *iface, + } + else + { +- engine->network_state = MF_MEDIA_ENGINE_NETWORK_NO_SOURCE; +- engine->error_code = MF_MEDIA_ENGINE_ERR_SRC_NOT_SUPPORTED; +- engine->extended_code = hr; +- IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_ERROR, engine->error_code, +- engine->extended_code); ++ static unsigned int once; ++ char sgi[64]; ++ ++ if (GetEnvironmentVariableA("SteamGameId", sgi, sizeof(sgi)) && !strcmp(sgi, "438100")) ++ { ++ if (!once++) FIXME("HACK: not sending MF_MEDIA_ENGINE_EVENT_ERROR event.\n"); ++ } ++ else ++ { ++ engine->network_state = MF_MEDIA_ENGINE_NETWORK_NO_SOURCE; ++ engine->error_code = MF_MEDIA_ENGINE_ERR_SRC_NOT_SUPPORTED; ++ engine->extended_code = hr; ++ IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_ERROR, engine->error_code, ++ engine->extended_code); ++ } + } + + LeaveCriticalSection(&engine->cs); +-- +2.44.0 + diff --git a/patches/wine-gst/0015-Marker-commit-do-not-put-into-MR.patch b/patches/wine-gst/0015-Marker-commit-do-not-put-into-MR.patch new file mode 100644 index 000000000..95f6a99a3 --- /dev/null +++ b/patches/wine-gst/0015-Marker-commit-do-not-put-into-MR.patch @@ -0,0 +1,22 @@ +From 3be8bc610c8c8a32575b1fff601ea4876ecb22b1 Mon Sep 17 00:00:00 2001 +From: Torge Matthies +Date: Mon, 25 Mar 2024 09:58:04 +0100 +Subject: [PATCH 15/32] === Marker commit, do not put into MR === + +--- + MAINTAINERS | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/MAINTAINERS b/MAINTAINERS +index 59873f6804c..20d715a2088 100644 +--- a/MAINTAINERS ++++ b/MAINTAINERS +@@ -436,3 +436,5 @@ P: Zebediah Figura + P: Paul Gofman + P: Erich E. Hoover + W: https://wine-staging.com/ ++ ++tmp +-- +2.44.0 + diff --git a/patches/wine-gst/0001-winegstreamer-Wait-for-samples-in-a-dedicated-work-q.patch b/patches/wine-gst/0016-winegstreamer-Wait-for-samples-in-a-dedicated-work-q.patch similarity index 94% rename from patches/wine-gst/0001-winegstreamer-Wait-for-samples-in-a-dedicated-work-q.patch rename to patches/wine-gst/0016-winegstreamer-Wait-for-samples-in-a-dedicated-work-q.patch index c922136fe..d9f657921 100644 --- a/patches/wine-gst/0001-winegstreamer-Wait-for-samples-in-a-dedicated-work-q.patch +++ b/patches/wine-gst/0016-winegstreamer-Wait-for-samples-in-a-dedicated-work-q.patch @@ -1,7 +1,7 @@ -From e84156cccb7253e77948c777226c541d22bc60eb Mon Sep 17 00:00:00 2001 +From 634bbc631ee0cb326dbe7b4b466ab3d136b541f8 Mon Sep 17 00:00:00 2001 From: Torge Matthies Date: Wed, 31 Jan 2024 17:42:54 +0100 -Subject: [PATCH 01/29] winegstreamer: Wait for samples in a dedicated work +Subject: [PATCH 16/32] winegstreamer: Wait for samples in a dedicated work queue. --- @@ -10,7 +10,7 @@ Subject: [PATCH 01/29] winegstreamer: Wait for samples in a dedicated work 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c -index 83ab880f8ef..9b6c930efda 100644 +index 6d58d51045a..afc39995d2c 100644 --- a/dlls/winegstreamer/media_source.c +++ b/dlls/winegstreamer/media_source.c @@ -182,6 +182,7 @@ struct media_source @@ -47,7 +47,7 @@ index 83ab880f8ef..9b6c930efda 100644 IMFMediaEventQueue_Release(source->event_queue); IMFByteStream_Release(source->byte_stream); wg_parser_destroy(source->wg_parser); -@@ -1634,6 +1636,7 @@ static HRESULT WINAPI media_source_Shutdown(IMFMediaSource *iface) +@@ -1637,6 +1639,7 @@ static HRESULT WINAPI media_source_Shutdown(IMFMediaSource *iface) LeaveCriticalSection(&source->cs); MFUnlockWorkQueue(source->async_commands_queue); @@ -55,7 +55,7 @@ index 83ab880f8ef..9b6c930efda 100644 return S_OK; } -@@ -1703,6 +1706,8 @@ static HRESULT media_source_create(struct object_context *context, IMFMediaSourc +@@ -1706,6 +1709,8 @@ static HRESULT media_source_create(struct object_context *context, IMFMediaSourc if (FAILED(hr = MFAllocateWorkQueue(&object->async_commands_queue))) goto fail; @@ -64,7 +64,7 @@ index 83ab880f8ef..9b6c930efda 100644 if (!(parser = wg_parser_create(context->type, FALSE, FALSE))) { -@@ -1805,6 +1810,8 @@ fail: +@@ -1809,6 +1814,8 @@ fail: } if (object->wg_parser) wg_parser_destroy(object->wg_parser); diff --git a/patches/wine-gst/0017-mfmediaengine-Do-not-send-MF_MEDIA_ENGINE_EVENT_ERRO.patch b/patches/wine-gst/0017-mfmediaengine-Do-not-send-MF_MEDIA_ENGINE_EVENT_ERRO.patch deleted file mode 100644 index 54fdb891d..000000000 --- a/patches/wine-gst/0017-mfmediaengine-Do-not-send-MF_MEDIA_ENGINE_EVENT_ERRO.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 42dbfb991dc2dd91af7ae5bbe2ea429dcdf8a011 Mon Sep 17 00:00:00 2001 -From: Torge Matthies -Date: Sat, 2 Mar 2024 21:19:25 +0100 -Subject: [PATCH 17/29] mfmediaengine: Do not send MF_MEDIA_ENGINE_EVENT_ERROR. - -Breaks AVPro (used by VRChat) when a subsequent IMFMediaEngine::GetError call doesn't return an IMFMediaError instance -because the source is already shut down. - -This should be fixed properly. In the meantime, this hack works around the problem. ---- - dlls/mfmediaengine/main.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/dlls/mfmediaengine/main.c b/dlls/mfmediaengine/main.c -index 3e05626f238..82bb124bb95 100644 ---- a/dlls/mfmediaengine/main.c -+++ b/dlls/mfmediaengine/main.c -@@ -1397,11 +1397,13 @@ static HRESULT WINAPI media_engine_load_handler_Invoke(IMFAsyncCallback *iface, - } - else - { -+#if 0 - engine->network_state = MF_MEDIA_ENGINE_NETWORK_NO_SOURCE; - engine->error_code = MF_MEDIA_ENGINE_ERR_SRC_NOT_SUPPORTED; - engine->extended_code = hr; - IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_ERROR, engine->error_code, - engine->extended_code); -+#endif - } - - LeaveCriticalSection(&engine->cs); --- -2.44.0 - diff --git a/patches/wine-gst/0002-winegstreamer-Add-a-resampler-to-wg_parser-for-raw-a.patch b/patches/wine-gst/0017-winegstreamer-Add-a-resampler-to-wg_parser-for-raw-a.patch similarity index 80% rename from patches/wine-gst/0002-winegstreamer-Add-a-resampler-to-wg_parser-for-raw-a.patch rename to patches/wine-gst/0017-winegstreamer-Add-a-resampler-to-wg_parser-for-raw-a.patch index 93c0b0a44..8130e6dc2 100644 --- a/patches/wine-gst/0002-winegstreamer-Add-a-resampler-to-wg_parser-for-raw-a.patch +++ b/patches/wine-gst/0017-winegstreamer-Add-a-resampler-to-wg_parser-for-raw-a.patch @@ -1,7 +1,7 @@ -From 1f8c5426cf0fcdb7a92992c9b2cab1d3e8c4f670 Mon Sep 17 00:00:00 2001 +From 6c00dffa8928758af2ed2e0457956e48a9a04ecf Mon Sep 17 00:00:00 2001 From: Torge Matthies Date: Wed, 31 Jan 2024 17:42:54 +0100 -Subject: [PATCH 02/29] winegstreamer: Add a resampler to wg_parser for raw +Subject: [PATCH 17/32] winegstreamer: Add a resampler to wg_parser for raw audio. --- @@ -9,10 +9,10 @@ Subject: [PATCH 02/29] winegstreamer: Add a resampler to wg_parser for raw 1 file changed, 4 insertions(+) diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c -index 2d00f4247e0..09e30e4e908 100644 +index 69c28b347cd..8eb37bbc896 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c -@@ -1098,6 +1098,10 @@ static bool stream_create_post_processing_elements(GstPad *pad, struct wg_parser +@@ -1202,6 +1202,10 @@ static bool stream_create_post_processing_elements(GstPad *pad, struct wg_parser if (!(element = create_element("audioconvert", "base")) || !append_element(parser->container, element, &first, &last)) return false; diff --git a/patches/wine-gst/0003-winegstreamer-Add-a-videoscale-element-to-wg_parser-.patch b/patches/wine-gst/0018-winegstreamer-Add-a-videoscale-element-to-wg_parser-.patch similarity index 83% rename from patches/wine-gst/0003-winegstreamer-Add-a-videoscale-element-to-wg_parser-.patch rename to patches/wine-gst/0018-winegstreamer-Add-a-videoscale-element-to-wg_parser-.patch index 528a7e531..c11412788 100644 --- a/patches/wine-gst/0003-winegstreamer-Add-a-videoscale-element-to-wg_parser-.patch +++ b/patches/wine-gst/0018-winegstreamer-Add-a-videoscale-element-to-wg_parser-.patch @@ -1,7 +1,7 @@ -From 8ad956a4a430a236cf53a6e13e829713b261649c Mon Sep 17 00:00:00 2001 +From d6298d14ada49b40b468b8e3d0c66792daf706bd Mon Sep 17 00:00:00 2001 From: Torge Matthies Date: Wed, 31 Jan 2024 17:42:54 +0100 -Subject: [PATCH 03/29] winegstreamer: Add a videoscale element to wg_parser +Subject: [PATCH 18/32] winegstreamer: Add a videoscale element to wg_parser for raw video. --- @@ -9,10 +9,10 @@ Subject: [PATCH 03/29] winegstreamer: Add a videoscale element to wg_parser 1 file changed, 8 insertions(+) diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c -index 09e30e4e908..2bc1acb22ce 100644 +index 8eb37bbc896..a52ded76e3a 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c -@@ -1003,6 +1003,9 @@ static bool stream_create_post_processing_elements(GstPad *pad, struct wg_parser +@@ -1107,6 +1107,9 @@ static bool stream_create_post_processing_elements(GstPad *pad, struct wg_parser if (!(element = create_element("glcolorconvert", "base")) || !append_element(parser->container, element, &first, &last)) return false; @@ -22,7 +22,7 @@ index 09e30e4e908..2bc1acb22ce 100644 if (!(element = create_element("gldownload", "base")) || !append_element(parser->container, element, &first, &last)) return false; -@@ -1086,6 +1089,11 @@ static bool stream_create_post_processing_elements(GstPad *pad, struct wg_parser +@@ -1190,6 +1193,11 @@ static bool stream_create_post_processing_elements(GstPad *pad, struct wg_parser /* Let GStreamer choose a default number of threads. */ gst_util_set_object_arg(G_OBJECT(element), "n-threads", "0"); diff --git a/patches/wine-gst/0005-winegstreamer-Implement-buffering-in-wg_parser.patch b/patches/wine-gst/0019-winegstreamer-Implement-buffering-in-wg_parser.patch similarity index 89% rename from patches/wine-gst/0005-winegstreamer-Implement-buffering-in-wg_parser.patch rename to patches/wine-gst/0019-winegstreamer-Implement-buffering-in-wg_parser.patch index 424807391..8f4a979a8 100644 --- a/patches/wine-gst/0005-winegstreamer-Implement-buffering-in-wg_parser.patch +++ b/patches/wine-gst/0019-winegstreamer-Implement-buffering-in-wg_parser.patch @@ -1,17 +1,17 @@ -From b296fa5287b467b2060b27217520eb1c75c1fc8d Mon Sep 17 00:00:00 2001 +From 6f105655ba7d431ce567ea4e6da87ffd5fae140f Mon Sep 17 00:00:00 2001 From: Torge Matthies Date: Wed, 31 Jan 2024 17:42:54 +0100 -Subject: [PATCH 05/29] winegstreamer: Implement buffering in wg_parser. +Subject: [PATCH 19/32] winegstreamer: Implement buffering in wg_parser. Buffer up to 64 buffers, 5 seconds, or while behind other streams. -TODO: Adjust buffering conditions so that it will not buffer endlessly. +TODO: Adjust buffering conditions so that it will not buffer infinitely. --- dlls/winegstreamer/wg_parser.c | 117 ++++++++++++++++++++++++++++++--- 1 file changed, 109 insertions(+), 8 deletions(-) diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c -index 823cdfd9f54..c1da624d084 100644 +index a52ded76e3a..fd8fdc74d6f 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c @@ -125,6 +125,8 @@ struct wg_parser_stream @@ -23,9 +23,9 @@ index 823cdfd9f54..c1da624d084 100644 bool flushing, eos, enabled, has_caps, has_tags, has_buffer, no_more_pads; -@@ -414,6 +416,19 @@ static NTSTATUS wg_parser_stream_release_buffer(void *args) - gst_buffer_unref(stream->buffer); - stream->buffer = NULL; +@@ -336,6 +338,19 @@ static void release_buffer(struct wg_parser *parser, struct wg_parser_stream *st + stream->buffer = NULL; + } + if (stream->buffer_queue && stream->buffer_queue_length) + { @@ -40,10 +40,10 @@ index 823cdfd9f54..c1da624d084 100644 + stream->buffer = buffer; + } + - pthread_mutex_unlock(&parser->mutex); pthread_cond_signal(&parser->stream_event_cond); + } -@@ -722,6 +737,15 @@ static gboolean sink_event_cb(GstPad *pad, GstObject *parent, GstEvent *event) +@@ -765,6 +780,15 @@ static gboolean sink_event_cb(GstPad *pad, GstObject *parent, GstEvent *event) gst_buffer_unref(stream->buffer); stream->buffer = NULL; } @@ -59,7 +59,7 @@ index 823cdfd9f54..c1da624d084 100644 } pthread_mutex_unlock(&parser->mutex); -@@ -773,6 +797,40 @@ static gboolean sink_event_cb(GstPad *pad, GstObject *parent, GstEvent *event) +@@ -823,6 +847,40 @@ static gboolean sink_event_cb(GstPad *pad, GstObject *parent, GstEvent *event) return TRUE; } @@ -100,7 +100,7 @@ index 823cdfd9f54..c1da624d084 100644 static GstFlowReturn sink_chain_cb(GstPad *pad, GstObject *parent, GstBuffer *buffer) { struct wg_parser_stream *stream = gst_pad_get_element_private(pad); -@@ -791,7 +849,7 @@ static GstFlowReturn sink_chain_cb(GstPad *pad, GstObject *parent, GstBuffer *bu +@@ -849,7 +907,7 @@ static GstFlowReturn sink_chain_cb(GstPad *pad, GstObject *parent, GstBuffer *bu /* Allow this buffer to be flushed by GStreamer. We are effectively * implementing a queue object here. */ @@ -109,7 +109,7 @@ index 823cdfd9f54..c1da624d084 100644 pthread_cond_wait(&parser->stream_event_cond, &parser->mutex); if (!stream->enabled) -@@ -810,15 +868,49 @@ static GstFlowReturn sink_chain_cb(GstPad *pad, GstObject *parent, GstBuffer *bu +@@ -868,15 +926,49 @@ static GstFlowReturn sink_chain_cb(GstPad *pad, GstObject *parent, GstBuffer *bu return GST_FLOW_FLUSHING; } @@ -166,7 +166,7 @@ index 823cdfd9f54..c1da624d084 100644 pthread_mutex_unlock(&parser->mutex); pthread_cond_signal(&parser->stream_event_cond); -@@ -955,6 +1047,15 @@ static void free_stream(struct wg_parser_stream *stream) +@@ -1065,6 +1157,15 @@ static void free_stream(struct wg_parser_stream *stream) gst_buffer_unref(stream->buffer); stream->buffer = NULL; } diff --git a/patches/wine-gst/0020-winegstreamer-Do-not-put-pipeline-back-into-PAUSED-s.patch b/patches/wine-gst/0020-winegstreamer-Do-not-put-pipeline-back-into-PAUSED-s.patch deleted file mode 100644 index f118ead23..000000000 --- a/patches/wine-gst/0020-winegstreamer-Do-not-put-pipeline-back-into-PAUSED-s.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 9a1a82a504825d2656cbf13de31c5dd04534dec8 Mon Sep 17 00:00:00 2001 -From: Torge Matthies -Date: Sun, 10 Mar 2024 02:35:57 +0100 -Subject: [PATCH 20/29] winegstreamer: Do not put pipeline back into PAUSED - state. - ---- - dlls/winegstreamer/wg_parser.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c -index 962cc136173..439977a4897 100644 ---- a/dlls/winegstreamer/wg_parser.c -+++ b/dlls/winegstreamer/wg_parser.c -@@ -2110,13 +2110,13 @@ static NTSTATUS wg_parser_connect(void *args) - } - while (!parser_no_more_pads(parser) && !parser->error) - pthread_cond_wait(&parser->init_cond, &parser->mutex); -- if (parser->uri) -+ /*if (parser->uri) - { - 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) - goto out; -- } -+ }*/ - if (parser->error) - { - if (!parser->use_mediaconv && parser->init_gst == decodebin_parser_init_gst) --- -2.44.0 - diff --git a/patches/wine-gst/0007-winegstreamer-Pass-all-uridecodebin-output-streams-t.patch b/patches/wine-gst/0020-winegstreamer-Pass-all-uridecodebin-output-streams-t.patch similarity index 91% rename from patches/wine-gst/0007-winegstreamer-Pass-all-uridecodebin-output-streams-t.patch rename to patches/wine-gst/0020-winegstreamer-Pass-all-uridecodebin-output-streams-t.patch index f94da76b1..ec48b1359 100644 --- a/patches/wine-gst/0007-winegstreamer-Pass-all-uridecodebin-output-streams-t.patch +++ b/patches/wine-gst/0020-winegstreamer-Pass-all-uridecodebin-output-streams-t.patch @@ -1,7 +1,7 @@ -From 8e31d28eacf48d4c355ce621b70c2e13fadb59d0 Mon Sep 17 00:00:00 2001 +From 2e0d73841f50c7ed014ab2693aa436717cd83fbd Mon Sep 17 00:00:00 2001 From: Torge Matthies Date: Wed, 31 Jan 2024 17:42:54 +0100 -Subject: [PATCH 07/29] winegstreamer: Pass all uridecodebin output streams +Subject: [PATCH 20/32] winegstreamer: Pass all uridecodebin output streams through a multiqueue. --- @@ -9,7 +9,7 @@ Subject: [PATCH 07/29] winegstreamer: Pass all uridecodebin output streams 1 file changed, 91 insertions(+), 1 deletion(-) diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c -index c1da624d084..854597c73eb 100644 +index fd8fdc74d6f..5a06f1871e4 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c @@ -71,7 +71,7 @@ struct wg_parser @@ -21,7 +21,7 @@ index c1da624d084..854597c73eb 100644 GstBus *bus; GstTaskPool *task_pool; GstPad *my_src; -@@ -1069,6 +1069,76 @@ static void free_stream(struct wg_parser_stream *stream) +@@ -1179,6 +1179,76 @@ static void free_stream(struct wg_parser_stream *stream) free(stream); } @@ -98,7 +98,7 @@ index c1da624d084..854597c73eb 100644 static bool stream_create_post_processing_elements(GstPad *pad, struct wg_parser_stream *stream) { GstElement *element = NULL, *first = NULL, *last = NULL; -@@ -1105,6 +1175,9 @@ static bool stream_create_post_processing_elements(GstPad *pad, struct wg_parser +@@ -1215,6 +1285,9 @@ static bool stream_create_post_processing_elements(GstPad *pad, struct wg_parser || !append_element(parser->container, element, &first, &last)) return false; @@ -108,7 +108,7 @@ index c1da624d084..854597c73eb 100644 if (!link_src_to_element(pad, first) || !link_element_to_sink(last, stream->my_sink)) return false; } -@@ -1189,6 +1262,9 @@ static bool stream_create_post_processing_elements(GstPad *pad, struct wg_parser +@@ -1299,6 +1372,9 @@ static bool stream_create_post_processing_elements(GstPad *pad, struct wg_parser || !append_element(parser->container, element, &first, &last)) return false; @@ -118,7 +118,7 @@ index c1da624d084..854597c73eb 100644 if (!link_src_to_element(pad, first) || !link_element_to_sink(last, stream->my_sink)) return false; } -@@ -1206,6 +1282,9 @@ static bool stream_create_post_processing_elements(GstPad *pad, struct wg_parser +@@ -1316,6 +1392,9 @@ static bool stream_create_post_processing_elements(GstPad *pad, struct wg_parser || !append_element(parser->container, element, &first, &last)) return false; @@ -128,7 +128,7 @@ index c1da624d084..854597c73eb 100644 if (!link_src_to_element(pad, first) || !link_element_to_sink(last, stream->my_sink)) return false; } -@@ -2172,6 +2251,17 @@ static BOOL uridecodebin_parser_init_gst(struct wg_parser *parser) +@@ -2296,6 +2375,17 @@ static BOOL uridecodebin_parser_init_gst(struct wg_parser *parser) { GstElement *element; diff --git a/patches/wine-gst/0014-winegstreamer-Schedule-stored-timers-for-the-origina.patch b/patches/wine-gst/0021-winegstreamer-Schedule-stored-timers-for-the-origina.patch similarity index 95% rename from patches/wine-gst/0014-winegstreamer-Schedule-stored-timers-for-the-origina.patch rename to patches/wine-gst/0021-winegstreamer-Schedule-stored-timers-for-the-origina.patch index 3f779a0c3..e321eac1f 100644 --- a/patches/wine-gst/0014-winegstreamer-Schedule-stored-timers-for-the-origina.patch +++ b/patches/wine-gst/0021-winegstreamer-Schedule-stored-timers-for-the-origina.patch @@ -1,7 +1,7 @@ -From 805bd8d13c328d561e68bd5ca9639411560176c6 Mon Sep 17 00:00:00 2001 +From bc861f86ccda91d811a1812b3a2c7623854336ef Mon Sep 17 00:00:00 2001 From: Torge Matthies Date: Fri, 23 Feb 2024 21:45:44 +0100 -Subject: [PATCH 14/29] winegstreamer: Schedule stored timers for the original +Subject: [PATCH 21/32] winegstreamer: Schedule stored timers for the original time instead of calling callbacks immediately when changing presentation clock state. diff --git a/patches/wine-gst/0015-winegstreamer-Start-forwarding-samples-only-at-the-P.patch b/patches/wine-gst/0022-mf-Start-forwarding-samples-only-at-the-PTS-of-the-f.patch similarity index 98% rename from patches/wine-gst/0015-winegstreamer-Start-forwarding-samples-only-at-the-P.patch rename to patches/wine-gst/0022-mf-Start-forwarding-samples-only-at-the-PTS-of-the-f.patch index d6524ad40..c7bf28a5a 100644 --- a/patches/wine-gst/0015-winegstreamer-Start-forwarding-samples-only-at-the-P.patch +++ b/patches/wine-gst/0022-mf-Start-forwarding-samples-only-at-the-PTS-of-the-f.patch @@ -1,8 +1,8 @@ -From f6b59685177dd52765fd14b2aa0083128f03cebc Mon Sep 17 00:00:00 2001 +From b996c4d1e3ffc6b56ceba0be9be3bfe66f452aa2 Mon Sep 17 00:00:00 2001 From: Torge Matthies Date: Fri, 23 Feb 2024 21:50:22 +0100 -Subject: [PATCH 15/29] winegstreamer: Start forwarding samples only at the PTS - of the first sample. +Subject: [PATCH 22/32] mf: Start forwarding samples only at the PTS of the + first sample. Hides desynchronization in applications that ignore the PTS, e.g. VRChat. --- diff --git a/patches/wine-gst/0023-winegstreamer-Discard-buffers-with-negative-PTS.patch b/patches/wine-gst/0023-winegstreamer-Discard-buffers-with-negative-PTS.patch deleted file mode 100644 index 91c0d4654..000000000 --- a/patches/wine-gst/0023-winegstreamer-Discard-buffers-with-negative-PTS.patch +++ /dev/null @@ -1,102 +0,0 @@ -From 6e45713173b6aa967c38105235bda6d43ddd4870 Mon Sep 17 00:00:00 2001 -From: Torge Matthies -Date: Tue, 19 Mar 2024 05:07:11 +0100 -Subject: [PATCH 23/29] winegstreamer: Discard buffers with negative PTS. - ---- - dlls/winegstreamer/wg_parser.c | 57 +++++++++++++++++++--------------- - 1 file changed, 32 insertions(+), 25 deletions(-) - -diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c -index 5c75776f523..9996f6848cd 100644 ---- a/dlls/winegstreamer/wg_parser.c -+++ b/dlls/winegstreamer/wg_parser.c -@@ -307,6 +307,31 @@ static GstBuffer *wait_parser_stream_buffer(struct wg_parser *parser, struct wg_ - return buffer; - } - -+static void release_buffer(struct wg_parser *parser, struct wg_parser_stream *stream) -+{ -+ if (stream->buffer) -+ { -+ gst_buffer_unmap(stream->buffer, &stream->map_info); -+ gst_buffer_unref(stream->buffer); -+ stream->buffer = NULL; -+ } -+ -+ if (stream->buffer_queue && stream->buffer_queue_length) -+ { -+ GstBuffer *buffer; -+ do -+ { -+ buffer = *stream->buffer_queue; -+ stream->buffer_queue_length -= 1; -+ memmove(stream->buffer_queue, stream->buffer_queue + 1, -+ stream->buffer_queue_length * sizeof(*stream->buffer_queue)); -+ } while (!gst_buffer_map(buffer, &stream->map_info, GST_MAP_READ)); -+ stream->buffer = buffer; -+ } -+ -+ pthread_cond_broadcast(&parser->stream_event_cond); -+} -+ - static NTSTATUS wg_parser_stream_get_buffer(void *args) - { - const struct wg_parser_stream_get_buffer_params *params = args; -@@ -318,6 +343,7 @@ static NTSTATUS wg_parser_stream_get_buffer(void *args) - - pthread_mutex_lock(&parser->mutex); - -+retry: - if (stream) - buffer = wait_parser_stream_buffer(parser, stream); - else -@@ -374,9 +400,11 @@ static NTSTATUS wg_parser_stream_get_buffer(void *args) - return S_FALSE; - } - if (ret < 0) -- wg_buffer->pts = -(gint64)stream_time / 100; -- else -- wg_buffer->pts = stream_time / 100; -+ { -+ release_buffer(parser, stream); -+ goto retry; -+ } -+ wg_buffer->pts = stream_time / 100; - } - } - if ((wg_buffer->has_duration = GST_BUFFER_DURATION_IS_VALID(buffer))) -@@ -421,29 +449,8 @@ static NTSTATUS wg_parser_stream_release_buffer(void *args) - struct wg_parser *parser = stream->parser; - - pthread_mutex_lock(&parser->mutex); -- -- if (stream->buffer) -- { -- gst_buffer_unmap(stream->buffer, &stream->map_info); -- gst_buffer_unref(stream->buffer); -- stream->buffer = NULL; -- } -- -- if (stream->buffer_queue && stream->buffer_queue_length) -- { -- GstBuffer *buffer; -- do -- { -- buffer = *stream->buffer_queue; -- stream->buffer_queue_length -= 1; -- memmove(stream->buffer_queue, stream->buffer_queue + 1, -- stream->buffer_queue_length * sizeof(*stream->buffer_queue)); -- } while (!gst_buffer_map(buffer, &stream->map_info, GST_MAP_READ)); -- stream->buffer = buffer; -- } -- -+ release_buffer(parser, stream); - pthread_mutex_unlock(&parser->mutex); -- pthread_cond_broadcast(&parser->stream_event_cond); - - return S_OK; - } --- -2.44.0 - diff --git a/patches/wine-gst/0016-winegstreamer-HACK-Pretend-that-we-have-a-discontinu.patch b/patches/wine-gst/0023-winegstreamer-HACK-Pretend-that-we-have-a-discontinu.patch similarity index 94% rename from patches/wine-gst/0016-winegstreamer-HACK-Pretend-that-we-have-a-discontinu.patch rename to patches/wine-gst/0023-winegstreamer-HACK-Pretend-that-we-have-a-discontinu.patch index e9dd81f8f..19f51ab8b 100644 --- a/patches/wine-gst/0016-winegstreamer-HACK-Pretend-that-we-have-a-discontinu.patch +++ b/patches/wine-gst/0023-winegstreamer-HACK-Pretend-that-we-have-a-discontinu.patch @@ -1,7 +1,7 @@ -From 6de6540b735b3a82df590055215fa0c654a05a15 Mon Sep 17 00:00:00 2001 +From 4fb70c717f29533bd56960617d66dbbfeac1375c Mon Sep 17 00:00:00 2001 From: Torge Matthies Date: Fri, 23 Feb 2024 21:36:25 +0100 -Subject: [PATCH 16/29] winegstreamer: HACK: Pretend that we have a +Subject: [PATCH 23/32] winegstreamer: HACK: Pretend that we have a discontinuity when the source is buffering. This way I don't need to plumb through pausing/resuming of the presentation clock for gst buffering events (which I'd @@ -11,7 +11,7 @@ also have to enable, reminder for later if I ever end up doing this). 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c -index 9b6c930efda..81285c034d9 100644 +index afc39995d2c..27e1fa15726 100644 --- a/dlls/winegstreamer/media_source.c +++ b/dlls/winegstreamer/media_source.c @@ -142,6 +142,10 @@ struct media_stream @@ -100,7 +100,7 @@ index 9b6c930efda..81285c034d9 100644 TRACE("Created stream object %p.\n", object); *out = object; -@@ -1720,6 +1754,9 @@ static HRESULT media_source_create(struct object_context *context, IMFMediaSourc +@@ -1724,6 +1758,9 @@ static HRESULT media_source_create(struct object_context *context, IMFMediaSourc object->state = SOURCE_OPENING; diff --git a/patches/wine-gst/0018-Revert-winegstreamer-HACK-Pretend-that-we-have-a-dis.patch b/patches/wine-gst/0024-Revert-winegstreamer-HACK-Pretend-that-we-have-a-dis.patch similarity index 94% rename from patches/wine-gst/0018-Revert-winegstreamer-HACK-Pretend-that-we-have-a-dis.patch rename to patches/wine-gst/0024-Revert-winegstreamer-HACK-Pretend-that-we-have-a-dis.patch index 525515507..9bccde2ea 100644 --- a/patches/wine-gst/0018-Revert-winegstreamer-HACK-Pretend-that-we-have-a-dis.patch +++ b/patches/wine-gst/0024-Revert-winegstreamer-HACK-Pretend-that-we-have-a-dis.patch @@ -1,7 +1,7 @@ -From 4e59f3f145a30ed0f2886d8d11437ab22a0ee9d9 Mon Sep 17 00:00:00 2001 +From 2ec081914cbb3ecba2318a29f59a01a72a7a9c71 Mon Sep 17 00:00:00 2001 From: Torge Matthies Date: Sun, 10 Mar 2024 04:09:26 +0100 -Subject: [PATCH 18/29] Revert "winegstreamer: HACK: Pretend that we have a +Subject: [PATCH 24/32] Revert "winegstreamer: HACK: Pretend that we have a discontinuity when the source is buffering." This reverts commit dd0e31e58a9d1b5b7735735481d583876fd7710e. @@ -10,7 +10,7 @@ This reverts commit dd0e31e58a9d1b5b7735735481d583876fd7710e. 1 file changed, 1 insertion(+), 38 deletions(-) diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c -index 81285c034d9..9b6c930efda 100644 +index 27e1fa15726..afc39995d2c 100644 --- a/dlls/winegstreamer/media_source.c +++ b/dlls/winegstreamer/media_source.c @@ -142,10 +142,6 @@ struct media_stream @@ -99,7 +99,7 @@ index 81285c034d9..9b6c930efda 100644 TRACE("Created stream object %p.\n", object); *out = object; -@@ -1754,9 +1720,6 @@ static HRESULT media_source_create(struct object_context *context, IMFMediaSourc +@@ -1758,9 +1724,6 @@ static HRESULT media_source_create(struct object_context *context, IMFMediaSourc object->state = SOURCE_OPENING; diff --git a/patches/wine-gst/0019-mf-In-the-media-session-pretend-that-we-have-a-disco.patch b/patches/wine-gst/0025-mf-In-the-media-session-pretend-that-we-have-a-disco.patch similarity index 96% rename from patches/wine-gst/0019-mf-In-the-media-session-pretend-that-we-have-a-disco.patch rename to patches/wine-gst/0025-mf-In-the-media-session-pretend-that-we-have-a-disco.patch index f7ef6cbc8..fa88325e7 100644 --- a/patches/wine-gst/0019-mf-In-the-media-session-pretend-that-we-have-a-disco.patch +++ b/patches/wine-gst/0025-mf-In-the-media-session-pretend-that-we-have-a-disco.patch @@ -1,7 +1,7 @@ -From 7632d34e46a83b903833185426ed670eeaffe97e Mon Sep 17 00:00:00 2001 +From d5308ec71f851ec1cdb47b5ab4901e104ea0b34f Mon Sep 17 00:00:00 2001 From: Torge Matthies Date: Sun, 10 Mar 2024 02:32:35 +0100 -Subject: [PATCH 19/29] mf: In the media session, pretend that we have a +Subject: [PATCH 25/32] mf: In the media session, pretend that we have a discontinuity when the source is buffering. This way I don't need to plumb through pausing/resuming of the presentation clock for gst buffering events (which I'd diff --git a/patches/wine-gst/0025-winegstreamer-Adjust-buffer-timestamps-after-seek.patch b/patches/wine-gst/0025-winegstreamer-Adjust-buffer-timestamps-after-seek.patch deleted file mode 100644 index 89bb8bade..000000000 --- a/patches/wine-gst/0025-winegstreamer-Adjust-buffer-timestamps-after-seek.patch +++ /dev/null @@ -1,52 +0,0 @@ -From a24d48c64e8c19cd4a7252272c08d5520e8862bf Mon Sep 17 00:00:00 2001 -From: Torge Matthies -Date: Tue, 19 Mar 2024 05:11:11 +0100 -Subject: [PATCH 25/29] winegstreamer: Adjust buffer timestamps after seek. - ---- - dlls/winegstreamer/wg_parser.c | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c -index 9996f6848cd..56ae2c3c026 100644 ---- a/dlls/winegstreamer/wg_parser.c -+++ b/dlls/winegstreamer/wg_parser.c -@@ -80,6 +80,8 @@ struct wg_parser - guint64 next_pull_offset; - gchar *uri; - -+ guint64 seek_pos; -+ - pthread_t push_thread; - - pthread_mutex_t mutex; -@@ -404,7 +406,7 @@ retry: - release_buffer(parser, stream); - goto retry; - } -- wg_buffer->pts = stream_time / 100; -+ wg_buffer->pts = (stream_time + parser->seek_pos) / 100; - } - } - if ((wg_buffer->has_duration = GST_BUFFER_DURATION_IS_VALID(buffer))) -@@ -505,6 +507,8 @@ static NTSTATUS wg_parser_stream_seek(void *args) - if ((stop_flags & AM_SEEKING_PositioningBitsMask) == AM_SEEKING_NoPositioning) - stop_type = GST_SEEK_TYPE_NONE; - -+ stream->parser->seek_pos = params->start_pos * 100; -+ - if (!push_event(stream->my_sink, gst_event_new_seek(params->rate, GST_FORMAT_TIME, - flags, start_type, params->start_pos * 100, stop_type, - params->stop_pos == stream->duration ? -1 : params->stop_pos * 100))) -@@ -2088,6 +2092,8 @@ static NTSTATUS wg_parser_connect(void *args) - parser->next_pull_offset = 0; - parser->error = false; - -+ parser->seek_pos = 0; -+ - if (!parser->init_gst(parser)) - goto out; - --- -2.44.0 - diff --git a/patches/wine-gst/0021-winegstreamer-Use-pthread_cond_broadcast-instead-of-.patch b/patches/wine-gst/0026-winegstreamer-Use-pthread_cond_broadcast-instead-of-.patch similarity index 75% rename from patches/wine-gst/0021-winegstreamer-Use-pthread_cond_broadcast-instead-of-.patch rename to patches/wine-gst/0026-winegstreamer-Use-pthread_cond_broadcast-instead-of-.patch index 6a959345b..02b6adebd 100644 --- a/patches/wine-gst/0021-winegstreamer-Use-pthread_cond_broadcast-instead-of-.patch +++ b/patches/wine-gst/0026-winegstreamer-Use-pthread_cond_broadcast-instead-of-.patch @@ -1,7 +1,7 @@ -From b603d9967d4f3e4bc0c23fc9f3c9c924cf4cad02 Mon Sep 17 00:00:00 2001 +From ccd3f8e38986e7eb7c18348f802e4b2338dac0b6 Mon Sep 17 00:00:00 2001 From: Torge Matthies Date: Mon, 18 Mar 2024 10:18:07 +0100 -Subject: [PATCH 21/29] winegstreamer: Use pthread_cond_broadcast instead of +Subject: [PATCH 26/32] winegstreamer: Use pthread_cond_broadcast instead of pthread_cond_signal for stream_event_cond. --- @@ -9,28 +9,28 @@ Subject: [PATCH 21/29] winegstreamer: Use pthread_cond_broadcast instead of 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c -index 439977a4897..c8f173df6ac 100644 +index 5a06f1871e4..316bf01670f 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c -@@ -290,7 +290,7 @@ static NTSTATUS wg_parser_stream_disable(void *args) - stream->enabled = false; +@@ -312,7 +312,7 @@ static NTSTATUS wg_parser_stream_disable(void *args) stream->current_format.major_type = WG_MAJOR_TYPE_UNKNOWN; + stream->next_format.major_type = WG_MAJOR_TYPE_UNKNOWN; pthread_mutex_unlock(&parser->mutex); - pthread_cond_signal(&parser->stream_event_cond); + pthread_cond_broadcast(&parser->stream_event_cond); return S_OK; } -@@ -442,7 +442,7 @@ static NTSTATUS wg_parser_stream_release_buffer(void *args) +@@ -351,7 +351,7 @@ static void release_buffer(struct wg_parser *parser, struct wg_parser_stream *st + stream->buffer = buffer; } - pthread_mutex_unlock(&parser->mutex); - pthread_cond_signal(&parser->stream_event_cond); + pthread_cond_broadcast(&parser->stream_event_cond); - - return S_OK; } -@@ -729,7 +729,7 @@ static gboolean sink_event_cb(GstPad *pad, GstObject *parent, GstEvent *event) + + static NTSTATUS wg_parser_stream_get_buffer(void *args) +@@ -760,7 +760,7 @@ static gboolean sink_event_cb(GstPad *pad, GstObject *parent, GstEvent *event) pthread_mutex_lock(&parser->mutex); stream->eos = true; if (stream->enabled) @@ -39,7 +39,7 @@ index 439977a4897..c8f173df6ac 100644 else pthread_cond_signal(&parser->init_cond); pthread_mutex_unlock(&parser->mutex); -@@ -741,7 +741,7 @@ static gboolean sink_event_cb(GstPad *pad, GstObject *parent, GstEvent *event) +@@ -772,7 +772,7 @@ static gboolean sink_event_cb(GstPad *pad, GstObject *parent, GstEvent *event) if (stream->enabled) { stream->flushing = true; @@ -48,7 +48,7 @@ index 439977a4897..c8f173df6ac 100644 if (stream->buffer) { -@@ -925,7 +925,7 @@ static GstFlowReturn sink_chain_cb(GstPad *pad, GstObject *parent, GstBuffer *bu +@@ -971,7 +971,7 @@ static GstFlowReturn sink_chain_cb(GstPad *pad, GstObject *parent, GstBuffer *bu } pthread_mutex_unlock(&parser->mutex); @@ -57,7 +57,7 @@ index 439977a4897..c8f173df6ac 100644 /* The chain callback is given a reference to the buffer. Transfer that * reference to the stream object, which will release it in -@@ -2258,7 +2258,7 @@ static NTSTATUS wg_parser_disconnect(void *args) +@@ -2306,7 +2306,7 @@ static NTSTATUS wg_parser_disconnect(void *args) pthread_mutex_lock(&parser->mutex); for (i = 0; i < parser->stream_count; ++i) parser->streams[i]->flushing = true; diff --git a/patches/wine-gst/0024-SQUASH-mf-In-media-session-discard-samples-with-nega.patch b/patches/wine-gst/0027-SQUASH-mf-In-media-session-discard-samples-with-nega.patch similarity index 86% rename from patches/wine-gst/0024-SQUASH-mf-In-media-session-discard-samples-with-nega.patch rename to patches/wine-gst/0027-SQUASH-mf-In-media-session-discard-samples-with-nega.patch index 186978e1b..62a990713 100644 --- a/patches/wine-gst/0024-SQUASH-mf-In-media-session-discard-samples-with-nega.patch +++ b/patches/wine-gst/0027-SQUASH-mf-In-media-session-discard-samples-with-nega.patch @@ -1,7 +1,7 @@ -From 5559a94c0e2a7131122fc8b8ce69f2e620c605a2 Mon Sep 17 00:00:00 2001 +From 997ec2551b4de0ca4469ebabd118815ff2bdf60d Mon Sep 17 00:00:00 2001 From: Torge Matthies Date: Tue, 19 Mar 2024 05:10:15 +0100 -Subject: [PATCH 24/29] [SQUASH] mf: In media session, discard samples with +Subject: [PATCH 27/32] [SQUASH] mf: In media session, discard samples with negative PTS. --- diff --git a/patches/wine-gst/0026-SQUASH-winegstreamer-Factor-out-multiqueue-creation-.patch b/patches/wine-gst/0028-SQUASH-winegstreamer-Factor-out-multiqueue-creation-.patch similarity index 88% rename from patches/wine-gst/0026-SQUASH-winegstreamer-Factor-out-multiqueue-creation-.patch rename to patches/wine-gst/0028-SQUASH-winegstreamer-Factor-out-multiqueue-creation-.patch index 2fa47e6d6..05a23e1ed 100644 --- a/patches/wine-gst/0026-SQUASH-winegstreamer-Factor-out-multiqueue-creation-.patch +++ b/patches/wine-gst/0028-SQUASH-winegstreamer-Factor-out-multiqueue-creation-.patch @@ -1,7 +1,7 @@ -From 6664f047bb5a50516a2c676a2ca4a4524a6b7cf9 Mon Sep 17 00:00:00 2001 +From 5c4787fa4ce2e73f9db8bbddd41754921306525c Mon Sep 17 00:00:00 2001 From: Torge Matthies Date: Tue, 19 Mar 2024 10:02:25 +0100 -Subject: [PATCH 26/29] [SQUASH] winegstreamer: Factor out multiqueue creation +Subject: [PATCH 28/32] [SQUASH] winegstreamer: Factor out multiqueue creation and also create a multiqueue for decodebin-based parsers. --- @@ -9,10 +9,10 @@ Subject: [PATCH 26/29] [SQUASH] winegstreamer: Factor out multiqueue creation 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c -index 56ae2c3c026..f5722486fb3 100644 +index 316bf01670f..4a5ad10887b 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c -@@ -2308,10 +2308,29 @@ static NTSTATUS wg_parser_disconnect(void *args) +@@ -2342,10 +2342,29 @@ static NTSTATUS wg_parser_disconnect(void *args) return S_OK; } @@ -42,7 +42,7 @@ index 56ae2c3c026..f5722486fb3 100644 if (!(element = create_element("decodebin", "base"))) return FALSE; -@@ -2341,17 +2360,9 @@ static BOOL uridecodebin_parser_init_gst(struct wg_parser *parser) +@@ -2375,17 +2394,9 @@ static BOOL uridecodebin_parser_init_gst(struct wg_parser *parser) { GstElement *element; diff --git a/patches/wine-gst/0029-winegstreamer-GST_LOG-GST_DEBUG.patch b/patches/wine-gst/0029-winegstreamer-GST_LOG-GST_DEBUG.patch index 10222e7e4..cdc1c9b16 100644 --- a/patches/wine-gst/0029-winegstreamer-GST_LOG-GST_DEBUG.patch +++ b/patches/wine-gst/0029-winegstreamer-GST_LOG-GST_DEBUG.patch @@ -1,17 +1,17 @@ -From b507bf1e24ecc455f5a66e64ad34a0a83b2d051a Mon Sep 17 00:00:00 2001 +From 7142d305a189553178f2db3bfacca543776eaea6 Mon Sep 17 00:00:00 2001 From: Torge Matthies Date: Tue, 19 Mar 2024 10:20:49 +0100 -Subject: [PATCH 29/29] winegstreamer: GST_LOG -> GST_DEBUG. +Subject: [PATCH 29/32] winegstreamer: GST_LOG -> GST_DEBUG. --- dlls/winegstreamer/wg_parser.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c -index 3bee51ed518..7f81ad4edab 100644 +index 4a5ad10887b..c278b435124 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c -@@ -549,7 +549,7 @@ static NTSTATUS wg_parser_stream_notify_qos(void *args) +@@ -553,7 +553,7 @@ static NTSTATUS wg_parser_stream_notify_qos(void *args) /* This can happen legitimately if the sample falls outside of the * segment bounds. GStreamer elements shouldn't present the sample in * that case, but DirectShow doesn't care. */ @@ -20,7 +20,7 @@ index 3bee51ed518..7f81ad4edab 100644 return S_OK; } if (!(event = gst_event_new_qos(params->underflow ? GST_QOS_TYPE_UNDERFLOW : GST_QOS_TYPE_OVERFLOW, -@@ -728,7 +728,7 @@ static gboolean sink_event_cb(GstPad *pad, GstObject *parent, GstEvent *event) +@@ -732,7 +732,7 @@ static gboolean sink_event_cb(GstPad *pad, GstObject *parent, GstEvent *event) struct wg_parser_stream *stream = gst_pad_get_element_private(pad); struct wg_parser *parser = stream->parser; @@ -29,7 +29,7 @@ index 3bee51ed518..7f81ad4edab 100644 switch (event->type) { -@@ -882,7 +882,7 @@ static GstFlowReturn sink_chain_cb(GstPad *pad, GstObject *parent, GstBuffer *bu +@@ -886,7 +886,7 @@ static GstFlowReturn sink_chain_cb(GstPad *pad, GstObject *parent, GstBuffer *bu struct wg_parser_stream *stream = gst_pad_get_element_private(pad); struct wg_parser *parser = stream->parser; @@ -38,7 +38,7 @@ index 3bee51ed518..7f81ad4edab 100644 pthread_mutex_lock(&parser->mutex); -@@ -908,7 +908,7 @@ static GstFlowReturn sink_chain_cb(GstPad *pad, GstObject *parent, GstBuffer *bu +@@ -912,7 +912,7 @@ static GstFlowReturn sink_chain_cb(GstPad *pad, GstObject *parent, GstBuffer *bu if (!stream->enabled) { @@ -47,7 +47,7 @@ index 3bee51ed518..7f81ad4edab 100644 pthread_mutex_unlock(&parser->mutex); gst_buffer_unref(buffer); return GST_FLOW_OK; -@@ -973,7 +973,7 @@ static GstFlowReturn sink_chain_cb(GstPad *pad, GstObject *parent, GstBuffer *bu +@@ -977,7 +977,7 @@ static GstFlowReturn sink_chain_cb(GstPad *pad, GstObject *parent, GstBuffer *bu * reference to the stream object, which will release it in * wg_parser_stream_release_buffer(). */ @@ -56,7 +56,7 @@ index 3bee51ed518..7f81ad4edab 100644 return GST_FLOW_OK; } -@@ -1024,7 +1024,7 @@ static gboolean sink_query_cb(GstPad *pad, GstObject *parent, GstQuery *query) +@@ -1023,7 +1023,7 @@ static gboolean sink_query_cb(GstPad *pad, GstObject *parent, GstQuery *query) struct wg_parser_stream *stream = gst_pad_get_element_private(pad); struct wg_parser *parser = stream->parser; @@ -65,7 +65,7 @@ index 3bee51ed518..7f81ad4edab 100644 switch (query->type) { -@@ -1052,7 +1052,7 @@ static gboolean sink_query_cb(GstPad *pad, GstObject *parent, GstQuery *query) +@@ -1059,7 +1059,7 @@ static gboolean sink_query_cb(GstPad *pad, GstObject *parent, GstQuery *query) gst_structure_remove_fields(gst_caps_get_structure(caps, i), "framerate", "pixel-aspect-ratio", NULL); @@ -74,7 +74,7 @@ index 3bee51ed518..7f81ad4edab 100644 if (filter) { -@@ -1418,7 +1418,7 @@ static void stream_decodebin_pad_added_cb(GstElement *element, GstPad *pad, gpoi +@@ -1424,7 +1424,7 @@ static void stream_decodebin_pad_added_cb(GstElement *element, GstPad *pad, gpoi struct wg_parser_stream *stream = user; struct wg_parser *parser = stream->parser; @@ -83,7 +83,7 @@ index 3bee51ed518..7f81ad4edab 100644 if (gst_pad_is_linked(pad)) return; -@@ -1432,7 +1432,7 @@ static bool stream_decodebin_create(struct wg_parser_stream *stream) +@@ -1438,7 +1438,7 @@ static bool stream_decodebin_create(struct wg_parser_stream *stream) { struct wg_parser *parser = stream->parser; @@ -92,7 +92,7 @@ index 3bee51ed518..7f81ad4edab 100644 if (!(stream->decodebin = create_element("decodebin", "base"))) return false; -@@ -1447,7 +1447,7 @@ static bool stream_decodebin_create(struct wg_parser_stream *stream) +@@ -1453,7 +1453,7 @@ static bool stream_decodebin_create(struct wg_parser_stream *stream) pthread_mutex_unlock(&parser->mutex); gst_element_sync_state_with_parent(stream->decodebin); @@ -101,7 +101,7 @@ index 3bee51ed518..7f81ad4edab 100644 return true; } -@@ -1458,7 +1458,7 @@ static void pad_added_cb(GstElement *element, GstPad *pad, gpointer user) +@@ -1464,7 +1464,7 @@ static void pad_added_cb(GstElement *element, GstPad *pad, gpointer user) struct wg_parser *parser = user; GstCaps *caps; @@ -110,7 +110,7 @@ index 3bee51ed518..7f81ad4edab 100644 if (gst_pad_is_linked(pad)) return; -@@ -1498,7 +1498,7 @@ static void pad_removed_cb(GstElement *element, GstPad *pad, gpointer user) +@@ -1504,7 +1504,7 @@ static void pad_removed_cb(GstElement *element, GstPad *pad, gpointer user) unsigned int i; char *name; @@ -119,7 +119,7 @@ index 3bee51ed518..7f81ad4edab 100644 for (i = 0; i < parser->stream_count; ++i) { -@@ -1557,7 +1557,7 @@ static GstFlowReturn issue_read_request(struct wg_parser *parser, guint64 offset +@@ -1563,7 +1563,7 @@ static GstFlowReturn issue_read_request(struct wg_parser *parser, guint64 offset pthread_mutex_unlock(&parser->mutex); @@ -128,7 +128,7 @@ index 3bee51ed518..7f81ad4edab 100644 return ret; } -@@ -1666,7 +1666,7 @@ static GstFlowReturn src_getrange_cb(GstPad *pad, GstObject *parent, +@@ -1672,7 +1672,7 @@ static GstFlowReturn src_getrange_cb(GstPad *pad, GstObject *parent, { struct wg_parser *parser = gst_pad_get_element_private(pad); @@ -137,7 +137,7 @@ index 3bee51ed518..7f81ad4edab 100644 if (offset == GST_BUFFER_OFFSET_NONE) offset = parser->next_pull_offset; -@@ -1680,7 +1680,7 @@ static GstFlowReturn src_getrange_cb(GstPad *pad, GstObject *parent, +@@ -1686,7 +1686,7 @@ static GstFlowReturn src_getrange_cb(GstPad *pad, GstObject *parent, if (!*buffer) *buffer = gst_buffer_new_and_alloc(0); gst_buffer_set_size(*buffer, 0); @@ -146,7 +146,7 @@ index 3bee51ed518..7f81ad4edab 100644 return GST_FLOW_OK; } -@@ -1701,7 +1701,7 @@ static gboolean src_query_cb(GstPad *pad, GstObject *parent, GstQuery *query) +@@ -1707,7 +1707,7 @@ static gboolean src_query_cb(GstPad *pad, GstObject *parent, GstQuery *query) struct wg_parser *parser = gst_pad_get_element_private(pad); GstFormat format; @@ -155,7 +155,7 @@ index 3bee51ed518..7f81ad4edab 100644 switch (GST_QUERY_TYPE(query)) { -@@ -1981,7 +1981,7 @@ static gboolean src_event_cb(GstPad *pad, GstObject *parent, GstEvent *event) +@@ -1989,7 +1989,7 @@ static gboolean src_event_cb(GstPad *pad, GstObject *parent, GstEvent *event) struct wg_parser *parser = gst_pad_get_element_private(pad); gboolean ret = TRUE; diff --git a/patches/wine-gst/0030-winegstreamer-Signal-flow-error-when-parser-is-in-er.patch b/patches/wine-gst/0030-winegstreamer-Signal-flow-error-when-parser-is-in-er.patch new file mode 100644 index 000000000..a766656ea --- /dev/null +++ b/patches/wine-gst/0030-winegstreamer-Signal-flow-error-when-parser-is-in-er.patch @@ -0,0 +1,37 @@ +From 0d0f3fecdc05d95fb8b3ea2dc3a790bb2dc5887e Mon Sep 17 00:00:00 2001 +From: Torge Matthies +Date: Mon, 25 Mar 2024 22:49:12 +0100 +Subject: [PATCH 30/32] winegstreamer: Signal flow error when parser is in + error state. + +TODO: is this needed? +--- + dlls/winegstreamer/wg_parser.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c +index c278b435124..d36774398e5 100644 +--- a/dlls/winegstreamer/wg_parser.c ++++ b/dlls/winegstreamer/wg_parser.c +@@ -907,9 +907,17 @@ static GstFlowReturn sink_chain_cb(GstPad *pad, GstObject *parent, GstBuffer *bu + /* Allow this buffer to be flushed by GStreamer. We are effectively + * implementing a queue object here. */ + +- while (stream->enabled && !stream->flushing && !has_buffer_capacity(stream, buffer)) ++ while (stream->enabled && !stream->flushing && !stream->parser->error && !has_buffer_capacity(stream, buffer)) + pthread_cond_wait(&parser->stream_event_cond, &parser->mutex); + ++ if (stream->parser->error) ++ { ++ GST_DEBUG("Parser is in error state; discarding buffer."); ++ pthread_mutex_unlock(&parser->mutex); ++ gst_buffer_unref(buffer); ++ return GST_FLOW_ERROR; ++ } ++ + if (!stream->enabled) + { + GST_DEBUG("Stream is disabled; discarding buffer."); +-- +2.44.0 + diff --git a/patches/wine-gst/0031-Revert-winegstreamer-Implement-buffering-in-wg_parse.patch b/patches/wine-gst/0031-Revert-winegstreamer-Implement-buffering-in-wg_parse.patch new file mode 100644 index 000000000..f280dc686 --- /dev/null +++ b/patches/wine-gst/0031-Revert-winegstreamer-Implement-buffering-in-wg_parse.patch @@ -0,0 +1,187 @@ +From 725cf72647e2f8bf547a703c963b9dcfb5f91c94 Mon Sep 17 00:00:00 2001 +From: Torge Matthies +Date: Mon, 25 Mar 2024 23:37:00 +0100 +Subject: [PATCH 31/32] Revert "winegstreamer: Implement buffering in + wg_parser." + +This reverts commit 6f105655ba7d431ce567ea4e6da87ffd5fae140f. +--- + dlls/winegstreamer/wg_parser.c | 117 +++------------------------------ + 1 file changed, 8 insertions(+), 109 deletions(-) + +diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c +index d36774398e5..97be10dbbd9 100644 +--- a/dlls/winegstreamer/wg_parser.c ++++ b/dlls/winegstreamer/wg_parser.c +@@ -125,8 +125,6 @@ struct wg_parser_stream + + GstBuffer *buffer; + GstMapInfo map_info; +- GstBuffer **buffer_queue; +- size_t buffer_queue_length, buffer_queue_capacity; + + bool flushing, eos, enabled, has_caps, has_tags, has_buffer, no_more_pads; + +@@ -338,19 +336,6 @@ static void release_buffer(struct wg_parser *parser, struct wg_parser_stream *st + stream->buffer = NULL; + } + +- if (stream->buffer_queue && stream->buffer_queue_length) +- { +- GstBuffer *buffer; +- do +- { +- buffer = *stream->buffer_queue; +- stream->buffer_queue_length -= 1; +- memmove(stream->buffer_queue, stream->buffer_queue + 1, +- stream->buffer_queue_length * sizeof(*stream->buffer_queue)); +- } while (!gst_buffer_map(buffer, &stream->map_info, GST_MAP_READ)); +- stream->buffer = buffer; +- } +- + pthread_cond_broadcast(&parser->stream_event_cond); + } + +@@ -780,15 +765,6 @@ static gboolean sink_event_cb(GstPad *pad, GstObject *parent, GstEvent *event) + gst_buffer_unref(stream->buffer); + stream->buffer = NULL; + } +- if (stream->buffer_queue && stream->buffer_queue_length) +- { +- for (size_t i = 0; i < stream->buffer_queue_length; i++) +- gst_buffer_unref(stream->buffer_queue[i]); +- stream->buffer_queue_length = 0; +- stream->buffer_queue_capacity = 0; +- free(stream->buffer_queue); +- stream->buffer_queue = NULL; +- } + } + + pthread_mutex_unlock(&parser->mutex); +@@ -847,40 +823,6 @@ static gboolean sink_event_cb(GstPad *pad, GstObject *parent, GstEvent *event) + return TRUE; + } + +-static bool has_buffer_capacity(struct wg_parser_stream *stream, GstBuffer *buffer) +-{ +- struct wg_parser *parser = stream->parser; +- if (!stream->buffer) +- return true; +- if ((stream->buffer_queue ? stream->buffer_queue_length : 0) < 64) +- return true; +- if (GST_BUFFER_DTS_OR_PTS(buffer) < GST_BUFFER_DTS_OR_PTS(stream->buffer) + (5 * GST_SECOND)) +- return true; +- for (size_t i = 0; i < parser->stream_count; i++) +- { +- struct wg_parser_stream *other_stream = parser->streams[i]; +- if (other_stream == stream) +- continue; +- if (!other_stream->buffer) +- return true; +- if (!GST_BUFFER_DURATION_IS_VALID(other_stream->buffer)) +- return true; +- if (GST_BUFFER_PTS_IS_VALID(buffer) && GST_BUFFER_PTS_IS_VALID(other_stream->buffer)) +- { +- if (GST_BUFFER_PTS(buffer) < GST_BUFFER_PTS(other_stream->buffer) + GST_BUFFER_DURATION(other_stream->buffer)) +- return true; +- } +- else if (GST_BUFFER_DTS_IS_VALID(buffer) && GST_BUFFER_DTS_IS_VALID(other_stream->buffer)) +- { +- if (GST_BUFFER_DTS(buffer) < GST_BUFFER_DTS(other_stream->buffer) + GST_BUFFER_DURATION(other_stream->buffer)) +- return true; +- } +- else +- return true; +- } +- return false; +-} +- + static GstFlowReturn sink_chain_cb(GstPad *pad, GstObject *parent, GstBuffer *buffer) + { + struct wg_parser_stream *stream = gst_pad_get_element_private(pad); +@@ -907,7 +849,7 @@ static GstFlowReturn sink_chain_cb(GstPad *pad, GstObject *parent, GstBuffer *bu + /* Allow this buffer to be flushed by GStreamer. We are effectively + * implementing a queue object here. */ + +- while (stream->enabled && !stream->flushing && !stream->parser->error && !has_buffer_capacity(stream, buffer)) ++ while (stream->enabled && !stream->flushing && !stream->parser->error && stream->buffer) + pthread_cond_wait(&parser->stream_event_cond, &parser->mutex); + + if (stream->parser->error) +@@ -934,50 +876,16 @@ static GstFlowReturn sink_chain_cb(GstPad *pad, GstObject *parent, GstBuffer *bu + return GST_FLOW_FLUSHING; + } + +- if (!stream->buffer) ++ if (!gst_buffer_map(buffer, &stream->map_info, GST_MAP_READ)) + { +- if (!gst_buffer_map(buffer, &stream->map_info, GST_MAP_READ)) +- { +- pthread_mutex_unlock(&parser->mutex); +- GST_ERROR("Failed to map buffer."); +- gst_buffer_unref(buffer); +- return GST_FLOW_ERROR; +- } +- stream->buffer = buffer; +- } +- else +- { +- if (!stream->buffer_queue) +- { +- stream->buffer_queue_length = 0; +- stream->buffer_queue_capacity = 16; +- stream->buffer_queue = malloc(stream->buffer_queue_capacity * sizeof(*stream->buffer_queue)); +- if (!stream->buffer_queue) +- { +- pthread_mutex_unlock(&parser->mutex); +- GST_ERROR("Failed to malloc queue.\n"); +- gst_buffer_unref(buffer); +- return GST_FLOW_ERROR; +- } +- } +- else if (stream->buffer_queue_length >= stream->buffer_queue_capacity) +- { +- GstBuffer **new_buffer_queue; +- new_buffer_queue = realloc(stream->buffer_queue, +- stream->buffer_queue_capacity * 2 * sizeof(*stream->buffer_queue)); +- if (!new_buffer_queue) +- { +- pthread_mutex_unlock(&parser->mutex); +- GST_ERROR("Failed to realloc queue.\n"); +- gst_buffer_unref(buffer); +- return GST_FLOW_ERROR; +- } +- stream->buffer_queue_capacity *= 2; +- stream->buffer_queue = new_buffer_queue; +- } +- stream->buffer_queue[stream->buffer_queue_length++] = buffer; ++ pthread_mutex_unlock(&parser->mutex); ++ GST_ERROR("Failed to map buffer."); ++ gst_buffer_unref(buffer); ++ return GST_FLOW_ERROR; + } + ++ stream->buffer = buffer; ++ + pthread_mutex_unlock(&parser->mutex); + pthread_cond_broadcast(&parser->stream_event_cond); + +@@ -1165,15 +1073,6 @@ static void free_stream(struct wg_parser_stream *stream) + gst_buffer_unref(stream->buffer); + stream->buffer = NULL; + } +- if (stream->buffer_queue && stream->buffer_queue_length) +- { +- for (size_t i = 0; i < stream->buffer_queue_length; i++) +- gst_buffer_unref(stream->buffer_queue[i]); +- stream->buffer_queue_length = 0; +- stream->buffer_queue_capacity = 0; +- free(stream->buffer_queue); +- stream->buffer_queue = NULL; +- } + + for (i = 0; i < ARRAY_SIZE(stream->tags); ++i) + { +-- +2.44.0 + diff --git a/patches/wine-gst/0032-SQUASH-winegstreamer-Tighten-buffering-limits-and-th.patch b/patches/wine-gst/0032-SQUASH-winegstreamer-Tighten-buffering-limits-and-th.patch new file mode 100644 index 000000000..d4a1fcbd5 --- /dev/null +++ b/patches/wine-gst/0032-SQUASH-winegstreamer-Tighten-buffering-limits-and-th.patch @@ -0,0 +1,32 @@ +From a722a8fbd42061ecc505800bdec5a69c405b8e96 Mon Sep 17 00:00:00 2001 +From: Torge Matthies +Date: Tue, 26 Mar 2024 00:07:47 +0100 +Subject: [PATCH 32/32] [SQUASH] winegstreamer: Tighten buffering limits and + thresholds. + +--- + dlls/winegstreamer/wg_parser.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c +index 97be10dbbd9..4863b4b6440 100644 +--- a/dlls/winegstreamer/wg_parser.c ++++ b/dlls/winegstreamer/wg_parser.c +@@ -2257,10 +2257,11 @@ static BOOL create_multiqueue(struct wg_parser *parser) + !gst_element_sync_state_with_parent(parser->multiqueue))) + return FALSE; + +- g_object_set(parser->multiqueue, "max-size-buffers", (guint)-1, NULL); +- g_object_set(parser->multiqueue, "max-size-bytes", (guint)-1, NULL); ++ g_object_set(parser->multiqueue, "max-size-buffers", 3600U, NULL); ++ g_object_set(parser->multiqueue, "max-size-bytes", 209715200U, NULL); + g_object_set(parser->multiqueue, "max-size-time", 1 * GST_SECOND, NULL); +- g_object_set(parser->multiqueue, "high-watermark", 0.5, NULL); ++ g_object_set(parser->multiqueue, "low-percent", 1, NULL); ++ g_object_set(parser->multiqueue, "high-percent", 80, NULL); + + return TRUE; + } +-- +2.44.0 +