Skip to content

Draft: v4l2codecs: h265/vp9: Use coded resolution in GstVideoMeta

Marek Vasut requested to merge marex/gstreamer:v4l2decpad into main

NOTE: This is likely not the right fix.

Stream encoded such that its width is not aligned to HW decoder MB size (e.g. on i.MX8MP Plus Hantro G2, 16 Bytes) requires the decoder driver to allocated padded buffers (e.g. for 1080x256 stream, the buffer would be 1088x256). Playback of such a stream into a sink capable of importing DMABUFs directly would result in the entire DMABUF to be used, including the padding, which results in a "stripe" on the right side of the video window.

Pass GstVideoMeta with width and height set to the actual coded width and height of the video, so that the sink can display only a subset of the DMABUF containing valid video.

Example H265 stream which triggers this error can be generated this way:

$ gst-launch-1.0 videotestsrc ! video/x-raw,width=1080,height=256,format=I420 ! \
                 x265enc ! mpegtsmux ! filesink location=/tmp/test.h265-1080.ts

Example H265 playback pipelines (on i.MX8MP Hantro G2) which triggers the error:

$ gst-launch-1.0 filesrc location=/tmp/test.h265-1080.ts ! tsdemux ! \
                 h265parse ! v4l2slh265dec ! video/x-raw,format=NV12 ! \
		 glupload ! glcolorconvert ! glimagesinkelement

$ gst-launch-1.0 filesrc location=/tmp/test.h265-1080.ts ! tsdemux ! \
                 h265parse ! v4l2slh265dec ! video/x-raw,format=NV12 ! \
		 waylandsink

Example VP9 stream which triggers this error can be generated this way:

$ gst-launch-1.0 videotestsrc ! video/x-raw,width=1080,height=256,format=I420 ! \
                 vp9enc ! matroskamux ! filesink location=/tmp/test.vp9-1080.mkv

Example VP9 playback pipelines (on i.MX8MP Hantro G2) which triggers the error:

$ gst-launch-1.0 filesrc location=/tmp/test.vp9-1080.mkv ! matroskademux ! \
                 vp9parse ! v4l2slvp9dec ! video/x-raw,format=NV12 ! \
		 glupload ! glcolorconvert ! glimagesinkelement

$ gst-launch-1.0 filesrc location=/tmp/test.vp9-1080.mkv ! matroskademux ! \
                 vp9parse ! v4l2slvp9dec ! video/x-raw,format=NV12 ! \
		 waylandsink

Merge request reports