Rémi Bernon (@rbernon) commented about dlls/winegstreamer/wg_muxer.c:
+ GstFlowReturn ret; + GstBuffer *buffer; + + if (!(stream = muxer_get_stream_by_id(muxer, sample->stream_id))) + return MF_E_INVALIDSTREAMNUMBER; + + /* Create sample data buffer by wrapping wg_sample. */ + if (!(buffer = gst_buffer_new_wrapped_full(GST_MEMORY_FLAG_READONLY, wg_sample_data(sample), sample->max_size, + 0, sample->size, sample, sample_free_notify))) + { + GST_ERROR("Failed to allocate input buffer."); + return E_OUTOFMEMORY; + } + + InterlockedIncrement(&sample->refcount); + GST_INFO("Wrapped %u/%u bytes from sample %p to buffer %p.", sample->size, sample->max_size, sample, buffer); I don't think you should use zero-copy here, especially as in the next change you don't have a sample queue to garbage collect the released samples.
This is also likely going to use compressed samples only, so probably not very large, and I think copying data should be fine. You can do it with `gst_buffer_new_and_alloc` then `gst_buffer_fill`. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3810#note_45163