videoflip: fix critical when tag list is not writable

Fix this pipeline where the tag list is not writable:

gst-launch-1.0 videotestsrc ! taginject tags="image-orientation=rotate-90" ! videoflip video-direction=auto \
  ! autovideosink

GStreamer-CRITICAL **: 12:34:36.310: gst_tag_list_add: assertion 'gst_tag_list_is_writable (list)' failed

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4987>
This commit is contained in:
Guillaume Desmottes 2023-07-07 12:33:37 +02:00 committed by GStreamer Marge Bot
parent 8f1524a592
commit 7b31c89f25

View file

@ -1804,8 +1804,18 @@ gst_video_flip_sink_event (GstBaseTransform * trans, GstEvent * event)
if (vf->method == GST_VIDEO_ORIENTATION_AUTO) { if (vf->method == GST_VIDEO_ORIENTATION_AUTO) {
/* update the orientation tag as we rotate the video accordingly */ /* update the orientation tag as we rotate the video accordingly */
gst_tag_list_add (taglist, GST_TAG_MERGE_REPLACE, "image-orientation", if (gst_tag_list_is_writable (taglist)) {
"rotate-0", NULL); gst_tag_list_add (taglist, GST_TAG_MERGE_REPLACE,
"image-orientation", "rotate-0", NULL);
} else {
taglist = gst_tag_list_copy (taglist);
gst_tag_list_add (taglist, GST_TAG_MERGE_REPLACE,
"image-orientation", "rotate-0", NULL);
gst_event_unref (event);
event = gst_event_new_tag (taglist);
}
} }
} else { } else {
// no orientation in tag // no orientation in tag