videoflip: fix critical when tag list is not writable
[platform/upstream/gstreamer.git] / subprojects / gst-plugins-good / gst / videofilter / gstvideoflip.c
index 003a79e..bd7cbeb 100644 (file)
@@ -1791,8 +1791,18 @@ gst_video_flip_sink_event (GstBaseTransform * trans, GstEvent * event)
 
         if (vf->method == GST_VIDEO_ORIENTATION_AUTO) {
           /* update the orientation tag as we rotate the video accordingly */
-          gst_tag_list_add (taglist, GST_TAG_MERGE_REPLACE, "image-orientation",
-              "rotate-0", NULL);
+          if (gst_tag_list_is_writable (taglist)) {
+            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);
+          }
         }
       }
       break;