[PATCH v2 6/8] winegstreamer: Keep wg_transform output samples in a list.

Zebediah Figura (she/her) zfigura at codeweavers.com
Fri Feb 25 11:45:18 CST 2022


On 2/23/22 08:46, Rémi Bernon wrote:
> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51931
> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52391
> Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
> ---
>  dlls/winegstreamer/wg_transform.c | 31 +++++++++++++++++++++++++++++++
>  1 file changed, 31 insertions(+)
> 

What's the motivation for doing this?

(And why not, say, use a queue element instead? Not that this is
particularly complex, to be fair.)

> diff --git a/dlls/winegstreamer/wg_transform.c b/dlls/winegstreamer/wg_transform.c
> index a4a4d886865..ed4f95afde3 100644
> --- a/dlls/winegstreamer/wg_transform.c
> +++ b/dlls/winegstreamer/wg_transform.c
> @@ -39,23 +39,44 @@
>  
>  #include "unix_private.h"
>  
> +#include "wine/list.h"
> +
>  GST_DEBUG_CATEGORY_EXTERN(wine);
>  #define GST_CAT_DEFAULT wine
>  
> +struct sample_entry
> +{
> +    struct list entry;
> +    GstSample *sample;
> +};
> +
>  struct wg_transform
>  {
>      GstElement *container;
>      GstPad *my_src, *my_sink;
>      GstPad *their_sink, *their_src;
>      GstSegment segment;
> +    pthread_mutex_t mutex;
> +    struct list samples;
>  };
>  
>  static GstFlowReturn transform_sink_chain_cb(GstPad *pad, GstObject *parent, GstBuffer *buffer)
>  {
>      struct wg_transform *transform = gst_pad_get_element_private(pad);
> +    struct sample_entry *entry;
>  
>      GST_INFO("transform %p, buffer %p.", transform, buffer);
>  
> +    if (!(entry = calloc(1, sizeof(*entry))))
> +        GST_ERROR("Failed to allocate sample entry");
> +    else
> +    {
> +        pthread_mutex_lock(&transform->mutex);
> +        entry->sample = gst_sample_new(buffer, NULL, NULL, NULL);
> +        list_add_tail(&transform->samples, &entry->entry);
> +        pthread_mutex_unlock(&transform->mutex);

Why create a GstSample?

> +    }
> +
>      gst_buffer_unref(buffer);
>  
>      return GST_FLOW_OK;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20220225/7dd03341/attachment.sig>


More information about the wine-devel mailing list