From 626e0258e32c6354de3fef180f9753ac5bb12870 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Tue, 25 Sep 2012 21:21:15 +0100 Subject: [PATCH] videomixer: fix warnings when using transparent background gst_video_frame_map() increases the refcount, which makes the buffer not writable any more technically, so calling gst_buffer_memset() on it will cause nasty warnings. Unit test disabled because it very rarely (for me) fails, possibly negotiation-related. https://bugzilla.gnome.org/show_bug.cgi?id=684398 --- gst/videomixer/videomixer2.c | 9 ++++++++- tests/check/pipelines/simple-launch-lines.c | 26 ++++++++++++++++++++++++-- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/gst/videomixer/videomixer2.c b/gst/videomixer/videomixer2.c index 95c8f21..f3d0f80 100644 --- a/gst/videomixer/videomixer2.c +++ b/gst/videomixer/videomixer2.c @@ -836,10 +836,17 @@ gst_videomixer2_blend_buffers (GstVideoMixer2 * mix, mix->fill_color (&outframe, 240, 128, 128); break; case VIDEO_MIXER2_BACKGROUND_TRANSPARENT: - gst_buffer_memset (*outbuf, 0, 0, outsize); + { + guint i, num_maps; + + num_maps = (outframe.meta) ? GST_VIDEO_FRAME_N_PLANES (&outframe) : 1; + for (i = 0; i < num_maps; ++i) + memset (outframe.map[i].data, 0, outframe.map[i].size); + /* use overlay to keep background transparent */ composite = mix->overlay; break; + } } for (l = mix->sinkpads; l; l = l->next) { diff --git a/tests/check/pipelines/simple-launch-lines.c b/tests/check/pipelines/simple-launch-lines.c index 326d357..4dedbe3 100644 --- a/tests/check/pipelines/simple-launch-lines.c +++ b/tests/check/pipelines/simple-launch-lines.c @@ -220,7 +220,8 @@ GST_START_TEST (test_rtp_payloaders) /*s = FAKESRC " ! ! rtpsv3vdepay ! " FAKESINK; */ } -GST_END_TEST +GST_END_TEST; + GST_START_TEST (test_video_encoders_decoders) { const gchar *s; @@ -253,7 +254,26 @@ GST_START_TEST (test_video_encoders_decoders) } } -GST_END_TEST +GST_END_TEST; + +#define VIDEOMIXER_PIPELINE \ + "videomixer name=mix background=transparent ! fakesink " \ + "videotestsrc num-buffers=50 ! " \ + " video/x-raw,format=RGBA, width=200,height=200,framerate=10/1 ! " \ + " videoconvert ! mix.sink_1 " \ + "videotestsrc num-buffers=50 pattern=smpte ! " \ + " video/x-raw,format=RGBA, width=720,height=480,framerate=10/1 ! " \ + " videoconvert ! mix.sink_0 " + +GST_START_TEST (test_videomixer) +{ + run_pipeline (setup_pipeline (VIDEOMIXER_PIPELINE), VIDEOMIXER_PIPELINE, + GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING), + GST_MESSAGE_UNKNOWN, GST_STATE_PLAYING); +} + +GST_END_TEST; + #endif /* #ifndef GST_DISABLE_PARSE */ static Suite * simple_launch_lines_suite (void) @@ -268,6 +288,8 @@ simple_launch_lines_suite (void) #ifndef GST_DISABLE_PARSE tcase_add_test (tc_chain, test_rtp_payloaders); tcase_add_test (tc_chain, test_video_encoders_decoders); + /* FIXME: very rarely fails, maybe because of negotiation issues? */ + tcase_skip_broken_test (tc_chain, test_videomixer); #endif return s; } -- 2.7.4