videoaggregator: Fix locking around vagg->info
authorJan Alexander Steffens (heftig) <jan.steffens@ltnglobal.com>
Tue, 3 Nov 2020 16:00:53 +0000 (17:00 +0100)
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Mon, 9 Nov 2020 16:04:06 +0000 (16:04 +0000)
commitb3fe2d3623722ebf9dfe5c3dc198764ce17cba38
tree4c5942b567619673161244edf4066d31fad7f111
parentb005d472f7af4219d17a6d53b790a2d7a8c0298e
videoaggregator: Fix locking around vagg->info

Take `GST_OBJECT_LOCK` when writing `vagg->info`, so that reading in
subclasses is protected against races, as documented in the struct.

    /*< public >*/
    /* read-only, with OBJECT_LOCK */
    GstVideoInfo                  info;

`gst_video_aggregator_default_negotiated_src_caps` should take the
`GST_VIDEO_AGGREGATOR_LOCK` to avoid racing with
`gst_video_aggregator_reset` called by
`gst_video_aggregator_release_pad` of the last sinkpad. Otherwise it can
happen that `latency = gst_util_uint64_scale (...` gets called with a
zero framerate.

There doesn't seem to be any reason not to use the local `info` instead
of `vagg->info`, so do that.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/915>
gst-libs/gst/video/gstvideoaggregator.c