diff options
author | Frediano Ziglio <fziglio@redhat.com> | 2016-09-26 22:16:51 +0100 |
---|---|---|
committer | Frediano Ziglio <freddy77@gmail.com> | 2021-06-14 11:54:09 +0100 |
commit | de501cb9d001f8b93362e95c02e9594776413a92 (patch) | |
tree | 8168c0e9fdb28149f2d480288861b668f9d5782b | |
parent | a11e3e7c138faff5ee0d5893ab82d3475333ba41 (diff) |
gstreamer: Serarate buffer creation from push
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
-rw-r--r-- | server/gstreamer-encoder.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/server/gstreamer-encoder.c b/server/gstreamer-encoder.c index 6bb9a7f7..9017696c 100644 --- a/server/gstreamer-encoder.c +++ b/server/gstreamer-encoder.c @@ -1345,17 +1345,16 @@ static void unmap_and_release_memory(GstMapInfo *map, GstBuffer *buffer) gst_buffer_unref(buffer); } -/* A helper for spice_gst_encoder_encode_frame() */ static VideoEncodeResults -push_raw_frame(SpiceGstEncoder *encoder, - const SpiceImage *image, - const SpiceRect *src, int top_down, - gpointer bitmap_opaque) +setup_buffer(SpiceGstEncoder *encoder, + GstBuffer *buffer, + const SpiceImage *image, + const SpiceRect *src, int top_down, + gpointer bitmap_opaque) { uint32_t height = src->bottom - src->top; uint32_t len; uint32_t chunk_index = 0; - GstBuffer *buffer = gst_buffer_new(); /* TODO Use GST_MAP_INFO_INIT once GStreamer 1.4.5 is no longer relevant */ GstMapInfo map = { .memory = NULL }; const SpiceBitmap *bitmap = &image->u.bitmap; @@ -1431,6 +1430,22 @@ push_raw_frame(SpiceGstEncoder *encoder, gst_buffer_append_memory(buffer, map.memory); } #endif + return VIDEO_ENCODER_FRAME_ENCODE_DONE; +} + +/* A helper for spice_gst_encoder_encode_frame() */ +static VideoEncodeResults +push_raw_frame(SpiceGstEncoder *encoder, + const SpiceImage *image, + const SpiceRect *src, int top_down, + gpointer bitmap_opaque) +{ + GstBuffer *buffer = gst_buffer_new(); + + VideoEncodeResults r = setup_buffer(encoder, buffer, image, src, top_down, bitmap_opaque); + if (r != VIDEO_ENCODER_FRAME_ENCODE_DONE) { + return r; + } GstFlowReturn ret = gst_app_src_push_buffer(encoder->appsrc, buffer); if (ret != GST_FLOW_OK) { |