winegstreamer: Remove copying support from wg_transform_push_data.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
This commit is contained in:
Rémi Bernon 2022-06-13 14:00:38 +02:00 committed by Alexandre Julliard
parent ca0719f440
commit 5dcf77d8d0
4 changed files with 8 additions and 17 deletions

View file

@ -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);

View file

@ -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

View file

@ -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)
{

View file

@ -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");