mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-03 04:52:28 +00:00
v4l2codecs: mpeg2: Fix selected sizeimage
Due to a copy paste bug, the bitdepth was never set and that was leading to requesting sizeimage of 0. Previously that worked since the driver would in that case pick a size for us. But now the we bumped the minimum to 4KB, the driver happily allocate 4KB of bitstream which lead to decoding error. As MPEG2 have a fixed bitdeph of 8, use a define instead of the run-time variable. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1415>
This commit is contained in:
parent
05458f05e0
commit
7e875ddb2c
1 changed files with 8 additions and 7 deletions
|
@ -34,6 +34,8 @@
|
|||
#define V4L2_MIN_KERNEL_VERSION \
|
||||
KERNEL_VERSION(V4L2_MIN_KERNEL_VER_MAJOR, V4L2_MIN_KERNEL_VER_MINOR, 0)
|
||||
|
||||
#define MPEG2_BITDEPTH 8
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (v4l2_mpeg2dec_debug);
|
||||
#define GST_CAT_DEFAULT v4l2_mpeg2dec_debug
|
||||
|
||||
|
@ -65,7 +67,6 @@ struct _GstV4l2CodecMpeg2Dec
|
|||
|
||||
guint16 width;
|
||||
guint16 height;
|
||||
guint bitdepth;
|
||||
guint chroma_format;
|
||||
gboolean interlaced;
|
||||
GstMpegVideoProfile profile;
|
||||
|
@ -188,19 +189,19 @@ get_pixel_bitdepth (GstV4l2CodecMpeg2Dec * self)
|
|||
switch (self->chroma_format) {
|
||||
case 0:
|
||||
/* 4:0:0 */
|
||||
depth = self->bitdepth;
|
||||
depth = MPEG2_BITDEPTH;
|
||||
break;
|
||||
case 1:
|
||||
/* 4:2:0 */
|
||||
depth = self->bitdepth + self->bitdepth / 2;
|
||||
depth = MPEG2_BITDEPTH + MPEG2_BITDEPTH / 2;
|
||||
break;
|
||||
case 2:
|
||||
/* 4:2:2 */
|
||||
depth = 2 * self->bitdepth;
|
||||
depth = 2 * MPEG2_BITDEPTH;
|
||||
break;
|
||||
case 3:
|
||||
/* 4:4:4 */
|
||||
depth = 3 * self->bitdepth;
|
||||
depth = 3 * MPEG2_BITDEPTH;
|
||||
break;
|
||||
default:
|
||||
GST_WARNING_OBJECT (self, "Unsupported chroma format %i",
|
||||
|
@ -277,8 +278,8 @@ gst_v4l2_codec_mpeg2_dec_negotiate (GstVideoDecoder * decoder)
|
|||
if (!gst_v4l2_decoder_select_src_format (self->decoder, caps, &self->vinfo)) {
|
||||
GST_ELEMENT_ERROR (self, CORE, NEGOTIATION,
|
||||
("Unsupported bitdepth/chroma format"),
|
||||
("No support for %ux%u %ubit chroma IDC %i", self->width,
|
||||
self->height, self->bitdepth, self->chroma_format));
|
||||
("No support for %ux%u chroma IDC %i", self->width,
|
||||
self->height, self->chroma_format));
|
||||
gst_caps_unref (caps);
|
||||
return FALSE;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue