1 | /* GStreamer |
---|
2 | * Copyright (C) 2004 Benjamin Otte <otte@gnome.org> |
---|
3 | * |
---|
4 | * This library is free software; you can redistribute it and/or |
---|
5 | * modify it under the terms of the GNU General Public |
---|
6 | * License as published by the Free Software Foundation; either |
---|
7 | * version 2 of the License, or (at your option) any later version. |
---|
8 | * |
---|
9 | * This library is distributed in the hope that it will be useful, |
---|
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
12 | * General Public License for more details. |
---|
13 | * |
---|
14 | * You should have received a copy of the GNU General Public |
---|
15 | * License along with this library; if not, write to the Free |
---|
16 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
17 | */ |
---|
18 | |
---|
19 | /* |
---|
20 | * This file reproduces the bug in the bugreport #143777, as can be seen at |
---|
21 | * http://bugzilla.gnome.org/show_bug.cgi?id=143777 - the issue is that when |
---|
22 | * pausing a pipeline while the chainhandler is still running, then unlinking |
---|
23 | * the pad that's chain function is called and relinking it clears the buffer |
---|
24 | * that was stored for sending the event. gst_pad_call_chain_function needs |
---|
25 | * to check that. |
---|
26 | * The fix is in gstpad.c, revision 1.327 |
---|
27 | */ |
---|
28 | |
---|
29 | #include <gst/gst.h> |
---|
30 | |
---|
31 | gint |
---|
32 | main (gint argc, gchar ** argv) |
---|
33 | { |
---|
34 | GstElement *pipeline, *src, *sink, *id; |
---|
35 | guint i = 0, j; |
---|
36 | |
---|
37 | gst_init (&argc, &argv); |
---|
38 | |
---|
39 | g_print ("setting up...\n"); |
---|
40 | /* setup pipeline */ |
---|
41 | pipeline = gst_element_factory_make ("pipeline", NULL); |
---|
42 | g_assert (pipeline); |
---|
43 | src = gst_element_factory_make ("fakesrc", NULL); |
---|
44 | g_assert (src); |
---|
45 | id = gst_element_factory_make ("identity", NULL); |
---|
46 | g_assert (id); |
---|
47 | sink = gst_element_factory_make ("fakesink", NULL); |
---|
48 | g_assert (sink); |
---|
49 | |
---|
50 | gst_bin_add_many (GST_BIN (pipeline), src, id, sink, NULL); |
---|
51 | while (i < 100) { |
---|
52 | g_print ("running... (%d iterations)\n", i); |
---|
53 | if (gst_element_set_state (pipeline, |
---|
54 | GST_STATE_PLAYING) != GST_STATE_SUCCESS) |
---|
55 | g_assert_not_reached (); |
---|
56 | gst_element_link_many (src, id, sink, NULL); |
---|
57 | for (j = 0; j < i; j++) |
---|
58 | gst_bin_iterate (GST_BIN (pipeline)); |
---|
59 | if (gst_element_set_state (pipeline, GST_STATE_PAUSED) != GST_STATE_SUCCESS) |
---|
60 | g_assert_not_reached (); |
---|
61 | gst_element_unlink_many (src, id, sink, NULL); |
---|
62 | i++; |
---|
63 | } |
---|
64 | |
---|
65 | g_print ("cleaning up...\n"); |
---|
66 | g_assert (i == 100); |
---|
67 | gst_object_unref (GST_OBJECT (pipeline)); |
---|
68 | src = id = sink = pipeline = NULL; |
---|
69 | |
---|
70 | g_print ("done.\n"); |
---|
71 | return 0; |
---|
72 | } |
---|