Rémi Bernon : winegstreamer: Remove copying support from wg_transform_push_data.
Alexandre Julliard
julliard at winehq.org
Mon Jun 13 16:02:17 CDT 2022
Module: wine
Branch: master
Commit: 5dcf77d8d0d1676b806c1cc56706c3b738327e9c
URL: https://source.winehq.org/git/wine.git/?a=commit;h=5dcf77d8d0d1676b806c1cc56706c3b738327e9c
Author: Rémi Bernon <rbernon at codeweavers.com>
Date: Mon Jun 13 14:00:38 2022 +0200
winegstreamer: Remove copying support from wg_transform_push_data.
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
dlls/winegstreamer/gst_private.h | 3 ---
dlls/winegstreamer/unixlib.h | 2 --
dlls/winegstreamer/wg_sample.c | 8 +++++++-
dlls/winegstreamer/wg_transform.c | 12 +-----------
4 files changed, 8 insertions(+), 17 deletions(-)
diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h
index da0f1b103b3..e1abe7018da 100644
--- a/dlls/winegstreamer/gst_private.h
+++ b/dlls/winegstreamer/gst_private.h
@@ -102,9 +102,6 @@ void wg_parser_stream_seek(struct wg_parser_stream *stream, double rate,
struct wg_transform *wg_transform_create(const struct wg_format *input_format,
const struct wg_format *output_format);
void wg_transform_destroy(struct wg_transform *transform);
-HRESULT wg_transform_push_data(struct wg_transform *transform, struct wg_sample *sample);
-HRESULT wg_transform_read_data(struct wg_transform *transform, struct wg_sample *sample,
- struct wg_format *format);
unsigned int wg_format_get_max_size(const struct wg_format *format);
diff --git a/dlls/winegstreamer/unixlib.h b/dlls/winegstreamer/unixlib.h
index ed56fb47908..860a8ab2a52 100644
--- a/dlls/winegstreamer/unixlib.h
+++ b/dlls/winegstreamer/unixlib.h
@@ -121,8 +121,6 @@ enum wg_sample_flag
WG_SAMPLE_FLAG_HAS_PTS = 2,
WG_SAMPLE_FLAG_HAS_DURATION = 4,
WG_SAMPLE_FLAG_SYNC_POINT = 8,
-
- WG_SAMPLE_FLAG_HAS_REFCOUNT = 0x10000, /* sample is queued on the client side and may be wrapped */
};
struct wg_sample
diff --git a/dlls/winegstreamer/wg_sample.c b/dlls/winegstreamer/wg_sample.c
index 47892b71796..ae8a2d4d0c7 100644
--- a/dlls/winegstreamer/wg_sample.c
+++ b/dlls/winegstreamer/wg_sample.c
@@ -185,7 +185,6 @@ static void wg_sample_queue_begin_append(struct wg_sample_queue *queue, struct w
/* make sure a concurrent wg_sample_queue_flush call won't release the sample until we're done */
InterlockedIncrement(&wg_sample->refcount);
- sample->wg_sample.flags |= WG_SAMPLE_FLAG_HAS_REFCOUNT;
EnterCriticalSection(&queue->cs);
list_add_tail(&queue->samples, &sample->entry);
@@ -245,6 +244,13 @@ void wg_sample_queue_destroy(struct wg_sample_queue *queue)
free(queue);
}
+/* These unixlib entry points should not be used directly, they assume samples
+ * to be queued and zero-copy support, use the helpers below instead.
+ */
+HRESULT wg_transform_push_data(struct wg_transform *transform, struct wg_sample *sample);
+HRESULT wg_transform_read_data(struct wg_transform *transform, struct wg_sample *sample,
+ struct wg_format *format);
+
HRESULT wg_transform_push_mf(struct wg_transform *transform, struct wg_sample *wg_sample,
struct wg_sample_queue *queue)
{
diff --git a/dlls/winegstreamer/wg_transform.c b/dlls/winegstreamer/wg_transform.c
index d40f508250c..b5517f24515 100644
--- a/dlls/winegstreamer/wg_transform.c
+++ b/dlls/winegstreamer/wg_transform.c
@@ -542,17 +542,7 @@ NTSTATUS wg_transform_push_data(void *args)
return STATUS_SUCCESS;
}
- if (!(sample->flags & WG_SAMPLE_FLAG_HAS_REFCOUNT))
- {
- if (!(buffer = gst_buffer_new_and_alloc(sample->size)))
- {
- GST_ERROR("Failed to allocate input buffer");
- return STATUS_NO_MEMORY;
- }
- gst_buffer_fill(buffer, 0, sample->data, sample->size);
- GST_INFO("Copied %u bytes from sample %p to buffer %p", sample->size, sample, buffer);
- }
- else if (!(buffer = gst_buffer_new_wrapped_full(GST_MEMORY_FLAG_READONLY, sample->data, sample->max_size,
+ if (!(buffer = gst_buffer_new_wrapped_full(GST_MEMORY_FLAG_READONLY, sample->data, sample->max_size,
0, sample->size, sample, wg_sample_free_notify)))
{
GST_ERROR("Failed to allocate input buffer");
More information about the wine-cvs
mailing list