gst: handle blocks and size allocation for encoded format

In case of encoded video we get n_planes as 0 from the video info so
passing that as n_datas is failing during the buffer negotiation. Make
sure to use an appropriate value based on whether we have raw video or
not.

Co-authored-by: Taruntej Kanakamalla <taruntej@asymptotic.io>
This commit is contained in:
Arun Raghavan 2025-04-16 19:47:40 -04:00
parent 55f71520db
commit ebe9381236
6 changed files with 65 additions and 15 deletions

View file

@ -22,6 +22,12 @@ G_DECLARE_FINAL_TYPE (GstPipeWirePool, gst_pipewire_pool, GST, PIPEWIRE_POOL, Gs
#define PIPEWIRE_POOL_MIN_BUFFERS 2u
#define PIPEWIRE_POOL_MAX_BUFFERS 16u
/* Only available in GStreamer 1.22+ */
#ifndef GST_VIDEO_FORMAT_INFO_IS_VALID_RAW
#define GST_VIDEO_FORMAT_INFO_IS_VALID_RAW(info) \
(info != NULL && (info)->format > GST_VIDEO_FORMAT_ENCODED)
#endif
typedef struct _GstPipeWirePoolData GstPipeWirePoolData;
struct _GstPipeWirePoolData {
GstPipeWirePool *pool;
@ -42,6 +48,7 @@ struct _GstPipeWirePool {
guint n_buffers;
gboolean has_video;
gboolean has_rawvideo;
gboolean add_metavideo;
GstAudioInfo audio_info;
GstVideoInfo video_info;