From 96afec6253ebab73954a366f611fb2622d60b9b4 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Mon, 10 Apr 2023 13:01:14 +0200 Subject: [PATCH] videoflip: reset orientation on new stream MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: --- .../gst-plugins-good/gst/videofilter/gstvideoflip.c | 4 ++++ .../gst-plugins-good/tests/check/elements/videoflip.c | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/subprojects/gst-plugins-good/gst/videofilter/gstvideoflip.c b/subprojects/gst-plugins-good/gst/videofilter/gstvideoflip.c index 07db89969d..dc1861e771 100644 --- a/subprojects/gst-plugins-good/gst/videofilter/gstvideoflip.c +++ b/subprojects/gst-plugins-good/gst/videofilter/gstvideoflip.c @@ -1790,6 +1790,10 @@ gst_video_flip_sink_event (GstBaseTransform * trans, GstEvent * event) gst_video_flip_set_method (vf, method, TRUE); } 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: break; } diff --git a/subprojects/gst-plugins-good/tests/check/elements/videoflip.c b/subprojects/gst-plugins-good/tests/check/elements/videoflip.c index dfa107021e..7e1b857acf 100644 --- a/subprojects/gst-plugins-good/tests/check/elements/videoflip.c +++ b/subprojects/gst-plugins-good/tests/check/elements/videoflip.c @@ -369,6 +369,15 @@ GST_START_TEST (test_orientation_tag) // caps is updated as the frame is now rotated 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); }