Skip to content

V4l2object: Avoid colorimetry mismatch for streams with invalid colorimetry

Qi Hou requested to merge (removed):v4l2object into master

Some streams have invalid gst colorimetry in caps and it will be set to default value by below code in video-info.c. Then this gst colorimetry is used to do mapping with v4l2 colorimetry.

    if (!gst_video_colorimetry_from_string (&info->colorimetry, s)) {
      GST_WARNING ("unparsable colorimetry, using default");
      set_default_colorimetry (info);
    } else if (!validate_colorimetry (info)) {
      GST_WARNING ("invalid colorimetry, using default");
      set_default_colorimetry (info);
    } else {
      /* force RGB matrix for RGB formats */
      if (GST_VIDEO_FORMAT_INFO_IS_RGB (info->finfo) &&
          info->colorimetry.matrix != GST_VIDEO_COLOR_MATRIX_RGB) {
        GST_WARNING ("invalid matrix %d for RGB format, using RGB",
            info->colorimetry.matrix);
        info->colorimetry.matrix = GST_VIDEO_COLOR_MATRIX_RGB;
      }
    }

But when check colorimetry in gst_v4l2_video_colorimetry_matches(), it uses gst colorimetry in caps directly. It will causes mismatch. Seems need to use gst colorimetry obtained like the same way above.

Edited by Nicolas Dufresne

Merge request reports

Loading