videoflip: reset orientation on new stream

Fix the following use:
- upstream sends a video with a rotation tag, say 90°
- upstream switches to another video without rotation
- the second video was still rotated by videoflip

Fix this by resetting the orientation when receiving STREAM_START.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4377>
This commit is contained in:
Guillaume Desmottes 2023-04-10 13:01:14 +02:00
parent 61a5da1014
commit 96afec6253
2 changed files with 13 additions and 0 deletions

View file

@ -1790,6 +1790,10 @@ gst_video_flip_sink_event (GstBaseTransform * trans, GstEvent * event)
gst_video_flip_set_method (vf, method, TRUE); gst_video_flip_set_method (vf, method, TRUE);
} }
break; break;
case GST_EVENT_STREAM_START:
GST_DEBUG_OBJECT (vf, "new stream, reset orientation from tags");
gst_video_flip_set_method (vf, GST_VIDEO_ORIENTATION_IDENTITY, TRUE);
break;
default: default:
break; break;
} }

View file

@ -369,6 +369,15 @@ GST_START_TEST (test_orientation_tag)
// caps is updated as the frame is now rotated // caps is updated as the frame is now rotated
caps_update (flip, &in_info, TRUE); caps_update (flip, &in_info, TRUE);
// orientation is reset on STREAM_START
gst_harness_push_event (flip, gst_event_new_stream_start ("2"));
e = gst_harness_pull_event (flip);
fail_unless_equals_int (GST_EVENT_TYPE (e), GST_EVENT_STREAM_START);
gst_event_unref (e);
caps_update (flip, &in_info, FALSE);
gst_harness_teardown (flip); gst_harness_teardown (flip);
} }