Commit 683ed4dc authored by Michael Smith's avatar Michael Smith
Browse files

ext/annodex/gstcmmlenc.c: Use copies of header buffers for caps to avoid...

ext/annodex/gstcmmlenc.c: Use copies of header buffers for caps to avoid circular refcounting problems (as in theorad...

Original commit message from CVS:
* ext/annodex/gstcmmlenc.c: (gst_cmml_enc_set_header_on_caps):
Use copies of header buffers for caps to avoid circular refcounting
problems (as in theoradec, vorbisdec).

* tests/check/elements/cmmldec.c: (GST_START_TEST):
Fix a typo in test that meant it was testing the wrong thing.

* tests/check/elements/cmmlenc.c: (check_headers):
Fix refcount checks now that we use buffer-copies for caps.
parent 2fb7648f
2006-04-10 Michael Smith <msmith@fluendo.com>
* ext/annodex/gstcmmlenc.c: (gst_cmml_enc_set_header_on_caps):
Use copies of header buffers for caps to avoid circular refcounting
problems (as in theoradec, vorbisdec).
* tests/check/elements/cmmldec.c: (GST_START_TEST):
Fix a typo in test that meant it was testing the wrong thing.
* tests/check/elements/cmmlenc.c: (check_headers):
Fix refcount checks now that we use buffer-copies for caps.
2006-04-10 Tim-Philipp Müller <tim at centricular dot net>
* gst/matroska/matroska-demux.c: (gst_matroska_demux_base_init),
......
......@@ -315,6 +315,7 @@ gst_cmml_enc_set_header_on_caps (GstCmmlEnc * enc, GstCaps * caps,
GValue array = { 0 };
GValue value = { 0 };
GstStructure *structure;
GstBuffer *buffer;
caps = gst_caps_make_writable (caps);
structure = gst_caps_get_structure (caps, 0);
......@@ -322,12 +323,21 @@ gst_cmml_enc_set_header_on_caps (GstCmmlEnc * enc, GstCaps * caps,
g_value_init (&array, GST_TYPE_ARRAY);
g_value_init (&value, GST_TYPE_BUFFER);
gst_value_set_buffer (&value, ident);
/* Make copies of header buffers to avoid circular references */
buffer = gst_buffer_copy (ident);
gst_value_set_buffer (&value, buffer);
gst_value_array_append_value (&array, &value);
gst_value_set_buffer (&value, preamble);
gst_buffer_unref (buffer);
buffer = gst_buffer_copy (preamble);
gst_value_set_buffer (&value, buffer);
gst_value_array_append_value (&array, &value);
gst_value_set_buffer (&value, head);
gst_buffer_unref (buffer);
buffer = gst_buffer_copy (head);
gst_value_set_buffer (&value, buffer);
gst_value_array_append_value (&array, &value);
gst_buffer_unref (buffer);
GST_BUFFER_FLAG_SET (ident, GST_BUFFER_FLAG_IN_CAPS);
GST_BUFFER_FLAG_SET (preamble, GST_BUFFER_FLAG_IN_CAPS);
......
......@@ -312,7 +312,7 @@ GST_START_TEST (test_tags)
fail_unless (tag_val != NULL);
tag = g_value_get_object (tag_val);
fail_unless (tags != NULL);
fail_unless (tag != NULL);
g_object_get (tag, "title", &title, "base-uri", &base, "meta", &meta, NULL);
fail_unless_equals_string ("The Research Hunter", title);
......
......@@ -220,15 +220,15 @@ check_headers ()
fail_unless_equals_int (g_list_length (current_buf), 3);
/* check the ident header */
check_output_buffer_is_equal ("cmml-ident-buffer", IDENT_HEADER, 2);
check_output_buffer_is_equal ("cmml-ident-buffer", IDENT_HEADER, 1);
/* check the cmml processing instruction */
current_buf = current_buf->next;
check_output_buffer_is_equal ("cmml-preamble-buffer", PREAMBLE_ENCODED, 2);
check_output_buffer_is_equal ("cmml-preamble-buffer", PREAMBLE_ENCODED, 1);
/* check the encoded head tag */
current_buf = current_buf->next;
check_output_buffer_is_equal ("head-tag-buffer", HEAD_TAG_ENCODED, 2);
check_output_buffer_is_equal ("head-tag-buffer", HEAD_TAG_ENCODED, 1);
}
static void
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment