gst: do not send UNKNOWN format

If the video format cannot be detected, GStreamer will return the
UNKNOWN format, which is translated into the Id 0 in the
Spa:Interface:TypeMap, which is added to the pod.

When the pipewire server receives the pod and tries to unmarshal the
pod, it will detect the Id 0. Unable to distinguish Id 0 from a missing
id, the server discards the message as invalid and closes the
connection.

Use the following gstreamer pipeline to reproduce (note the wrong nv12
instead of a correct NV12 format):

	gst-launch-1.0 pipewiresrc ! video/x-raw,format=nv12 ! fakesink
This commit is contained in:
Michael Tretter 2019-08-23 10:50:54 +02:00 committed by Wim Taymans
parent 94ffe88b65
commit eea3bc22b7

View file

@ -376,7 +376,7 @@ handle_video_fields (ConvertData *d)
}
idx = gst_video_format_from_string (v);
if (idx < (int)SPA_N_ELEMENTS (video_format_map))
if (idx != GST_VIDEO_FORMAT_UNKNOWN && idx < (int)SPA_N_ELEMENTS (video_format_map))
spa_pod_builder_id (&d->b, video_format_map[idx]);
}
choice = spa_pod_builder_pop(&d->b, &f);